|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.http.message.BasicLineParserHC4
@Immutable public class BasicLineParserHC4
Basic parser for lines in the head section of an HTTP message. There are individual methods for parsing a request line, a status line, or a header line. The lines to parse are passed in memory, the parser does not depend on any specific IO mechanism. Instances of this class are stateless and thread-safe. Derived classes MUST maintain these properties.
Note: This class was created by refactoring parsing code located in various other classes. The author tags from those other classes have been replicated here, although the association with the parsing code taken from there has not been traced.
| Field Summary | |
|---|---|
static BasicLineParserHC4 |
DEFAULT
Deprecated. (4.3) use INSTANCE |
static BasicLineParserHC4 |
INSTANCE
|
protected org.apache.http.ProtocolVersion |
protocol
A version of the protocol to parse. |
| Constructor Summary | |
|---|---|
BasicLineParserHC4()
Creates a new line parser for HTTP. |
|
BasicLineParserHC4(org.apache.http.ProtocolVersion proto)
Creates a new line parser for the given HTTP-like protocol. |
|
| Method Summary | |
|---|---|
protected org.apache.http.ProtocolVersion |
createProtocolVersion(int major,
int minor)
Creates a protocol version. |
protected org.apache.http.RequestLine |
createRequestLine(java.lang.String method,
java.lang.String uri,
org.apache.http.ProtocolVersion ver)
Instantiates a new request line. |
protected org.apache.http.StatusLine |
createStatusLine(org.apache.http.ProtocolVersion ver,
int status,
java.lang.String reason)
Instantiates a new status line. |
boolean |
hasProtocolVersion(org.apache.http.util.CharArrayBuffer buffer,
org.apache.http.message.ParserCursor cursor)
|
org.apache.http.Header |
parseHeader(org.apache.http.util.CharArrayBuffer buffer)
|
static org.apache.http.Header |
parseHeader(java.lang.String value,
org.apache.http.message.LineParser parser)
|
org.apache.http.ProtocolVersion |
parseProtocolVersion(org.apache.http.util.CharArrayBuffer buffer,
org.apache.http.message.ParserCursor cursor)
|
static org.apache.http.ProtocolVersion |
parseProtocolVersion(java.lang.String value,
org.apache.http.message.LineParser parser)
|
org.apache.http.RequestLine |
parseRequestLine(org.apache.http.util.CharArrayBuffer buffer,
org.apache.http.message.ParserCursor cursor)
Parses a request line. |
static org.apache.http.RequestLine |
parseRequestLine(java.lang.String value,
org.apache.http.message.LineParser parser)
|
org.apache.http.StatusLine |
parseStatusLine(org.apache.http.util.CharArrayBuffer buffer,
org.apache.http.message.ParserCursor cursor)
|
static org.apache.http.StatusLine |
parseStatusLine(java.lang.String value,
org.apache.http.message.LineParser parser)
|
protected void |
skipWhitespace(org.apache.http.util.CharArrayBuffer buffer,
org.apache.http.message.ParserCursor cursor)
Helper to skip whitespace. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@Deprecated public static final BasicLineParserHC4 DEFAULT
INSTANCEBasicLineParser is not a singleton, there can
be many instances of the class itself and of derived classes.
The instance here provides non-customized, default behavior.
public static final BasicLineParserHC4 INSTANCE
protected final org.apache.http.ProtocolVersion protocol
| Constructor Detail |
|---|
public BasicLineParserHC4(org.apache.http.ProtocolVersion proto)
proto - a version of the protocol to parse, or
null for HTTP. The actual version
is not relevant, only the protocol name.public BasicLineParserHC4()
| Method Detail |
|---|
public static org.apache.http.ProtocolVersion parseProtocolVersion(java.lang.String value,
org.apache.http.message.LineParser parser)
throws org.apache.http.ParseException
org.apache.http.ParseException
public org.apache.http.ProtocolVersion parseProtocolVersion(org.apache.http.util.CharArrayBuffer buffer,
org.apache.http.message.ParserCursor cursor)
throws org.apache.http.ParseException
parseProtocolVersion in interface org.apache.http.message.LineParserorg.apache.http.ParseException
protected org.apache.http.ProtocolVersion createProtocolVersion(int major,
int minor)
parseProtocolVersion(java.lang.String, org.apache.http.message.LineParser).
major - the major version number, for example 1 in HTTP/1.0minor - the minor version number, for example 0 in HTTP/1.0
public boolean hasProtocolVersion(org.apache.http.util.CharArrayBuffer buffer,
org.apache.http.message.ParserCursor cursor)
hasProtocolVersion in interface org.apache.http.message.LineParser
public static org.apache.http.RequestLine parseRequestLine(java.lang.String value,
org.apache.http.message.LineParser parser)
throws org.apache.http.ParseException
org.apache.http.ParseException
public org.apache.http.RequestLine parseRequestLine(org.apache.http.util.CharArrayBuffer buffer,
org.apache.http.message.ParserCursor cursor)
throws org.apache.http.ParseException
parseRequestLine in interface org.apache.http.message.LineParserbuffer - a buffer holding the line to parse
org.apache.http.ParseException - in case of a parse error
protected org.apache.http.RequestLine createRequestLine(java.lang.String method,
java.lang.String uri,
org.apache.http.ProtocolVersion ver)
parseRequestLine(java.lang.String, org.apache.http.message.LineParser).
method - the request methoduri - the requested URIver - the protocol version
public static org.apache.http.StatusLine parseStatusLine(java.lang.String value,
org.apache.http.message.LineParser parser)
throws org.apache.http.ParseException
org.apache.http.ParseException
public org.apache.http.StatusLine parseStatusLine(org.apache.http.util.CharArrayBuffer buffer,
org.apache.http.message.ParserCursor cursor)
throws org.apache.http.ParseException
parseStatusLine in interface org.apache.http.message.LineParserorg.apache.http.ParseException
protected org.apache.http.StatusLine createStatusLine(org.apache.http.ProtocolVersion ver,
int status,
java.lang.String reason)
parseStatusLine(java.lang.String, org.apache.http.message.LineParser).
ver - the protocol versionstatus - the status codereason - the reason phrase
public static org.apache.http.Header parseHeader(java.lang.String value,
org.apache.http.message.LineParser parser)
throws org.apache.http.ParseException
org.apache.http.ParseException
public org.apache.http.Header parseHeader(org.apache.http.util.CharArrayBuffer buffer)
throws org.apache.http.ParseException
parseHeader in interface org.apache.http.message.LineParserorg.apache.http.ParseException
protected void skipWhitespace(org.apache.http.util.CharArrayBuffer buffer,
org.apache.http.message.ParserCursor cursor)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||