org.owasp.webscarab.model
Class Response

java.lang.Object
  extended by org.owasp.webscarab.model.Message
      extended by org.owasp.webscarab.model.Response

public class Response
extends Message

Represents a HTTP response as sent by an HTTP server

Author:
rdawes

Field Summary
 
Fields inherited from class org.owasp.webscarab.model.Message
_logger
 
Constructor Summary
Response()
          Creates a new instance of Response
Response(Response resp)
          Creates a new instance of Response, copied from the supplied Response
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getMessage()
          Gets the human readable status message
 Request getRequest()
          returns the Request that created this Response
 java.lang.String getStatus()
          Gets the status code of the Response.
 java.lang.String getStatusLine()
          Returns the status code and human readable status message
 java.lang.String getVersion()
          returns the HTTP version supported by the server
 void parse(java.lang.String string)
          parses a Response from the String provided
 void parse(java.lang.StringBuffer buff)
          Instructs the class to read the headers and content from the supplied StringBuffer N.B.
 void read(java.io.InputStream is)
          parses the provided InputStream into an HTTP Response.
 void setMessage(java.lang.String message)
          sets the human-readable status message
 void setRequest(Request request)
          associates this Response with the provided Request
 void setStatus(java.lang.String status)
          sets the status code of the response.
 void setVersion(java.lang.String version)
          Sets the HTTP version supported by the server.
 java.lang.String toString()
          returns a string containing the response, using the RFC specified CRLF of "\r\n" to separate lines.
 java.lang.String toString(java.lang.String crlf)
          returns a string containing the response, using the provided string to separate lines.
 void write(java.io.OutputStream os)
          Writes the Response out to the supplied OutputStream, using the HTTP RFC CRLF value of "\r\n"
 void write(java.io.OutputStream os, java.lang.String crlf)
          Writes the Response to the supplied OutputStream, using the provided CRLF value.
 
Methods inherited from class org.owasp.webscarab.model.Message
addHeader, addHeader, deleteHeader, flushContentStream, getContent, getHeader, getHeaderNames, getHeaders, getHeaders, getLine, readLine, setContent, setHeader, setHeader, setHeaders, setNoBody
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Response

public Response()
Creates a new instance of Response


Response

public Response(Response resp)
Creates a new instance of Response, copied from the supplied Response

Parameters:
resp - The original Response to copy
Method Detail

read

public void read(java.io.InputStream is)
          throws java.io.IOException
parses the provided InputStream into an HTTP Response. It only parses the header part, and sets the ContentStream to the InputStream at the appropriate point.

Overrides:
read in class Message
Parameters:
is - The InputStream to read the Response from
Throws:
java.io.IOException - propagated from the InputStream

parse

public void parse(java.lang.String string)
           throws java.text.ParseException
parses a Response from the String provided

Parameters:
string -
Throws:
java.text.ParseException

parse

public void parse(java.lang.StringBuffer buff)
           throws java.text.ParseException
Description copied from class: Message
Instructs the class to read the headers and content from the supplied StringBuffer N.B. The "Content-length" header is updated automatically to reflect the true size of the content, if one exists

Overrides:
parse in class Message
Parameters:
buff -
Throws:
java.text.ParseException

write

public void write(java.io.OutputStream os)
           throws java.io.IOException
Writes the Response out to the supplied OutputStream, using the HTTP RFC CRLF value of "\r\n"

Overrides:
write in class Message
Parameters:
os -
Throws:
java.io.IOException

write

public void write(java.io.OutputStream os,
                  java.lang.String crlf)
           throws java.io.IOException
Writes the Response to the supplied OutputStream, using the provided CRLF value.

Overrides:
write in class Message
Parameters:
os -
crlf -
Throws:
java.io.IOException

setVersion

public void setVersion(java.lang.String version)
Sets the HTTP version supported by the server.

Parameters:
version -

getVersion

public java.lang.String getVersion()
returns the HTTP version supported by the server

Returns:

setStatus

public void setStatus(java.lang.String status)
sets the status code of the response.

Parameters:
status -

getStatus

public java.lang.String getStatus()
Gets the status code of the Response.

Returns:

setMessage

public void setMessage(java.lang.String message)
sets the human-readable status message

Parameters:
message -

getMessage

public java.lang.String getMessage()
Gets the human readable status message

Returns:

getStatusLine

public java.lang.String getStatusLine()
Returns the status code and human readable status message

Returns:

toString

public java.lang.String toString()
returns a string containing the response, using the RFC specified CRLF of "\r\n" to separate lines.

Overrides:
toString in class Message
Returns:

toString

public java.lang.String toString(java.lang.String crlf)
returns a string containing the response, using the provided string to separate lines.

Overrides:
toString in class Message
Parameters:
crlf -
Returns:

setRequest

public void setRequest(Request request)
associates this Response with the provided Request

Parameters:
request -

getRequest

public Request getRequest()
returns the Request that created this Response

Returns:
the request

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class Message