org.apache.http.message
Class BasicStatusLine

java.lang.Object
  extended byorg.apache.http.message.BasicStatusLine
All Implemented Interfaces:
StatusLine

public class BasicStatusLine
extends java.lang.Object
implements StatusLine

Represents a status line as returned from a HTTP server. See RFC2616 section 6.1. This class is immutable and therefore inherently thread safe.

Since:
4.0
Version:
$Id: BasicStatusLine.java 505744 2007-02-10 18:58:45Z rolandw $
Author:
Jeff Dever, Mike Bowler
See Also:
HttpStatus

Constructor Summary
BasicStatusLine(HttpVersion httpVersion, int statusCode, java.lang.String reasonPhrase)
          Creates a new status line with the given version, status, and reason.
 
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

BasicStatusLine

public BasicStatusLine(HttpVersion httpVersion,
                       int statusCode,
                       java.lang.String reasonPhrase)
Creates a new status line with the given version, status, and reason.

Parameters:
httpVersion - the HTTP version of the response
statusCode - the status code of the response
reasonPhrase - the reason phrase to the status code, or null
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

parse

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

getStatusCode

public int getStatusCode()
Specified by:
getStatusCode in interface StatusLine
Returns:
the Status-Code

getHttpVersion

public HttpVersion getHttpVersion()
Specified by:
getHttpVersion in interface StatusLine
Returns:
the HTTP-Version

getReasonPhrase

public java.lang.String getReasonPhrase()
Specified by:
getReasonPhrase in interface StatusLine
Returns:
the Reason-Phrase

toString

public java.lang.String toString()

format

public static void format(CharArrayBuffer buffer,
                          StatusLine statusline)

format

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


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.