org.eclipse.webdav.http.client
Class Response

java.lang.Object
  extended by org.eclipse.webdav.http.client.Message
      extended by org.eclipse.webdav.http.client.Response
All Implemented Interfaces:
IStatusCodes, IResponse

public class Response
extends Message
implements IResponse, IStatusCodes

An HTTP response message.

Note: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.


Field Summary
protected  Document document
           
protected  boolean hasDocumentBody
           
protected  int statusCode
           
protected  String statusMessage
           
 
Fields inherited from class org.eclipse.webdav.http.client.Message
bufferPool, context, hasInputStream, inputRead, is
 
Fields inherited from interface org.eclipse.webdav.IResponse
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_CROSS_SERVER_BINDING_FORBIDDEN, SC_FAILED_DEPENDENCY, SC_FORBIDDEN, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INSUFFICIENT_SPACE_ON_RESOURCE, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_LOCKED, SC_LOOP_DETECTED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTI_STATUS, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROCESSING, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_TIMEOUT, SC_REQUEST_TOO_LONG, SC_REQUEST_URI_TOO_LONG, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_UNAUTHORIZED, SC_UNPROCESSABLE_ENTITY, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY
 
Fields inherited from interface org.eclipse.webdav.http.client.IStatusCodes
HTTP_ACCEPTED, HTTP_BAD_GATEWAY, HTTP_BAD_REQUEST, HTTP_CONFLICT, HTTP_CONTINUE, HTTP_CREATED, HTTP_EXPECTATION_FAILED, HTTP_FORBIDDEN, HTTP_GATEWAY_TIMEOUT, HTTP_GONE, HTTP_HTTP_VERSION_NOT_SUPPORTED, HTTP_INTERNAL_SERVER_ERROR, HTTP_LENGTH_REQUIRED, HTTP_METHOD_NOT_ALLOWED, HTTP_MOVED_PERMANENTLY, HTTP_MOVED_TEMPORARILY, HTTP_MULTIPLE_CHOICES, HTTP_NO_CONTENT, HTTP_NON_AUTHORITATIVE_INFORMATION, HTTP_NOT_ACCEPTABLE, HTTP_NOT_FOUND, HTTP_NOT_IMPLEMENTED, HTTP_NOT_MODIFIED, HTTP_OK, HTTP_PARTIAL_CONTENT, HTTP_PAYMENT_REQUIRED, HTTP_PRECONDITION_FAILED, HTTP_PROXY_AUTHENTICATION_REQUIRED, HTTP_REQUEST_TIMEOUT, HTTP_REQUEST_TOO_LONG, HTTP_REQUEST_URI_TOO_LONG, HTTP_REQUESTED_RANGE_NOT_SATISFIABLE, HTTP_RESET_CONTENT, HTTP_SEE_OTHER, HTTP_SERVICE_UNAVAILABLE, HTTP_SWITCHING_PROTOCOLS, HTTP_TEMPORARY_REDIRECT, HTTP_UNAUTHORIZED, HTTP_UNSUPPORTED_MEDIA_TYPE, HTTP_USE_PROXY
 
Constructor Summary
Response(int statusCode, String statusMessage, IContext context, InputStream inputStream)
          Creates a response.
 
Method Summary
 long getContentLength()
          Returns the content length of this message's body, or -1 if the content length is unknown.
 ContentType getContentType()
          Returns the content type of this response's body, or null if the content type is unknown.
 Document getDocumentBody()
          Returns this response's body as a DOM Document.
 int getStatusCode()
          Returns this response's status code.
 String getStatusMessage()
          Returns this response's status message.
 boolean hasDocumentBody()
          Returns a boolean indicating whether this response has a body that can be marshaled to become a DOM Document.
 String toString()
           
 
Methods inherited from class org.eclipse.webdav.http.client.Message
close, getContext, getInputStream, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.webdav.IResponse
close, getContext, getInputStream
 

Field Detail

statusCode

protected int statusCode

statusMessage

protected String statusMessage

hasDocumentBody

protected boolean hasDocumentBody

document

protected Document document
Constructor Detail

Response

public Response(int statusCode,
                String statusMessage,
                IContext context,
                InputStream inputStream)
Creates a response.

Parameters:
context - the response's header, or null for an empty header
inputStream - an input stream containing the response's body, or null for an empty body
statusCode - the response's status code
statusMessage - the response's status message
Method Detail

getContentLength

public long getContentLength()
Returns the content length of this message's body, or -1 if the content length is unknown.

Overrides:
getContentLength in class Message
Returns:
the content length of this message's body

getContentType

public ContentType getContentType()
Returns the content type of this response's body, or null if the content type is unknown.

Returns:
the content type of this response's body

getDocumentBody

public Document getDocumentBody()
                         throws IOException
Returns this response's body as a DOM Document. This response must have a document body.

Specified by:
getDocumentBody in interface IResponse
Returns:
DOM document obtained from the XML body.
Throws:
IOException - if there is an I/O error

getStatusCode

public int getStatusCode()
Returns this response's status code.

Specified by:
getStatusCode in interface IResponse
Returns:
this response's status code

getStatusMessage

public String getStatusMessage()
Returns this response's status message.

Specified by:
getStatusMessage in interface IResponse
Returns:
this response's status message

hasDocumentBody

public boolean hasDocumentBody()
Returns a boolean indicating whether this response has a body that can be marshaled to become a DOM Document.

Specified by:
hasDocumentBody in interface IResponse
Returns:
a boolean indicating whether this response has a body that can be marshaled to become a DOM Document
See Also:
Document

toString

public String toString()
Overrides:
toString in class Message


Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.