|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.xml.ws.api.PropertySet
com.sun.xml.ws.client.RequestContext
public final class RequestContext
Request context implementation.
The JAX-WS spec exposes properties as a Map
, but if we just use
an ordinary HashMap
for this, it doesn't work as fast as we'd like
it to be. Hence we have this class.
We expect the user to set a few properties and then use that same setting to make a bunch of invocations. So we'd like to take some hit when the user actually sets a property to do some computation, then use that computed value during a method invocation again and again.
For this goal, we use PropertySet
and implement some properties
as virtual properties backed by methods. This allows us to do the computation
in the setter, and store it in a field.
These fields are used by Stub.process(com.sun.xml.ws.api.message.Packet, com.sun.xml.ws.client.RequestContext, com.sun.xml.ws.client.ResponseContextReceiver)
to populate a Packet
.
We make an assumption that a request context is mostly used to just get and put values, not really for things like enumerating or size.
So we start by maintaining state as a combination of others
bag and strongly-typed fields. As long as the application uses
just Map.put(K, V)
, Map.get(java.lang.Object)
, and Map.putAll(java.util.Map extends K, ? extends V>)
, we can
do things in this way. In this mode a Map
we return works as
a view into RequestContext
, and by itself it maintains no state.
If RequestContext
is in this mode, its state can be copied
efficiently into Packet
.
Once the application uses any other Map
method, we move to
the "fallback" mode, where the data is actually stored in a HashMap
,
this is necessary for implementing the map interface contract correctly.
To be safe, once we fallback, we'll never come back to the efficient state.
Once we are in the fallback mode, none of the strongly typed field will
be used, and they may contain stale values. So the only method
the code outside this class can safely use is copy()
,
fill(Packet)
, and constructors. Do not access the strongly
typed fields nor others
directly.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.sun.xml.ws.api.PropertySet |
---|
PropertySet.Accessor, PropertySet.Property, PropertySet.PropertyMap |
Field Summary | |
---|---|
ContentNegotiation |
contentNegotiation
The value of ContentNegotiation.PROPERTY
property. |
Constructor Summary | |
---|---|
RequestContext()
Creates an empty RequestContext . |
Method Summary | |
---|---|
RequestContext |
copy()
|
void |
fill(Packet packet)
Fill a Packet with values of this RequestContext . |
Object |
get(Object key)
The efficient get method that reads from RequestContext . |
String |
getContentNegotiationString()
|
EndpointAddress |
getEndpointAddress()
|
String |
getEndPointAddressString()
Deprecated. always access endpointAddress . |
Map<String,Object> |
getMapView()
Gets the Map view of this request context. |
protected PropertySet.PropertyMap |
getPropertyMap()
Map representing the Fields and Methods annotated with PropertySet.Property . |
String |
getSoapAction()
|
Object |
put(String key,
Object value)
The efficient put method that updates RequestContext . |
void |
setContentNegotiationString(String s)
|
void |
setEndpointAddress(EndpointAddress epa)
|
void |
setEndPointAddressString(String s)
|
void |
setSoapAction(String sAction)
|
Methods inherited from class com.sun.xml.ws.api.PropertySet |
---|
containsKey, createMapView, parse, remove, supports |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public ContentNegotiation contentNegotiation
ContentNegotiation.PROPERTY
property.
Constructor Detail |
---|
RequestContext()
RequestContext
.
Method Detail |
---|
public String getEndPointAddressString()
endpointAddress
.
BindingProvider.ENDPOINT_ADDRESS_PROPERTY
view
on top of endpointAddress
.
public void setEndPointAddressString(String s)
public void setEndpointAddress(@NotNull EndpointAddress epa)
@NotNull public EndpointAddress getEndpointAddress()
public String getContentNegotiationString()
public void setContentNegotiationString(String s)
public String getSoapAction()
public void setSoapAction(String sAction)
public Object get(Object key)
RequestContext
.
get
in class PropertySet
key
- This field is typed as Object
to follow the Map.get(Object)
convention, but if anything but String
is passed, this method
just returns null.public Object put(String key, Object value)
RequestContext
.
put
in class PropertySet
PropertySet.Property
public Map<String,Object> getMapView()
Map
view of this request context.
public void fill(Packet packet)
Packet
with values of this RequestContext
.
public RequestContext copy()
protected PropertySet.PropertyMap getPropertyMap()
PropertySet
PropertySet.Property
.
Model of PropertySet
class.
At the end of the derivation chain this method just needs to be implemented as:
private static final PropertyMap model; static { model = parse(MyDerivedClass.class); } protected PropertyMap getPropertyMap() { return model; }
getPropertyMap
in class PropertySet
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |