net.sourceforge.jwap
Class Response

java.lang.Object
  |
  +--net.sourceforge.jwap.Response

public class Response
extends java.lang.Object

This class represents a Response on a WSP GET or POST request

Author:
Michel Marti
See Also:
WAPClient.execute(Request)

Method Summary
 long getContentLength()
          Get the response content-length
 java.lang.String getContentType()
          Get the response content-type
 java.lang.String getHeader(java.lang.String name)
          Get the value of a response-header
 java.util.Enumeration getHeaderNames()
          Get a list of all header names for this response.
 java.util.Enumeration getHeaders(java.lang.String header)
          Get a list of all values for a header
 byte[] getResponseBody()
           
 java.io.InputStream getResponseBodyAsInputStream()
          Returns the response-body as input stream
 int getStatus()
           
 java.lang.String getStatusText()
          Returns the status-text corresponding to the response-status, e.g.
 boolean isSuccess()
          Determine if the response status signals success (HTTP 2xx).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getStatus

public int getStatus()

getStatusText

public java.lang.String getStatusText()
Returns the status-text corresponding to the response-status, e.g. for status-code 200 this method returns "OK".

isSuccess

public boolean isSuccess()
Determine if the response status signals success (HTTP 2xx).

getResponseBody

public byte[] getResponseBody()

getResponseBodyAsInputStream

public java.io.InputStream getResponseBodyAsInputStream()
Returns the response-body as input stream

getHeader

public java.lang.String getHeader(java.lang.String name)
Get the value of a response-header
Parameters:
name - the header name
Returns:
the header value or null if not present

getHeaderNames

public java.util.Enumeration getHeaderNames()
Get a list of all header names for this response.
Returns:
an enumeration of Strings

getHeaders

public java.util.Enumeration getHeaders(java.lang.String header)
Get a list of all values for a header
Parameters:
header - the header name
Returns:
an enumeration of strings

getContentType

public java.lang.String getContentType()
Get the response content-type

getContentLength

public long getContentLength()
Get the response content-length

toString

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