|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.jersey.spi.container.ContainerResponse
com.sun.jersey.spi.container.AdaptingContainerResponse
public class AdaptingContainerResponse
An adapting in-bound HTTP response that may override the behaviour of
ContainerResponse.
| Field Summary | |
|---|---|
protected ContainerResponse |
acr
The adapted container response. |
| Constructor Summary | |
|---|---|
protected |
AdaptingContainerResponse(ContainerResponse acr)
Create the adapting container response. |
| Method Summary | |
|---|---|
java.lang.annotation.Annotation[] |
getAnnotations()
Get the annotations associated with the response entity (if any). |
ContainerRequest |
getContainerRequest()
Get the container request. |
ContainerResponseWriter |
getContainerResponseWriter()
Get the container response writer. |
java.lang.Object |
getEntity()
|
java.lang.reflect.Type |
getEntityType()
|
javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> |
getHttpHeaders()
Get the HTTP response headers. |
MessageBodyWorkers |
getMessageBodyWorkers()
Get the message body workers. |
java.io.OutputStream |
getOutputStream()
Get an OutputStream to which an entity may be written. |
javax.ws.rs.core.Response |
getResponse()
Get the response that was set. |
int |
getStatus()
|
boolean |
isCommitted()
Ascertain if a response has been committed to the container. |
boolean |
isResponseSet()
Check if the response has been set using the setReponse methods. |
void |
reset()
Reset the response to 204 (No content) with no headers. |
void |
setAnnotations(java.lang.annotation.Annotation[] annotations)
Set the annotations associated with the response entity (if any). |
void |
setContainerRequest(ContainerRequest request)
Set the container request. |
void |
setContainerResponseWriter(ContainerResponseWriter responseWriter)
Set the container response writer. |
void |
setEntity(java.lang.Object entity)
Set the entity of the response. |
void |
setResponse(javax.ws.rs.core.Response response)
Set the response state from a Response instance. |
void |
setStatus(int status)
Set the status of the response. |
void |
write()
Write the response. |
| Methods inherited from class com.sun.jersey.spi.container.ContainerResponse |
|---|
getHeaderValue, getMediaType, getOriginalEntity |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final ContainerResponse acr
| Constructor Detail |
|---|
protected AdaptingContainerResponse(ContainerResponse acr)
acr - the container response to adapt.| Method Detail |
|---|
public void write()
throws java.io.IOException
ContainerResponse
The status and headers will be written by calling the method
ContainerResponseWriter.writeStatusAndHeaders(long, com.sun.jersey.spi.container.ContainerResponse) on the provided
ContainerResponseWriter instance. The OutputStream
returned from that method call is used to write the entity (if any)
to that OutputStream. An appropriate MessageBodyWriter
will be found to write the entity.
write in class ContainerResponsejava.io.IOException - if there is an error writing the entitypublic void reset()
ContainerResponse
reset in class ContainerResponsepublic ContainerRequest getContainerRequest()
ContainerResponse
getContainerRequest in class ContainerResponsepublic void setContainerRequest(ContainerRequest request)
ContainerResponse
setContainerRequest in class ContainerResponserequest - the container request.public ContainerResponseWriter getContainerResponseWriter()
ContainerResponse
getContainerResponseWriter in class ContainerResponsepublic void setContainerResponseWriter(ContainerResponseWriter responseWriter)
ContainerResponse
setContainerResponseWriter in class ContainerResponseresponseWriter - the container response writerpublic MessageBodyWorkers getMessageBodyWorkers()
ContainerResponse
getMessageBodyWorkers in class ContainerResponsepublic javax.ws.rs.core.Response getResponse()
HttpResponseContext
getResponse in interface HttpResponseContextgetResponse in class ContainerResponsepublic void setResponse(javax.ws.rs.core.Response response)
HttpResponseContext
setResponse in interface HttpResponseContextsetResponse in class ContainerResponseresponse - the response.public boolean isResponseSet()
HttpResponseContext
isResponseSet in interface HttpResponseContextisResponseSet in class ContainerResponsepublic int getStatus()
getStatus in interface HttpResponseContextgetStatus in class ContainerResponsepublic void setStatus(int status)
HttpResponseContext
setStatus in interface HttpResponseContextsetStatus in class ContainerResponsestatus - the status.public java.lang.Object getEntity()
getEntity in interface HttpResponseContextgetEntity in class ContainerResponsepublic java.lang.reflect.Type getEntityType()
getEntityType in interface HttpResponseContextgetEntityType in class ContainerResponsepublic void setEntity(java.lang.Object entity)
HttpResponseContext
If the entity is an instance of GenericEntity then the entity
and entity type are set from the entity and type of that
GenericEntity. Otherwise, the entity is set from the entity
parameter and the type is the class of that parameter.
If it is necessary to wrap an entity that may have been set with an
instance of GenericEntity then utilize the
HttpResponseContext.getOriginalEntity(), for example:
HttpResponseContext r = ...
r.setEntity(wrap(getOriginalEntity()));
setEntity in interface HttpResponseContextsetEntity in class ContainerResponseentity - the entity.public java.lang.annotation.Annotation[] getAnnotations()
HttpResponseContext
getAnnotations in interface HttpResponseContextgetAnnotations in class ContainerResponsepublic void setAnnotations(java.lang.annotation.Annotation[] annotations)
HttpResponseContext
setAnnotations in interface HttpResponseContextsetAnnotations in class ContainerResponseannotations - the annotations.public javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> getHttpHeaders()
HttpResponseContextHttpResponseContext.setResponse(javax.ws.rs.core.Response)
will replace any headers previously set.
getHttpHeaders in interface HttpResponseContextgetHttpHeaders in class ContainerResponse
public java.io.OutputStream getOutputStream()
throws java.io.IOException
HttpResponseContextOutputStream to which an entity may be written.
The first byte written will result in the writing of thethe status code and headers.
getOutputStream in interface HttpResponseContextgetOutputStream in class ContainerResponsejava.io.IOException - if an IO error occurspublic boolean isCommitted()
HttpResponseContextA response is committed if the status code, headers have been written to the container.
isCommitted in interface HttpResponseContextisCommitted in class ContainerResponse
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||