|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.di.parser.ParserImpl
com.ibm.di.parser.HTTPParser
public class HTTPParser
The HTTP Parser interprets a byte stream according to the HTTP specification. This Parser is used by the HTTP Client Connector and by the HTTP Server Connector.
Field Summary | |
---|---|
static java.lang.String |
ENCODING_LATIN_1
(ISO Latin 1) Character Encoding. |
static java.lang.String |
HTTP_FILE_NOT_FOUND
String containing the status code and reason phrase for unsuccessful action when the server has not found anything matching the Request-URI. |
static java.lang.String |
HTTP_FORBIDDEN
String containing the status code and reason phrase for unsuccessful action because the request requires user authentication. |
static java.lang.String |
HTTP_OK
String containing the status code and reason phrase for successfully received, understood and accepted action. |
static java.lang.String |
HTTP_REDIR
String containing the status code and reason phrase for redirection when the requested resource resides temporarily under a different URI. |
Fields inherited from class com.ibm.di.parser.ParserImpl |
---|
_debug, myConfiguration |
Constructor Summary | |
---|---|
HTTPParser()
|
Method Summary | |
---|---|
java.lang.String[] |
getNames(Entry e)
Returns property/attribute names in specified entry. |
java.lang.Object |
getProp(Entry e,
java.lang.String prop)
Return a property/attribute value of specified entry. |
java.lang.String |
getVersion()
Version information. |
void |
httpAuthenticationRequest(java.lang.String realm)
Send a Forbidden response requesting authentication. |
void |
httpForbidden()
Send a HTTP response message with error code 401 (Forbidden) into the current output writer. |
void |
initParser()
Perform initialization of parser. |
void |
parseAuthentication(Entry entry)
Decode the username and password specified in the Authorization header of the request HTTP message. |
int |
readByte()
Reads one byte of the current input reader. |
Entry |
readEntry()
Reads entry from the current input reader. |
java.lang.String |
readLine()
Reads line from the current input reader. |
void |
sendAuthorization(Entry entry,
java.io.BufferedWriter out)
Send client authorization. |
void |
setClientMode(boolean clientMode)
Sets the client mode. |
void |
setProp(Entry e,
java.lang.String prop,
java.lang.Object value)
Sets a property/attribute's value of specified entry. |
void |
setUseProperties(boolean useProps)
Sets the user properties. |
void |
writeEntry(Entry entry)
Writes an entry to the current output writer. |
Methods inherited from class com.ibm.di.parser.ParserImpl |
---|
closeParser, debug, debugMode, flush, getClassInstance, getContext, getDebug, getInputStream, getOutputStream, getParam, getParser, getReader, getWriter, isDeltaSupported, logmsg, querySchema, registerScriptBeans, setConfiguration, setContext, setDebug, setInputStream, setInputStream, setInputStream, setOutputStream, setOutputStream, setParam, setParser |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String HTTP_OK
public static final java.lang.String HTTP_FILE_NOT_FOUND
public static final java.lang.String HTTP_FORBIDDEN
public static final java.lang.String HTTP_REDIR
public static final java.lang.String ENCODING_LATIN_1
Constructor Detail |
---|
public HTTPParser()
Method Detail |
---|
public void initParser() throws java.lang.Exception
initParser
in interface ParserInterface
initParser
in class ParserImpl
java.lang.Exception
- if an error occurs.public void setUseProperties(boolean useProps)
useProps
- the new properties.public void setClientMode(boolean clientMode)
clientMode
- the new client mode.public int readByte() throws java.lang.Exception
java.lang.Exception
- If an I/O error occurspublic java.lang.String readLine() throws java.lang.Exception
java.lang.Exception
- If an I/O error occurspublic Entry readEntry() throws java.lang.Exception
headersAsProperties
is checked, read headers are
represented as attributes or properties.
java.lang.Exception
- If an I/O error occurspublic void writeEntry(Entry entry) throws java.lang.Exception
entry
- the entry to be written.
java.lang.Exception
- http.url
is missingpublic void parseAuthentication(Entry entry) throws java.lang.Exception
entry
- entry containing the authorization header.
java.lang.Exception
- if the charset conversion failedpublic void setProp(Entry e, java.lang.String prop, java.lang.Object value)
headersAsProperties
parameter is checked.
e
- the entryprop
- The name of the property/attribute.value
- The value of the property/attribute.public java.lang.Object getProp(Entry e, java.lang.String prop)
headersAsProperties
parameter is checked.
e
- the entryprop
- The name of the property/attribute.
public java.lang.String[] getNames(Entry e)
headersAsProperties
parameter is checked.
e
- the entry
public void httpForbidden() throws java.io.IOException
java.io.IOException
- If an I/O error occurs.public void httpAuthenticationRequest(java.lang.String realm) throws java.io.IOException
This method sends response message with error code 401 (Forbidden) when a request is made to protected resources. The response message includes a WWW-Authenticate header specifying a scheme and a realm.
realm
- The realm
is string that defines a protection
space (a set of protected resources) within the same host.
java.io.IOException
- If an I/O error occurs.public void sendAuthorization(Entry entry, java.io.BufferedWriter out) throws java.lang.Exception
entry
- entry containing HTTP message attributes.out
- the output writer.
java.lang.Exception
- If an I/O error occurs or if base64 encoding fails.public java.lang.String getVersion()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |