public class ContainerResponse extends Object implements jakarta.ws.rs.container.ContainerResponseContext
| Constructor and Description | 
|---|
ContainerResponse(ContainerRequest requestContext,
                 jakarta.ws.rs.core.Response response)
Create a new Jersey container response context. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
close()
Closes the response. 
 | 
void | 
commitStream()
Commit the  
entity stream unless already committed. | 
void | 
enableBuffering(jakarta.ws.rs.core.Configuration configuration)
Enable a buffering of serialized entity. 
 | 
Set<String> | 
getAllowedMethods()  | 
Map<String,jakarta.ws.rs.core.NewCookie> | 
getCookies()  | 
Date | 
getDate()  | 
Object | 
getEntity()  | 
Annotation[] | 
getEntityAnnotations()  | 
Class<?> | 
getEntityClass()  | 
OutputStream | 
getEntityStream()  | 
jakarta.ws.rs.core.EntityTag | 
getEntityTag()  | 
Type | 
getEntityType()  | 
jakarta.ws.rs.core.MultivaluedMap<String,Object> | 
getHeaders()  | 
String | 
getHeaderString(String name)  | 
Locale | 
getLanguage()  | 
Date | 
getLastModified()  | 
int | 
getLength()  | 
jakarta.ws.rs.core.Link | 
getLink(String relation)  | 
jakarta.ws.rs.core.Link.Builder | 
getLinkBuilder(String relation)  | 
Set<jakarta.ws.rs.core.Link> | 
getLinks()  | 
URI | 
getLocation()  | 
jakarta.ws.rs.core.MediaType | 
getMediaType()  | 
ContainerRequest | 
getRequestContext()
Get the associated container request context paired with this response context. 
 | 
int | 
getStatus()  | 
jakarta.ws.rs.core.Response.StatusType | 
getStatusInfo()  | 
jakarta.ws.rs.core.MultivaluedMap<String,String> | 
getStringHeaders()  | 
org.glassfish.jersey.message.internal.OutboundMessageContext | 
getWrappedMessageContext()
Get the wrapped response message context. 
 | 
boolean | 
hasEntity()  | 
boolean | 
hasLink(String relation)  | 
boolean | 
isChunked()
Returns  
true if the response entity is a ChunkedOutput instance. | 
boolean | 
isCommitted()
Returns  
true if the entity stream has been committed. | 
boolean | 
isMappedFromException()
Returns true if the response is result of the exception (for example created during
  
exception mapping). | 
void | 
setEntity(Object entity)
Set a new message message entity. 
 | 
void | 
setEntity(Object entity,
         Annotation[] annotations)
Set a new message message entity. 
 | 
void | 
setEntity(Object entity,
         Annotation[] annotations,
         jakarta.ws.rs.core.MediaType mediaType)  | 
void | 
setEntity(Object entity,
         Type type,
         Annotation[] annotations)
Set a new message message entity. 
 | 
void | 
setEntityAnnotations(Annotation[] annotations)
Set the annotations attached to the entity. 
 | 
void | 
setEntityStream(OutputStream outputStream)  | 
void | 
setEntityType(Type type)
Set the message entity type information. 
 | 
void | 
setMappedFromException(boolean mappedFromException)
Sets the flag indicating whether the response was created based on the exception. 
 | 
void | 
setMediaType(jakarta.ws.rs.core.MediaType mediaType)
Set the message content media type. 
 | 
void | 
setStatus(int code)  | 
void | 
setStatusInfo(jakarta.ws.rs.core.Response.StatusType status)  | 
void | 
setStreamProvider(org.glassfish.jersey.message.internal.OutboundMessageContext.StreamProvider streamProvider)
Set the output stream provider callback. 
 | 
public ContainerResponse(ContainerRequest requestContext, jakarta.ws.rs.core.Response response)
requestContext - associated container request context.response - response instance initializing the response context.public boolean isMappedFromException()
exception mapping).public void setMappedFromException(boolean mappedFromException)
mappedFromException - True if this exception if result of the exception (for example result of
                      exception mapping).public int getStatus()
