com.sun.xml.ws.client
Class RequestContext

java.lang.Object
  extended by org.jvnet.ws.message.BasePropertySet
      extended by org.jvnet.ws.message.BaseDistributedPropertySet
          extended by com.sun.xml.ws.client.RequestContext
All Implemented Interfaces:
org.jvnet.ws.message.DistributedPropertySet, org.jvnet.ws.message.PropertySet

public final class RequestContext
extends org.jvnet.ws.message.BaseDistributedPropertySet

Request context implementation.

Why a custom map?

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.

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 MapView implementation allows client to use Map interface 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 aswell; those would be processed using iterating the MapView and their processing, of course, would be slower.

The previous implementation with fallback mode has been removed to simplify the code and remove the bugs.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jvnet.ws.message.BasePropertySet
org.jvnet.ws.message.BasePropertySet.Accessor, org.jvnet.ws.message.BasePropertySet.PropertyMap
 
Nested classes/interfaces inherited from interface org.jvnet.ws.message.PropertySet
org.jvnet.ws.message.PropertySet.Property
 
Field Summary
 ContentNegotiation contentNegotiation
          The value of ContentNegotiation.PROPERTY property.
 
Constructor Summary
RequestContext()
          Creates an empty RequestContext.
 
Method Summary
 void addSatellite(PropertySet satellite)
          Deprecated.  
 RequestContext copy()
           
 void fill(Packet packet, boolean isAddressingEnabled)
          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.
protected  org.jvnet.ws.message.BasePropertySet.PropertyMap getPropertyMap()
          Map representing the Fields and Methods annotated with Property.
 String getSoapAction()
           
 Boolean getSoapActionUse()
           
protected  boolean mapAllowsAdditionalProperties()
          Used when constructing the BasePropertySet.MapView for this object - it controls if the BasePropertySet.MapView servers only to access strongly typed values or allows also different values
 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)
           
 void setSoapActionUse(Boolean sActionUse)
           
 
Methods inherited from class org.jvnet.ws.message.BaseDistributedPropertySet
addSatellite, addSatellite, asMapLocal, copySatelliteInto, copySatelliteInto, createEntrySet, createView, getSatellite, remove, removeSatellite, supports, supportsLocal
 
Methods inherited from class org.jvnet.ws.message.BasePropertySet
asMap, containsKey, createMapView, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jvnet.ws.message.PropertySet
asMap, containsKey, createMapView
 

Field Detail

contentNegotiation

public ContentNegotiation contentNegotiation
The value of ContentNegotiation.PROPERTY property.

Constructor Detail

RequestContext

RequestContext()
Creates an empty RequestContext.

Method Detail

addSatellite

public void addSatellite(@NotNull
                         PropertySet satellite)
Deprecated. 


getEndPointAddressString

public String getEndPointAddressString()
Deprecated. always access endpointAddress.

Creates BindingProvider.ENDPOINT_ADDRESS_PROPERTY view on top of endpointAddress.


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 from RequestContext.

Specified by:
get in interface org.jvnet.ws.message.PropertySet
Overrides:
get in class org.jvnet.ws.message.BaseDistributedPropertySet
Parameters:
key - This field is typed as Object to follow the HashMap.get(Object) convention, but if anything but String is passed, this method just returns null.

put

public Object put(String key,
                  Object value)
The efficient put method that updates RequestContext.

Specified by:
put in interface org.jvnet.ws.message.PropertySet
Overrides:
put in class org.jvnet.ws.message.BaseDistributedPropertySet
See Also:
Property

fill

public void fill(Packet packet,
                 boolean isAddressingEnabled)
Fill a Packet with values of this RequestContext.

Parameters:
packet - to be filled with context values
isAddressingEnabled - flag if addressing enabled (to provide warning if necessary)

copy

public RequestContext copy()

getPropertyMap

protected org.jvnet.ws.message.BasePropertySet.PropertyMap getPropertyMap()
Description copied from class: org.jvnet.ws.message.BasePropertySet
Map representing the Fields and Methods annotated with 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;
 }
 

Specified by:
getPropertyMap in class org.jvnet.ws.message.BasePropertySet

mapAllowsAdditionalProperties

protected boolean mapAllowsAdditionalProperties()
Description copied from class: org.jvnet.ws.message.BasePropertySet
Used when constructing the BasePropertySet.MapView for this object - it controls if the BasePropertySet.MapView servers only to access strongly typed values or allows also different values

Overrides:
mapAllowsAdditionalProperties in class org.jvnet.ws.message.BasePropertySet
Returns:
true if BasePropertySet.PropertyMap should allow also properties not defined as strongly typed fields


Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.