com.xml_project.morganaxproc.filesystem
Class XProcHttpResponse

java.lang.Object
  extended by com.xml_project.morganaxproc.filesystem.XProcHttpResponse

public class XProcHttpResponse
extends java.lang.Object

This class contains the response of a http-request done by the file system to be evaluated by p:http-request.


Field Summary
static int HTTP_BAD_REQUEST
          A constant for http status code "bad request" (400).
static int HTTP_METHOD_NOT_ALLOWED
          A constant for http status code "method not allowed" (405).
static int HTTP_NOT_IMPLEMENTED
          A constant for http status code "not implemented" (501).
static int HTTP_OK
          A constant for http status code "ok" (200).
 
Constructor Summary
XProcHttpResponse(nu.xom.Document doc, java.lang.String encoding)
          Creates a new XProcHttpResponse with the given XOM document as body and the given encoding.
XProcHttpResponse(int statusCode)
          Creates a new XProcHttpResponse with the given status code.
XProcHttpResponse(int statusCode, nu.xom.Document doc, java.lang.String encoding)
          Creates a new XProcHttpResponse with the given status code, the given XOM document as body and the given encoding.
XProcHttpResponse(int statusCode, java.lang.String contentType, java.lang.String encoding, byte[] data)
          Creates a new XProcHttpResponse with the given status code, the given data as body, the given content type and the given encoding.
 
Method Summary
 void addBody(HttpBody body)
          Adds a body to the XProcHttpResponse.
 void addHeader(HttpHeader header)
          Adds a header to the XProcHttpResponse.
 HttpBody[] getBodies()
          Returns the bodies of this XProcHttpResponse.
 java.lang.String getContentType()
          Returns the content type of this XProcHttpResponse.
 HttpHeader[] getHeaders()
          Returns the headers of this XProcHttpResponse.
 int getStatusCode()
          Returns the status code of this XProcHttpResponse.
 boolean isMultipart()
          Checks whether this XProcHttpResponse has a multipart body.
 void setMultipart()
          Flags the body of this XProcHttpResponse to be multipart.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTTP_OK

public static final int HTTP_OK
A constant for http status code "ok" (200).

See Also:
Constant Field Values

HTTP_BAD_REQUEST

public static final int HTTP_BAD_REQUEST
A constant for http status code "bad request" (400).

See Also:
Constant Field Values

HTTP_METHOD_NOT_ALLOWED

public static final int HTTP_METHOD_NOT_ALLOWED
A constant for http status code "method not allowed" (405).

See Also:
Constant Field Values

HTTP_NOT_IMPLEMENTED

public static final int HTTP_NOT_IMPLEMENTED
A constant for http status code "not implemented" (501).

See Also:
Constant Field Values
Constructor Detail

XProcHttpResponse

public XProcHttpResponse(int statusCode)
Creates a new XProcHttpResponse with the given status code.

Parameters:
statusCode - the status code.

XProcHttpResponse

public XProcHttpResponse(nu.xom.Document doc,
                         java.lang.String encoding)
Creates a new XProcHttpResponse with the given XOM document as body and the given encoding.

Parameters:
doc - the document as body.
encoding - the encoding.

XProcHttpResponse

public XProcHttpResponse(int statusCode,
                         nu.xom.Document doc,
                         java.lang.String encoding)
Creates a new XProcHttpResponse with the given status code, the given XOM document as body and the given encoding. The 'content-type' header is set to "application/xml".

Parameters:
statusCode - the status code.
doc - the document as body.
encoding - the encoding.

XProcHttpResponse

public XProcHttpResponse(int statusCode,
                         java.lang.String contentType,
                         java.lang.String encoding,
                         byte[] data)
Creates a new XProcHttpResponse with the given status code, the given data as body, the given content type and the given encoding.

Parameters:
statusCode - the status code
contentType - the content type
encoding - the encoding
data - the data as body.
Method Detail

addHeader

public void addHeader(HttpHeader header)
Adds a header to the XProcHttpResponse.

Parameters:
header - the header to add.

addBody

public void addBody(HttpBody body)
Adds a body to the XProcHttpResponse.

Parameters:
body - the body to add.

setMultipart

public void setMultipart()
Flags the body of this XProcHttpResponse to be multipart.


isMultipart

public boolean isMultipart()
Checks whether this XProcHttpResponse has a multipart body.

Returns:
true if the body is multipart, otherwise false.

getContentType

public java.lang.String getContentType()
Returns the content type of this XProcHttpResponse.

Returns:
the content type.

getStatusCode

public final int getStatusCode()
Returns the status code of this XProcHttpResponse.

Returns:
the status code.

getHeaders

public HttpHeader[] getHeaders()
Returns the headers of this XProcHttpResponse.

Returns:
the headers.

getBodies

public HttpBody[] getBodies()
Returns the bodies of this XProcHttpResponse.

Returns:
the bodies.