getStatus in interface jakarta.ws.rs.container.ContainerResponseContextpublic void setStatus(int code)
setStatus in interface jakarta.ws.rs.container.ContainerResponseContextpublic void setStatusInfo(jakarta.ws.rs.core.Response.StatusType status)
setStatusInfo in interface jakarta.ws.rs.container.ContainerResponseContextpublic jakarta.ws.rs.core.Response.StatusType getStatusInfo()
getStatusInfo in interface jakarta.ws.rs.container.ContainerResponseContextpublic ContainerRequest getRequestContext()
public Map<String,jakarta.ws.rs.core.NewCookie> getCookies()
getCookies in interface jakarta.ws.rs.container.ContainerResponseContextpublic org.glassfish.jersey.message.internal.OutboundMessageContext getWrappedMessageContext()
public String getHeaderString(String name)
getHeaderString in interface jakarta.ws.rs.container.ContainerResponseContextpublic jakarta.ws.rs.core.MultivaluedMap<String,Object> getHeaders()
getHeaders in interface jakarta.ws.rs.container.ContainerResponseContextpublic jakarta.ws.rs.core.MultivaluedMap<String,String> getStringHeaders()
getStringHeaders in interface jakarta.ws.rs.container.ContainerResponseContextpublic Date getDate()
getDate in interface jakarta.ws.rs.container.ContainerResponseContextpublic Locale getLanguage()
getLanguage in interface jakarta.ws.rs.container.ContainerResponseContextpublic jakarta.ws.rs.core.MediaType getMediaType()
getMediaType in interface jakarta.ws.rs.container.ContainerResponseContextpublic Set<String> getAllowedMethods()
getAllowedMethods in interface jakarta.ws.rs.container.ContainerResponseContextpublic int getLength()
getLength in interface jakarta.ws.rs.container.ContainerResponseContextpublic jakarta.ws.rs.core.EntityTag getEntityTag()
getEntityTag in interface jakarta.ws.rs.container.ContainerResponseContextpublic Date getLastModified()
getLastModified in interface jakarta.ws.rs.container.ContainerResponseContextpublic URI getLocation()
getLocation in interface jakarta.ws.rs.container.ContainerResponseContextpublic Set<jakarta.ws.rs.core.Link> getLinks()
getLinks in interface jakarta.ws.rs.container.ContainerResponseContextpublic boolean hasLink(String relation)
hasLink in interface jakarta.ws.rs.container.ContainerResponseContextpublic jakarta.ws.rs.core.Link getLink(String relation)
getLink in interface jakarta.ws.rs.container.ContainerResponseContextpublic jakarta.ws.rs.core.Link.Builder getLinkBuilder(String relation)
getLinkBuilder in interface jakarta.ws.rs.container.ContainerResponseContextpublic boolean hasEntity()
hasEntity in interface jakarta.ws.rs.container.ContainerResponseContextpublic Object getEntity()
getEntity in interface jakarta.ws.rs.container.ContainerResponseContextpublic void setEntity(Object entity)
setEntity in interface jakarta.ws.rs.container.ContainerResponseContextentity - entity object.MessageBodyWriterpublic void setEntity(Object entity, Annotation[] annotations)
entity - entity object.annotations - annotations attached to the entity.MessageBodyWriterpublic void setEntity(Object entity, Type type, Annotation[] annotations)
entity - entity object.type - declared entity class.annotations - annotations attached to the entity.MessageBodyWriterpublic void setEntity(Object entity, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType)
setEntity in interface jakarta.ws.rs.container.ContainerResponseContextpublic void setMediaType(jakarta.ws.rs.core.MediaType mediaType)
mediaType - message content media type.public Class<?> getEntityClass()
getEntityClass in interface jakarta.ws.rs.container.ContainerResponseContextpublic Type getEntityType()
getEntityType in interface jakarta.ws.rs.container.ContainerResponseContextpublic void setEntityType(Type type)
type - overriding message entity type.public Annotation[] getEntityAnnotations()
getEntityAnnotations in interface jakarta.ws.rs.container.ContainerResponseContextpublic void setEntityAnnotations(Annotation[] annotations)
annotations - entity annotations.public OutputStream getEntityStream()
getEntityStream in interface jakarta.ws.rs.container.ContainerResponseContextpublic void setEntityStream(OutputStream outputStream)
setEntityStream in interface jakarta.ws.rs.container.ContainerResponseContextpublic void setStreamProvider(org.glassfish.jersey.message.internal.OutboundMessageContext.StreamProvider streamProvider)
entity stream.streamProvider - non-null output stream provider.public void enableBuffering(jakarta.ws.rs.core.Configuration configuration)
CommonProperties.OUTBOUND_CONTENT_LENGTH_BUFFER.
 
 The buffering functionality is by default disabled and could be enabled by calling this method. In this case
 this method must be called before first bytes are written to the entity stream.configuration - runtime configuration.public void commitStream()
                  throws IOException
entity stream unless already committed.IOException - in case of the IO error.public boolean isCommitted()
true if the entity stream has been committed.true if the entity stream has been committed. Otherwise returns false.public void close()
public boolean isChunked()
true if the response entity is a ChunkedOutput instance.true if the entity is a ChunkedOutput instance, false otherwise.Copyright © 2007-2020, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.