org.apache.http
Class StatusLine

java.lang.Object
  extended by org.apache.http.StatusLine

public class StatusLine
extends java.lang.Object

Represents 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 CRLF
 

This class is immutable and is inherently thread safe.

Since:
2.0
Version:
$Id: StatusLine.java 376961 2006-02-11 10:32:50Z olegk $
Author:
Jeff Dever, Mike Bowler
See Also:
HttpStatus

Constructor Summary
StatusLine(HttpVersion httpVersion, int statusCode)
           
StatusLine(HttpVersion httpVersion, int statusCode, java.lang.String reasonPhrase)
          Default constructor
 
Method Summary
static void format(CharArrayBuffer buffer, StatusLine statusline)
           
static java.lang.String format(StatusLine statusline)
           
 HttpVersion getHttpVersion()
           
 java.lang.String getReasonPhrase()
           
 int getStatusCode()
           
static StatusLine parse(CharArrayBuffer buffer, int indexFrom, int indexTo)
          Parses the status line returned from the HTTP server.
static StatusLine parse(java.lang.String s)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StatusLine

public StatusLine(HttpVersion httpVersion,
                  int statusCode,
                  java.lang.String reasonPhrase)
Default constructor


StatusLine

public StatusLine(HttpVersion httpVersion,
                  int statusCode)
Method Detail

parse

public static StatusLine parse(CharArrayBuffer buffer,
                               int indexFrom,
                               int indexTo)
                        throws ProtocolException
Parses the status line returned from the HTTP server.

Parameters:
buffer - the buffer from which to parse
indexFrom - where to start parsing in the buffer
indexTo - where to stop parsing in the buffer
Throws:
HttpException - if the status line is invalid
ProtocolException
Since:
4.0

parse

public static final StatusLine parse(java.lang.String s)
                              throws ProtocolException
Throws:
ProtocolException

getStatusCode

public final int getStatusCode()
Returns:
the Status-Code

getHttpVersion

public final HttpVersion getHttpVersion()
Returns:
the HTTP-Version

getReasonPhrase

public final java.lang.String getReasonPhrase()
Returns:
the Reason-Phrase

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

format

public static void format(CharArrayBuffer buffer,
                          StatusLine statusline)

format

public static java.lang.String format(StatusLine statusline)


Copyright 2005-2005-2006 Apache Software Foundation. All Rights Reserved.