Package org.apache.commons.httpclient
Class StatusLine
- java.lang.Object
-
- org.apache.commons.httpclient.StatusLine
-
public class StatusLine extends java.lang.ObjectRepresents a Status-Line as returned from a HTTP server. RFC2616 states the following regarding the Status-Line:6.1 Status-Line The first line of a Response message is the Status-Line, consisting of the protocol version followed by a numeric status code and its associated textual phrase, with each element separated by SP characters. No CR or LF is allowed except in the final CRLF sequence. Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLFThis class is immutable and is inherently thread safe.
- Since:
- 2.0
- See Also:
HttpStatus
-
-
Constructor Summary
Constructors Constructor Description StatusLine(java.lang.String statusLine)Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetHttpVersion()java.lang.StringgetReasonPhrase()intgetStatusCode()static booleanstartsWithHTTP(java.lang.String s)Tests if the string starts with 'HTTP' signature.java.lang.StringtoString()Return a string representation of this object.
-
-
-
Constructor Detail
-
StatusLine
public StatusLine(java.lang.String statusLine) throws HttpExceptionDefault constructor.- Parameters:
statusLine- the status line returned from the HTTP server- Throws:
HttpException- if the status line is invalid
-
-
Method Detail
-
getStatusCode
public final int getStatusCode()
- Returns:
- the Status-Code
-
getHttpVersion
public final java.lang.String getHttpVersion()
- Returns:
- the HTTP-Version
-
getReasonPhrase
public final java.lang.String getReasonPhrase()
- Returns:
- the Reason-Phrase
-
toString
public final java.lang.String toString()
Return a string representation of this object.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string represenation of this object.
-
startsWithHTTP
public static boolean startsWithHTTP(java.lang.String s)
Tests if the string starts with 'HTTP' signature.- Parameters:
s- string to test- Returns:
- true if the line starts with 'HTTP' signature, false otherwise.
-
-