|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jersey.core.provider.EntityHolder<T>
public class EntityHolder<T>
A holder for an entity of a request consumed by the server or a response consumed by a client.
Some clients/servers may send requests/responses with no entity or an
entity (for example WebDAV clients). To support such request or responses
The EntityHolder
type may be used where the actual type
of the entity is declared as a type parameter.
For example a POST method that consumes a specific JAXB object,
MyJAXBObject
, can determine if the request contained the
JAXB object or the request contained no entity, as follows:
@POST @Consumes("text/plain") public void post(EntityHolder<MyJAXBObject> s) { if (s.hasEntity()) { MyJAXBObject entity = s.getEntity(); } else { ... } }
Constructor Summary | |
---|---|
EntityHolder()
Create an entity holder containing no entity. |
|
EntityHolder(T t)
Create an entity holder containing an entity. |
Method Summary | |
---|---|
T |
getEntity()
Get the entity. |
boolean |
hasEntity()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EntityHolder()
public EntityHolder(T t)
t
- the entity.Method Detail |
---|
public boolean hasEntity()
public T getEntity()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |