|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.monoserv.http.HttpResponse
public class HttpResponse
Creates a HTTP compliant response message based on the parameters given.
Field Summary | |
---|---|
static java.lang.String |
CRLF
Constant end of line character for the headers in the HTTP response |
Constructor Summary | |
---|---|
protected |
HttpResponse()
Blank constructor - not used |
Method Summary | |
---|---|
HttpParameters |
getHeaders()
Returns the HTTP headers as an HttpParameters object. |
java.lang.String |
getHttpMessage()
This will take all the information in the object and construct a http message from it. |
int |
getHttpResponseCode()
Returns the HTTP reponse code (defaults to 501-'Not Implemented'). |
static java.lang.String |
GetHTTPText(int code)
Returns a text based description of the HTTP code based on the supplied integer. |
double |
getHttpVersion()
Returns the HTTP version as a double. |
HttpBody |
getMessageBody()
Returns the object for the internal message body object. |
java.lang.String |
getStatusLine()
Returns the status line for the HTTP response. |
static HttpResponse |
makeResponse()
Creates a generic response message. |
static HttpResponse |
makeResponse(int responseCode)
Creates a generic HTTP response message using the supplied integer as the response code. |
static HttpResponse |
makeResponse(int responseCode,
double httpVersion)
Creates a HTTP response message with the response code and using the supplied HTTP version number As of right now, creates the HttpResponse object, sets the Response code and the HTTP version and returns it. |
void |
setHeaders(HttpParameters headerValues)
Saves the supplied parameters as the actual headers for this message. |
void |
setHttpResponseCode(int httpResponseCode)
Sets the HTTP response code to a new value. |
void |
setHttpVersion(double httpVersion)
Sets the HTTP version to a new value. |
void |
setMessageBody(HttpBody theBody)
Stores the body contents per the data passed in. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CRLF
Constructor Detail |
---|
protected HttpResponse()
Method Detail |
---|
public HttpParameters getHeaders()
public void setHeaders(HttpParameters headerValues)
headerValues
- The values stored inside the object to use.public HttpBody getMessageBody()
public void setMessageBody(HttpBody theBody)
theBody
- The object representing the HTTP message body to store.public int getHttpResponseCode()
public void setHttpResponseCode(int httpResponseCode)
httpResponseCode
- The new HTTP response code to be used.GetHTTPText(int)
public double getHttpVersion()
public void setHttpVersion(double httpVersion) throws GenericHTTPException
httpVersion
- The new HTTP version to use
GenericHTTPException
- If the value is less than 0.5 or greater than 2.0public java.lang.String getStatusLine() throws InvalidHTTPResponseCode
Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLFWhere SP is a space, CRLF is "\r\n" If the HTTP version is null, then a default of 1.0 is used. If an error occuprs while constructing the line, an exception is thrown.
InvalidHTTPResponseCode
- If the response code is not valid (must be
not null, greater than or equal to 100, less than or equal to 505).public static HttpResponse makeResponse() throws GenericHTTPException
HttpResponse.makeResponse(501);
GenericHTTPException
- If anything fails in creating itpublic static HttpResponse makeResponse(int responseCode) throws GenericHTTPException
HttpResponse.makeResponse(responseCode, 1.1);
responseCode
- The HTTP response code to use
GenericHTTPException
- If anything fails in creating itpublic static HttpResponse makeResponse(int responseCode, double httpVersion) throws GenericHTTPException
responseCode
- The HTTP response code to use for the objecthttpVersion
- The HTTP version to use for this message.
GenericHTTPException
- If the response code or http version are invalidsetHttpResponseCode(int)
,
setHttpVersion(double)
public java.lang.String getHttpMessage()
public static java.lang.String GetHTTPText(int code) throws InvalidHTTPResponseCode
code
- The HTTP code to reference.
InvalidHTTPResponseCode
- If the supplied code is not a valid HTTP
code. See valid codes reference
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |