com.nexaweb.client.netservice
Interface HttpResponse


public interface HttpResponse

HttpResponse is an incoming response from an HTTP client.


Method Summary
 byte[] getContent()
          Returns the body of the message.
 java.lang.String getHeader(java.lang.String headerName)
          Returns the value of the HTTP header with the given name.
 java.lang.String[] getHeaderNames()
          Returns an array of all the HTTP header names.
 java.io.InputStream getInputStream()
          Returns an input stream which provides response content from the internal buffer.
 long getLastModified()
          Returns the value of the Last-Modified header.
 int getResponseCode()
          Returns the response code, for example 500 (internal server error) or 200 (ok).
 java.lang.String getUri()
          Returns the uri indicating the origin of the message.
 

Method Detail

getInputStream

public java.io.InputStream getInputStream()
Returns an input stream which provides response content from the internal buffer.

Returns:
the input stream

getResponseCode

public int getResponseCode()
Returns the response code, for example 500 (internal server error) or 200 (ok). Other typical response code can be 404 (file not found), or 503 (service unavailable).
Response code is not always accurate due to the JVM browser plugin implentations vary.

The basic rules are:


In general, if you wants to rely on resposne code, please keep in mind these guidelines:

Returns:
The response code.

getHeader

public java.lang.String getHeader(java.lang.String headerName)
Returns the value of the HTTP header with the given name.

Parameters:
headerName - The name of the header.
Returns:
The value of the header.

getHeaderNames

public java.lang.String[] getHeaderNames()
Returns an array of all the HTTP header names.

Returns:
An array of header names. If the HTTP response code is available it will appear as a header named "status".

getContent

public byte[] getContent()
Returns the body of the message. If it's a multipart message, the contents of the preamble (the part of the body before the first part separator) will be returned.

Returns:
byte[] of the body content.

getUri

public java.lang.String getUri()
Returns the uri indicating the origin of the message.


getLastModified

public long getLastModified()
Returns the value of the Last-Modified header.

Returns:
The last modified date for this response or -1 if not available.


Copyright © 2005 Nexaweb Technologies, Inc. All Rights Reserved.