|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.officefloor.plugin.socket.server.http.conversation.impl.HttpResponseImpl
public class HttpResponseImpl
| Constructor Summary | |
|---|---|
HttpResponseImpl(HttpConversationImpl conversation,
Connection connection,
BufferSquirtFactory squirtFactory,
String httpVersion,
boolean isCloseConnectionAfterSending)
Initiate by defaulting from the HttpRequest. |
|
| Method Summary | |
|---|---|
HttpHeader |
addHeader(String name,
String value)
Adds a HttpHeader for the response. |
OutputBufferStream |
getBody()
Obtains the OutputBufferStream to write the body of the response. |
HttpHeader |
getHeader(String name)
Obtains the first HttpHeader by the name. |
HttpHeader[] |
getHeaders()
Obtains all the HttpHeader instances for the response. |
void |
removeHeader(HttpHeader header)
Removes the particular HttpHeader from the response. |
void |
removeHeaders(String name)
Removes all HttpHeader instances by the name. |
void |
send()
Sends this HttpResponse. |
void |
setStatus(int status)
Specifies the status of the response with the default status message. |
void |
setStatus(int status,
String statusMessage)
Specifies the status of the response including specifying the status human readable message. |
void |
setVersion(String version)
Allows specifying the HTTP version on the response. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HttpResponseImpl(HttpConversationImpl conversation,
Connection connection,
BufferSquirtFactory squirtFactory,
String httpVersion,
boolean isCloseConnectionAfterSending)
HttpRequest.
conversation - HttpConversationImpl.connection - Connection.squirtFactory - BufferSquirtFactory.httpVersion - HTTP version.isCloseConnectionAfterSending - Flag indicating to close the Connection when this
HttpResponse is sent.| Method Detail |
|---|
public void setVersion(String version)
HttpResponseAllows specifying the HTTP version on the response. Values should be either HTTP/1.0 or HTTP/1.1.
This defaults to value on HttpRequest.
setVersion in interface HttpResponseversion - HTTP version.public void setStatus(int status)
HttpResponseSpecifies the status of the response with the default status message.
This defaults to 200 assuming the request was processed successfully.
setStatus in interface HttpResponsestatus - Status of the response.
public void setStatus(int status,
String statusMessage)
HttpResponse
setStatus in interface HttpResponsestatus - Status of the response.statusMessage - Human readable status message.HttpResponse.setStatus(int)
public HttpHeader addHeader(String name,
String value)
HttpResponse
Adds a HttpHeader for the response.
HttpHeader instances are provided on the response in the order
they are added.
addHeader in interface HttpResponsename - Name of HttpHeader.value - Value of HttpHeader.
HttpHeader instance added.public HttpHeader getHeader(String name)
HttpResponseHttpHeader by the name.
getHeader in interface HttpResponsename - Name of the HttpHeader.
HttpHeader by the name.public HttpHeader[] getHeaders()
HttpResponseHttpHeader instances for the response.
getHeaders in interface HttpResponseHttpHeader instances for the response.public void removeHeader(HttpHeader header)
HttpResponseHttpHeader from the response.
removeHeader in interface HttpResponseheader - HttpHeader to be removed from the response.public void removeHeaders(String name)
HttpResponse
Removes all HttpHeader instances by the name.
This method compliments HttpResponse.addHeader(String, String) to allow
adding a new single HttpHeader instance by name.
removeHeaders in interface HttpResponsename - Name of the HttpHeader instances to remove.public OutputBufferStream getBody()
HttpResponse
Obtains the OutputBufferStream to write the body of the response.
Closing the returned OutputBufferStream is similar to calling
HttpResponse.send().
getBody in interface HttpResponseOutputBufferStream to write the body of the response.HttpResponse.send()
public void send()
throws IOException
HttpResponseHttpResponse. After calling this HttpResponse.getBody() is
closed and the corresponding HttpRequest.getBody() is closed.
send in interface HttpResponseIOException - If fails to send this HttpResponse.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||