public class EntityHolder<T>
extends java.lang.Object
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 and Description |
---|
EntityHolder()
Create an entity holder containing no entity.
|
EntityHolder(T t)
Create an entity holder containing an entity.
|
public EntityHolder()
public EntityHolder(T t)
t
- the entity.public boolean hasEntity()
public T getEntity()
Copyright © 2016 Oracle Corporation. All Rights Reserved.