|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.jersey.message.internal.OutboundMessageContext
public class OutboundMessageContext
Base outbound message context implementation.
| Nested Class Summary | |
|---|---|
static interface |
OutboundMessageContext.StreamProvider
Output stream provider. |
| Constructor Summary | |
|---|---|
OutboundMessageContext()
Create new outbound message context. |
|
OutboundMessageContext(OutboundMessageContext original)
Create new outbound message context copying the content of another context. |
|
| Method Summary | |
|---|---|
void |
close()
Closes the context. |
void |
commitStream()
Commits the entity stream if it wasn't already committed. |
List<Locale> |
getAcceptableLanguages()
Get a list of languages that are acceptable for the message. |
List<MediaType> |
getAcceptableMediaTypes()
Get a list of media types that are acceptable for the message. |
Set<String> |
getAllowedMethods()
Get the allowed HTTP methods from the Allow HTTP header. |
Date |
getDate()
Get message date. |
Object |
getEntity()
Get the message entity Java instance. |
Annotation[] |
getEntityAnnotations()
Get the annotations attached to the entity. |
Class<?> |
getEntityClass()
Get the raw message entity type information. |
OutputStream |
getEntityStream()
Get the entity output stream. |
EntityTag |
getEntityTag()
Get the entity tag. |
Type |
getEntityType()
Get the message entity type information. |
MultivaluedMap<String,Object> |
getHeaders()
Get the mutable message headers multivalued map. |
String |
getHeaderString(String name)
Get a message header as a single string value. |
Locale |
getLanguage()
Get the language of the entity. |
Date |
getLastModified()
Get the last modified date. |
int |
getLength()
Get Content-Length value. |
Link |
getLink(String relation)
Get the link for the relation. |
Link.Builder |
getLinkBuilder(String relation)
Convenience method that returns a Link.Builder
for the relation. |
Set<Link> |
getLinks()
Get the links attached to the message as header. |
URI |
getLocation()
Get the location. |
MediaType |
getMediaType()
Get the media type of the entity. |
Map<String,Cookie> |
getRequestCookies()
Get any cookies that accompanied the message. |
Map<String,NewCookie> |
getResponseCookies()
Get any new cookies set on the message message. |
MultivaluedMap<String,String> |
getStringHeaders()
Get a multi-valued map representing outbound message headers with their values converted to strings. |
boolean |
hasEntity()
Check if there is an entity available in the message. |
boolean |
hasLink(String relation)
Check if link for relation exists. |
boolean |
isCommitted()
Returns true if the entity stream has been committed. |
void |
replaceHeaders(MultivaluedMap<String,Object> headers)
Replace all headers. |
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,
MediaType mediaType)
Set a new message message entity. |
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)
Set a new entity output stream. |
void |
setEntityType(Type type)
Set the message entity type information. |
void |
setMediaType(MediaType mediaType)
Set the message content media type. |
void |
setStreamProvider(OutboundMessageContext.StreamProvider streamProvider)
Set the output stream provider. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OutboundMessageContext()
public OutboundMessageContext(OutboundMessageContext original)
original - the original outbound message context.| Method Detail |
|---|
public void replaceHeaders(MultivaluedMap<String,Object> headers)
headers - new headers.public MultivaluedMap<String,String> getStringHeaders()
public String getHeaderString(String name)
RuntimeDelegate.HeaderDelegate if one is available
via RuntimeDelegate.createHeaderDelegate(java.lang.Class)
for the header value class or using its toString method if a header
delegate is not available.
name - the message header.
null is returned. If the message header is present but has no
value then the empty string is returned. If the message header is present
more than once then the values of joined together and separated by a ','
character.public MultivaluedMap<String,Object> getHeaders()
public Date getDate()
null if not present.public Locale getLanguage()
null if not specifiedpublic MediaType getMediaType()
null if not specified (e.g. there's no
message entity).public List<MediaType> getAcceptableMediaTypes()
public List<Locale> getAcceptableLanguages()
public Map<String,Cookie> getRequestCookies()
Cookie.public Set<String> getAllowedMethods()
public int getLength()
public Map<String,NewCookie> getResponseCookies()
new cookie.public EntityTag getEntityTag()
null if not present.public Date getLastModified()
null if not present.public URI getLocation()
null if not present.public Set<Link> getLinks()
Set if no links are present. Never
returns null.public boolean hasLink(String relation)
relation - link relation.
true if the for the relation link exists, false
otherwise.public Link getLink(String relation)
relation - link relation.
null if not present.public Link.Builder getLinkBuilder(String relation)
Link.Builder
for the relation.
relation - link relation.
null if not
present.public boolean hasEntity()
true if the entity is present, returns
false otherwise.
true if there is an entity present in the message,
false otherwise.public Object getEntity()
null if the message does not contain an entity.
null if message does not contain an
entity body.public void setEntity(Object entity)
entity - entity object.MessageBodyWriter
public void setEntity(Object entity,
Annotation[] annotations)
entity - entity object.annotations - annotations attached to the entity.MessageBodyWriter
public void setEntity(Object entity,
Type type,
Annotation[] annotations)
entity - entity object.type - declared entity class.annotations - annotations attached to the entity.MessageBodyWriter
public void setEntity(Object entity,
Annotation[] annotations,
MediaType mediaType)
entity - entity object.annotations - annotations attached to the entity.mediaType - entity media type.MessageBodyWriterpublic void setMediaType(MediaType mediaType)
mediaType - message content media type.public Class<?> getEntityClass()
public Type getEntityType()
public void setEntityType(Type type)
type - overriding message entity type.public Annotation[] getEntityAnnotations()
public void setEntityAnnotations(Annotation[] annotations)
annotations - entity annotations.public OutputStream getEntityStream()
public void setEntityStream(OutputStream outputStream)
outputStream - new entity output stream.public void setStreamProvider(OutboundMessageContext.StreamProvider streamProvider)
streamProvider - output stream provider.public void commitStream()
entity stream if it wasn't already committed.
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()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||