Secure iNet Factory

com.jscape.inet.http
Class HttpResponse

java.lang.Object
  extended by com.jscape.inet.mime.MimeMessage
      extended by com.jscape.inet.http.HttpResponse
All Implemented Interfaces:
MimeConstants, java.io.Serializable

public class HttpResponse
extends MimeMessage
implements java.io.Serializable

Represents an HTTP response as returned by the HTTP server in response to an HTTP request.

Example Usage:

 Http http = new Http();
 HttpRequest request = new HttpRequest("http://www.myserver.com","GET");
 HttpResponse response = http.getResponse(request);
 

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.jscape.inet.mime.MimeConstants
COLON, CR, CRLF, EQUALS, LF, QUESTION_MARK, SEMI_COLON, SPACE, TAB
 
Constructor Summary
HttpResponse(byte[] message)
          Creates a new HttpResponse object.
 
Method Summary
 int getContentLength()
          Gets value of Content-Length header in HTTP response representing the total number of bytes in HTTP response
 java.lang.String getContentType()
          Gets value of Content-Type header in HTTP response
 java.util.Enumeration getCookies()
          Gets all cookies sent back by HTTP server.
 java.util.Date getDate()
          Gets Date header from HTTP response representing the date the response was issued.
 java.util.Date getExpires()
          Gets the Expires header from HTTP response representing the date the content is set to expire for caching purposes.
 java.lang.String getHttpVersion()
          Gets HTTP version sent in response.
 java.util.Date getLastModified()
          Gets Last-Modified header from HTTP response representing the date the content received was last modified.
 int getResponseCode()
          Gets response code returned in HTTP response.
 
Methods inherited from class com.jscape.inet.mime.MimeMessage
addHeader, addHeader, addPart, addReplaceHeader, addReplaceHeader, getBody, getBodyAsFile, getBodyData, getBoundary, getContentTransferEncoding, getHeader, getHeaders, getHeaders, getHeaderValue, getMessage, getPart, getParts, getRawBodyData, removeHeader, removePart, removeParts, setBody, setBody, setBody, setBody, setBodyAsFile, setContentType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpResponse

public HttpResponse(byte[] message)
             throws MimeException
Creates a new HttpResponse object.

Parameters:
message - the contents of the HTTP response
Throws:
MimeException - if a MIME related parsing error occurs
Method Detail

getResponseCode

public int getResponseCode()
Gets response code returned in HTTP response.

Returns:
HTTP response code

getHttpVersion

public java.lang.String getHttpVersion()
Gets HTTP version sent in response.

Returns:
HTTP version

getContentLength

public int getContentLength()
Gets value of Content-Length header in HTTP response representing the total number of bytes in HTTP response

Returns:
content length

getContentType

public java.lang.String getContentType()
Gets value of Content-Type header in HTTP response

Overrides:
getContentType in class MimeMessage
Returns:
content type

getLastModified

public java.util.Date getLastModified()
Gets Last-Modified header from HTTP response representing the date the content received was last modified.

Returns:
date last modified

getDate

public java.util.Date getDate()
Gets Date header from HTTP response representing the date the response was issued.

Returns:
date of response

getExpires

public java.util.Date getExpires()
Gets the Expires header from HTTP response representing the date the content is set to expire for caching purposes.

Returns:
content expiration date

getCookies

public java.util.Enumeration getCookies()
                                 throws MimeException
Gets all cookies sent back by HTTP server.

Returns:
an Enumeration of HttpCookie
Throws:
MimeException - if an error occurs while parsing HTTP headers

Secure iNet Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved