Class RequestContext
- java.lang.Object
-
- com.oracle.webservices.api.message.BasePropertySet
-
- com.oracle.webservices.api.message.BaseDistributedPropertySet
-
- com.sun.xml.ws.client.RequestContext
-
- All Implemented Interfaces:
DistributedPropertySet,PropertySet
public final class RequestContext extends BaseDistributedPropertySet
Request context implementation.Why a custom map?
The JAX-WS spec exposes properties as a
Map, but if we just use an ordinaryHashMapfor 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
PropertySetand 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 aPacket.How it works?
For better performance, we wan't use strongly typed field as much as possible to avoid reflection and unnecessary collection iterations; Using
BasePropertySet.MapViewimplementation allows client to useMapinterface in a way that all the strongly typed properties are reflected to the fields right away. Any additional (extending) properties can be added by client as well; those would be processed using iterating theBasePropertySet.MapViewand their processing, of course, would be slower.The previous implementation with fallback mode has been removed to simplify the code and remove the bugs.
- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.oracle.webservices.api.message.BasePropertySet
BasePropertySet.Accessor, BasePropertySet.PropertyMap, BasePropertySet.PropertyMapEntry
-
Nested classes/interfaces inherited from interface com.oracle.webservices.api.message.PropertySet
PropertySet.Property
-
-
Field Summary
Fields Modifier and Type Field Description ContentNegotiationcontentNegotiationThe value ofContentNegotiation.PROPERTYproperty.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddSatellite(PropertySet satellite)Deprecated.RequestContextcopy()voidfill(Packet packet, boolean isAddressingEnabled)Fill aPacketwith values of thisRequestContext.Objectget(Object key)The efficient get method that reads fromRequestContext.StringgetContentNegotiationString()EndpointAddressgetEndpointAddress()StringgetEndPointAddressString()Deprecated.always accessendpointAddress.protected BasePropertySet.PropertyMapgetPropertyMap()Map representing the Fields and Methods annotated withPropertySet.Property.StringgetSoapAction()BooleangetSoapActionUse()protected booleanmapAllowsAdditionalProperties()Used when constructing theBasePropertySet.MapViewfor this object - it controls if theBasePropertySet.MapViewservers only to access strongly typed values or allows also different valuesObjectput(String key, Object value)The efficient put method that updatesRequestContext.voidsetContentNegotiationString(String s)voidsetEndpointAddress(EndpointAddress epa)voidsetEndPointAddressString(String s)voidsetSoapAction(String sAction)voidsetSoapActionUse(Boolean sActionUse)-
Methods inherited from class com.oracle.webservices.api.message.BaseDistributedPropertySet
addSatellite, addSatellite, asMapLocal, containsKey, copySatelliteInto, copySatelliteInto, createEntrySet, createView, getSatellite, getSatellites, remove, removeSatellite, supports, supportsLocal
-
Methods inherited from class com.oracle.webservices.api.message.BasePropertySet
asMap, createMapView, parse, parse
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.oracle.webservices.api.message.PropertySet
asMap, createMapView
-
-
-
-
Field Detail
-
contentNegotiation
public ContentNegotiation contentNegotiation
The value ofContentNegotiation.PROPERTYproperty.
-
-
Method Detail
-
addSatellite
public void addSatellite(@NotNull PropertySet satellite)Deprecated.
-
getEndPointAddressString
public String getEndPointAddressString()
Deprecated.always accessendpointAddress.CreatesBindingProvider.ENDPOINT_ADDRESS_PROPERTYview on top ofendpointAddress.
-
setEndPointAddressString
public void setEndPointAddressString(String s)
-
setEndpointAddress
public void setEndpointAddress(@NotNull EndpointAddress epa)
-
getEndpointAddress
@NotNull public EndpointAddress getEndpointAddress()
-
getContentNegotiationString
public String getContentNegotiationString()
-
setContentNegotiationString
public void setContentNegotiationString(String s)
-
getSoapAction
public String getSoapAction()
-
setSoapAction
public void setSoapAction(String sAction)
-
getSoapActionUse
public Boolean getSoapActionUse()
-
setSoapActionUse
public void setSoapActionUse(Boolean sActionUse)
-
get
public Object get(Object key)
The efficient get method that reads fromRequestContext.- Specified by:
getin interfacePropertySet- Overrides:
getin classBaseDistributedPropertySet- Parameters:
key- This field is typed asObjectto follow theMap.get(Object)convention, but if anything butStringis passed, this method just returns null.
-
put
public Object put(String key, Object value)
The efficient put method that updatesRequestContext.- Specified by:
putin interfacePropertySet- Overrides:
putin classBaseDistributedPropertySet- See Also:
PropertySet.Property
-
fill
public void fill(Packet packet, boolean isAddressingEnabled)
Fill aPacketwith values of thisRequestContext.- Parameters:
packet- to be filled with context valuesisAddressingEnabled- flag if addressing enabled (to provide warning if necessary)
-
copy
public RequestContext copy()
-
getPropertyMap
protected BasePropertySet.PropertyMap getPropertyMap()
Description copied from class:BasePropertySetMap representing the Fields and Methods annotated withPropertySet.Property. Model ofPropertySetclass.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; }or if the implementation is in different Java module.private static final PropertyMap model; static { model = parse(MyDerivedClass.class, MethodHandles.lookup()); } protected PropertyMap getPropertyMap() { return model; }- Specified by:
getPropertyMapin classBasePropertySet- Returns:
- the map of strongly-typed known properties keyed by property names
-
mapAllowsAdditionalProperties
protected boolean mapAllowsAdditionalProperties()
Description copied from class:BasePropertySetUsed when constructing theBasePropertySet.MapViewfor this object - it controls if theBasePropertySet.MapViewservers only to access strongly typed values or allows also different values- Overrides:
mapAllowsAdditionalPropertiesin classBasePropertySet- Returns:
- true if
Mapshould allow also properties not defined as strongly typed fields
-
-