Fields Summary |
---|
protected static Log | logThe Log used for logging all messages. |
private Message | requestMessageThe request message. If we're on the client, this is the outgoing
message heading to the server. If we're on the server, this is the
incoming message we've received from the client. |
private Message | responseMessageThe response message. If we're on the server, this is the outgoing
message heading back to the client. If we're on the client, this is the
incoming message we've received from the server. |
private String | targetServiceThat unique key/name that the next router/dispatch handler should use
to determine what to do next. |
private String | transportNameThe name of the Transport which this message was received on (or is
headed to, for the client). |
private ClassLoader | classLoaderThe default ClassLoader that this service should use. |
private AxisEngine | axisEngineThe AxisEngine which this context is involved with. |
private org.apache.axis.session.Session | sessionA Session associated with this request. |
private boolean | maintainSessionShould we track session state, or not?
default is not.
Could potentially refactor this so that
maintainSession iff session != null... |
private boolean | havePassedPivotAre we doing request stuff, or response stuff? True if processing
response (I think). |
private int | timeoutMaximum amount of time to wait on a request, in milliseconds. |
private boolean | highFidelityAn indication of whether we require "high fidelity" recording of
deserialized messages for this interaction. Defaults to true for
now, and can be set to false, usually at service-dispatch time. |
private org.apache.axis.utils.LockableHashtable | bagStorage for an arbitrary bag of properties associated with this
MessageContext. |
private String | username |
private String | password |
private String | encodingStyle |
private boolean | useSOAPAction |
private String | SOAPActionURI |
private String[] | rolesSOAP Actor roles. |
private org.apache.axis.soap.SOAPConstants | soapConstantsOur SOAP namespaces and such. |
private org.apache.axis.schema.SchemaVersion | schemaVersionSchema version information - defaults to 2001. |
private org.apache.axis.description.OperationDesc | currentOperationOur current operation. |
protected static String | systemTempDirTemporary directory to store attachments. |
private org.apache.axis.encoding.TypeMappingRegistry | mappingRegistryMappings of QNames to serializers/deserializers (and therfore
to Java types). |
private org.apache.axis.handlers.soap.SOAPService | serviceHandlerServiceHandler is the handler that is the "service". This handler
can (and probably will actually be a chain that contains the
service specific request/response/pivot point handlers |
public static final String | ENGINE_HANDLERContains an instance of Handler, which is the
ServiceContext and the entrypoint of this service.
(if it has been so configured - will our deployment
tool do this by default? - todo by Jacek) |
public static final String | TRANS_URLThis String is the URL that the message came to. |
public static final String | QUIT_REQUESTEDHas a quit been requested? Hackish... but useful... -- RobJ |
public static final String | AUTHUSERPlace to store an AuthenticatedUser. |
public static final String | CALLIf on the client - this is the Call object. |
public static final String | IS_MSGAre we doing Msg vs RPC? - For Java Binding. |
public static final String | ATTACHMENTS_DIRThe directory where in coming attachments are created. |
public static final String | ACCEPTMISSINGPARAMSA boolean param, to control whether we accept missing parameters
as nulls or refuse to acknowledge them. |
public static final String | WSDLGEN_INTFNAMESPACEThe value of the property is used by service WSDL generation (aka ?WSDL)
For the service's interface namespace if not set TRANS_URL property is used. |
public static final String | WSDLGEN_SERV_LOC_URLThe value of the property is used by service WSDL generation (aka ?WSDL).
For the service's location if not set TRANS_URL property is used.
(helps provide support through proxies. |
public static final String | HTTP_TRANSPORT_VERSIONThe value of the property is used by service WSDL generation (aka ?WSDL).
Set this property to request a certain level of HTTP.
The values MUST use org.apache.axis.transport.http.HTTPConstants.HEADER_PROTOCOL_10
for HTTP 1.0
The values MUST use org.apache.axis.transport.http.HTTPConstants.HEADER_PROTOCOL_11
for HTTP 1.1 |
public static final String | SECURITY_PROVIDERThe security provider. |
Methods Summary |
---|
public boolean | containsProperty(java.lang.String name)Returns true if the MessageContext contains a property with the specified name.
Object propertyValue = getProperty(name);
return (propertyValue != null);
|
public synchronized void | dispose()if a message (or subclass) has any disposal needs, this method
is where it goes. Subclasses *must* call super.dispose(), and
be prepared to be called from the finalizer as well as earlier
log.debug("disposing of message context");
if(requestMessage!=null) {
requestMessage.dispose();
requestMessage=null;
}
if(responseMessage!=null) {
responseMessage.dispose();
responseMessage=null;
}
|
protected void | finalize()during finalization, the dispose() method is called.
dispose();
|
public java.util.Iterator | getAllPropertyNames()Returns an Iterator view of the names of the properties
in this MessageContext and any parents of the LockableHashtable
return bag.getAllKeys().iterator();
|
public AxisEngine | getAxisEngine()Get the axis engine. This will be null if the message was
created outside an engine
return axisEngine;
|
public java.lang.ClassLoader | getClassLoader()Get the classloader, implicitly binding to the thread context
classloader if an override has not been supplied.
if ( classLoader == null ) {
classLoader = Thread.currentThread().getContextClassLoader();
}
return( classLoader );
|
public static org.apache.axis.MessageContext | getCurrentContext()Get the active message context.
return AxisEngine.getCurrentMessageContext();
|
public Message | getCurrentMessage()Return the current (i.e. request before the pivot, response after)
message.
return (havePassedPivot ? responseMessage : requestMessage);
|
public java.lang.String | getEncodingStyle()Returns the encoding style as a URI that should be used for the SOAP
message.
return encodingStyle;
|
public boolean | getMaintainSession()Discover if we are maintaining session state.
return maintainSession;
|
public javax.xml.soap.SOAPMessage | getMessage()Gets the SOAPMessage from this message context.
return getCurrentMessage();
|
public org.apache.axis.description.OperationDesc | getOperation()The current operation.
return currentOperation;
|
public org.apache.axis.description.OperationDesc | getOperationByQName(javax.xml.namespace.QName qname)get the first possible operation that could match a
body containing an element of the given QName. Sets the currentOperation
field in the process; if that field is already set then its value
is returned instead
if (currentOperation == null) {
OperationDesc [] possibleOperations = getPossibleOperationsByQName(qname);
if (possibleOperations != null && possibleOperations.length > 0) {
currentOperation = possibleOperations[0];
}
}
return currentOperation;
|
public org.apache.axis.constants.Style | getOperationStyle()Get the operation style. This is either the style of the current
operation or if that is not set, the style of the service handler, or
if that is not set, Style.RPC .
if (currentOperation != null) {
return currentOperation.getStyle();
}
if (serviceHandler != null) {
return serviceHandler.getStyle();
}
return Style.RPC;
|
public org.apache.axis.constants.Use | getOperationUse()Get the operation use.
if (currentOperation != null) {
return currentOperation.getUse();
}
if (serviceHandler != null) {
return serviceHandler.getUse();
}
return Use.ENCODED;
|
public java.lang.String | getPassword()Get the password.
return password;
|
public boolean | getPastPivot()Determine when we've passed the pivot.
return havePassedPivot;
|
public org.apache.axis.description.OperationDesc[] | getPossibleOperationsByQName(javax.xml.namespace.QName qname)Returns a list of operation descriptors that could may
possibly match a body containing an element of the given QName.
For non-DOCUMENT, the list of operation descriptors that match
the name is returned. For DOCUMENT, all the operations that have
qname as a parameter are returned
if (currentOperation != null) {
return new OperationDesc [] { currentOperation };
}
OperationDesc [] possibleOperations = null;
if (serviceHandler == null) {
try {
if (log.isDebugEnabled()) {
log.debug(Messages.getMessage("dispatching00",
qname.getNamespaceURI()));
}
// Try looking this QName up in our mapping table...
setService(axisEngine.getConfig().
getServiceByNamespaceURI(qname.getNamespaceURI()));
} catch (ConfigurationException e) {
// Didn't find one...
}
}
if (serviceHandler != null) {
ServiceDesc desc = serviceHandler.getInitializedServiceDesc(this);
if (desc != null) {
if (desc.getStyle() != Style.DOCUMENT) {
possibleOperations = desc.getOperationsByQName(qname);
} else {
// DOCUMENT Style
// Get all of the operations that have qname as
// a possible parameter QName
ArrayList allOperations = desc.getOperations();
ArrayList foundOperations = new ArrayList();
for (int i=0; i < allOperations.size(); i++ ) {
OperationDesc tryOp =
(OperationDesc) allOperations.get(i);
if (tryOp.getParamByQName(qname) != null) {
foundOperations.add(tryOp);
}
}
if (foundOperations.size() > 0) {
possibleOperations = (OperationDesc[])
JavaUtils.convert(foundOperations,
OperationDesc[].class);
}
}
}
}
return possibleOperations;
|
public java.lang.Object | getProperty(java.lang.String name)Returns the value associated with the named property - or null if not
defined/set.
if (name != null) {
if (name.equals(Call.USERNAME_PROPERTY)) {
return getUsername();
}
else if (name.equals(Call.PASSWORD_PROPERTY)) {
return getPassword();
}
else if (name.equals(Call.SESSION_MAINTAIN_PROPERTY)) {
return getMaintainSession() ? Boolean.TRUE : Boolean.FALSE;
}
else if (name.equals(Call.OPERATION_STYLE_PROPERTY)) {
return (getOperationStyle() == null) ? null : getOperationStyle().getName();
}
else if (name.equals(Call.SOAPACTION_USE_PROPERTY)) {
return useSOAPAction() ? Boolean.TRUE : Boolean.FALSE;
}
else if (name.equals(Call.SOAPACTION_URI_PROPERTY)) {
return getSOAPActionURI();
}
else if (name.equals(Call.ENCODINGSTYLE_URI_PROPERTY)) {
return getEncodingStyle();
}
else if (bag == null) {
return null;
}
else {
return bag.get(name);
}
}
else {
return null;
}
|
public java.util.Iterator | getPropertyNames()Returns an Iterator view of the names of the properties in
this MessageContext .
// fixme: this is potentially unsafe for the caller - changing the
// properties will kill the iterator. Consider iterating over a copy:
// return new HashSet(bag.keySet()).iterator();
return bag.keySet().iterator();
|
public Message | getRequestMessage()Get the request message.
return requestMessage ;
|
public Message | getResponseMessage()Get the response message. return responseMessage ;
|
public java.lang.String[] | getRoles()Gets the SOAP actor roles associated with an execution of the
HandlerChain and its contained Handler
instances.
Not (yet) implemented method in the SOAPMessageContext interface.
Note: SOAP actor roles apply to the SOAP node and are managed
using HandlerChain.setRoles() and
HandlerChain.getRoles() . Handler instances in the
HandlerChain use this information about the SOAP actor roles
to process the SOAP header blocks. Note that the SOAP actor roles are
invariant during the processing of SOAP message through the
HandlerChain .
//TODO: Flesh this out.
return roles;
|
public java.lang.String | getSOAPActionURI()Get the soapAction URI.
return SOAPActionURI;
|
public org.apache.axis.soap.SOAPConstants | getSOAPConstants()Get the SOAPConstants used by this message context.
return soapConstants;
|
public org.apache.axis.schema.SchemaVersion | getSchemaVersion()Get the XML schema version information.
return schemaVersion;
|
public org.apache.axis.handlers.soap.SOAPService | getService()Get the SOAPService used to handle services in this
context.
return serviceHandler;
|
public org.apache.axis.session.Session | getSession()Get the current session.
return session;
|
public java.lang.String | getStrProp(java.lang.String propName)Get a String property by name.
/*
* IMPORTANT.
* If adding any new constants to this class. Make them final. The
* ones above are left non-final for compatibility reasons.
*/
return (String) getProperty(propName);
|
public java.lang.String | getTargetService()Get the name of the targed service for this message.
return targetService;
|
public int | getTimeout()Get timeout from our MessageContext.
return timeout;
|
public java.lang.String | getTransportName()The name of the transport for this context.
return transportName;
|
public org.apache.axis.encoding.TypeMapping | getTypeMapping()Return the type mapping currently in scope for our encoding style.
return (TypeMapping)getTypeMappingRegistry().
getTypeMapping(encodingStyle);
|
public org.apache.axis.encoding.TypeMappingRegistry | getTypeMappingRegistry()Get the currently in-scope type mapping registry.
By default, will return a reference to the AxisEngine's TMR until
someone sets our local one (usually as a result of setting the
serviceHandler).
if (mappingRegistry == null) {
return axisEngine.getTypeMappingRegistry();
}
return mappingRegistry;
|
public java.lang.String | getUsername()Get the user name.
return username;
|
public boolean | isClient()Let us know whether this is the client or the server.
return (axisEngine instanceof AxisClient);
|
public boolean | isEncoded()Indicates if the opration is encoded.
return (getOperationUse() == Use.ENCODED);
//return soapConstants.getEncodingURI().equals(encodingStyle);
|
public boolean | isHighFidelity()Read the high fidelity property.
Some behavior may be apropreate for high fidelity contexts that is not
relevant for low fidelity ones or vica-versa.
return highFidelity;
|
public boolean | isPropertyTrue(java.lang.String propName)Tests to see if the named property is set in the 'bag', returning
false if it is not present at all.
This is equivalent to isPropertyTrue(propName, false) .
return isPropertyTrue(propName, false);
|
public boolean | isPropertyTrue(java.lang.String propName, boolean defaultVal)Test if a property is set to something we consider to be true in the
'bag'.
- If not there then
defaultVal is returned.
- If there, then...
- if its a
Boolean , we'll return booleanValue()
- if its an
Integer , we'll return false
if its 0 else true
- if its a
String we'll return false if its
"false" " or "0" else true
- All other types return
true
return JavaUtils.isTrue(getProperty(propName), defaultVal);
|
public void | removeProperty(java.lang.String propName)
if (bag != null) {
bag.remove(propName);
}
|
public void | reset()Return this context to a clean state.
if (bag != null) {
bag.clear();
}
serviceHandler = null;
havePassedPivot = false;
currentOperation = null;
|
public void | setClassLoader(java.lang.ClassLoader cl)Set a new classloader. Setting to null will result in getClassLoader()
binding back to the thread context class loader.
classLoader = cl ;
|
public void | setCurrentMessage(Message curMsg)Set the current message. This will set the request before the pivot,
and the response afterwards, as guaged by the passedPivod property.
if ( curMsg != null )
curMsg.setMessageContext(this);
if (havePassedPivot) {
responseMessage = curMsg;
} else {
requestMessage = curMsg;
}
|
public void | setEncodingStyle(java.lang.String namespaceURI)Sets the encoding style to the URI passed in.
if (namespaceURI == null) {
namespaceURI = Constants.URI_LITERAL_ENC;
}
else if (Constants.isSOAP_ENC(namespaceURI)) {
namespaceURI = soapConstants.getEncodingURI();
}
encodingStyle = namespaceURI;
|
public void | setHighFidelity(boolean highFidelity)Set the high fidelity propert.
Users of the context may be changing what they do based upon this flag.
this.highFidelity = highFidelity;
|
public void | setMaintainSession(boolean yesno)Set whether we are maintaining session state.
maintainSession = yesno;
|
public void | setMessage(javax.xml.soap.SOAPMessage message)Sets the SOAPMessage for this message context.
This is equivalent to casting message to
Message and then passing it on to
setCurrentMessage() .
setCurrentMessage((Message)message);
|
public void | setOperation(org.apache.axis.description.OperationDesc operation)Set the current operation.
currentOperation = operation;
|
public void | setPassword(java.lang.String password)Set the password.
this.password = password;
|
public void | setPastPivot(boolean pastPivot)Indicate when we've passed the pivot.
havePassedPivot = pastPivot;
|
public void | setProperty(java.lang.String name, java.lang.Object value)Allows you to set a named property to the passed in value.
There are a few known properties (like username, password, etc)
that are variables in Call. The rest of the properties are
stored in a Hashtable. These common properties should be
accessed via the accessors for speed/type safety, but they may
still be obtained via this method. It's up to one of the
Handlers (or the Axis engine itself) to go looking for
one of them.
if (name == null || value == null) {
return;
// Is this right? Shouldn't we throw an exception like:
// throw new IllegalArgumentException(msg);
}
else if (name.equals(Call.USERNAME_PROPERTY)) {
if (!(value instanceof String)) {
throw new IllegalArgumentException(
Messages.getMessage("badProp00", new String[] {
name, "java.lang.String", value.getClass().getName()}));
}
setUsername((String) value);
}
else if (name.equals(Call.PASSWORD_PROPERTY)) {
if (!(value instanceof String)) {
throw new IllegalArgumentException(
Messages.getMessage("badProp00", new String[] {
name, "java.lang.String", value.getClass().getName()}));
}
setPassword((String) value);
}
else if (name.equals(Call.SESSION_MAINTAIN_PROPERTY)) {
if (!(value instanceof Boolean)) {
throw new IllegalArgumentException(
Messages.getMessage("badProp00", new String[]
{name,
"java.lang.Boolean",
value.getClass().getName()}));
}
setMaintainSession(((Boolean) value).booleanValue());
}
else if (name.equals(Call.SOAPACTION_USE_PROPERTY)) {
if (!(value instanceof Boolean)) {
throw new IllegalArgumentException(
Messages.getMessage("badProp00", new String[]
{name,
"java.lang.Boolean",
value.getClass().getName()}));
}
setUseSOAPAction(((Boolean) value).booleanValue());
}
else if (name.equals(Call.SOAPACTION_URI_PROPERTY)) {
if (!(value instanceof String)) {
throw new IllegalArgumentException(
Messages.getMessage("badProp00", new String[]
{name,
"java.lang.String",
value.getClass().getName()}));
}
setSOAPActionURI((String) value);
}
else if (name.equals(Call.ENCODINGSTYLE_URI_PROPERTY)) {
if (!(value instanceof String)) {
throw new IllegalArgumentException(
Messages.getMessage("badProp00", new String[]
{name,
"java.lang.String",
value.getClass().getName()}));
}
setEncodingStyle((String) value);
}
else {
bag.put(name, value);
}
|
public void | setPropertyParent(java.util.Hashtable parent)Set the Hashtable that contains the default values for our
properties.
bag.setParent(parent);
|
public void | setRequestMessage(Message reqMsg)Set the request message, and make sure that message is associated
with this MessageContext.
requestMessage = reqMsg ;
if (requestMessage != null) {
requestMessage.setMessageContext(this);
}
|
public void | setResponseMessage(Message respMsg)Set the response message, and make sure that message is associated
with this MessageContext.
responseMessage = respMsg;
if (responseMessage != null) {
responseMessage.setMessageContext(this);
//if we have received attachments of a particular type
// than that should be the default type to send.
Message reqMsg = getRequestMessage();
if (null != reqMsg) {
Attachments reqAttch = reqMsg.getAttachmentsImpl();
Attachments respAttch = respMsg.getAttachmentsImpl();
if (null != reqAttch && null != respAttch) {
if (respAttch.getSendType() == Attachments.SEND_TYPE_NOTSET)
//only if not explicity set.
respAttch.setSendType(reqAttch.getSendType());
}
}
}
|
public void | setRoles(java.lang.String[] roles)Set the SOAP actor roles associated with an executioni of
CodeHandlerChain and its contained Handler
instances.
this.roles = roles;
|
public void | setSOAPActionURI(java.lang.String SOAPActionURI)Set the soapAction URI.
this.SOAPActionURI = SOAPActionURI;
|
public void | setSOAPConstants(org.apache.axis.soap.SOAPConstants soapConstants)Set the SOAPConstants used by this message context.
This may also affect the encoding style.
// when changing SOAP versions, remember to keep the encodingURI
// in synch.
if (this.soapConstants.getEncodingURI().equals(encodingStyle)) {
encodingStyle = soapConstants.getEncodingURI();
}
this.soapConstants = soapConstants;
|
public void | setSchemaVersion(org.apache.axis.schema.SchemaVersion schemaVersion)Set the XML schema version this message context will use.
this.schemaVersion = schemaVersion;
|
public void | setService(org.apache.axis.handlers.soap.SOAPService sh)Set the SOAPService used to handle services in this
context. This method configures a wide range of
MessageContext properties to suit the handler.
log.debug("MessageContext: setServiceHandler("+sh+")");
serviceHandler = sh;
if (sh != null) {
if(!sh.isRunning()) {
throw new AxisFault(Messages.getMessage("disabled00"));
}
targetService = sh.getName();
SOAPService service = sh;
TypeMappingRegistry tmr = service.getTypeMappingRegistry();
setTypeMappingRegistry(tmr);
// styles are not "soap version aware" so compensate...
setEncodingStyle(service.getUse().getEncoding());
// This MessageContext should now defer properties it can't find
// to the Service's options.
bag.setParent(sh.getOptions());
// Note that we need (or don't need) high-fidelity SAX recording
// of deserialized messages according to the setting on the
// new service.
highFidelity = service.needsHighFidelityRecording();
service.getInitializedServiceDesc(this);
}
|
public void | setSession(org.apache.axis.session.Session session)Set the current session.
this.session = session;
|
public void | setTargetService(java.lang.String tServ)Set the target service for this message.
This looks up the named service in the registry, and has
the side effect of setting our TypeMappingRegistry to the
service's.
log.debug("MessageContext: setTargetService(" + tServ+")");
if (tServ == null) {
setService(null);
}
else {
try {
setService(getAxisEngine().getService(tServ));
} catch (AxisFault fault) {
// If we're on the client, don't throw this fault...
if (!isClient()) {
throw fault;
}
}
}
targetService = tServ;
|
public void | setTimeout(int value)Set timeout in our MessageContext.
timeout = value;
|
public void | setTransportName(java.lang.String transportName)Set the transport name for this context.
this.transportName = transportName;
|
public void | setTypeMappingRegistry(org.apache.axis.encoding.TypeMappingRegistry reg)Replace the engine's type mapping registry with a local one. This will
have no effect on any type mappings obtained before this call.
mappingRegistry = reg;
|
public void | setUseSOAPAction(boolean useSOAPAction)Enable or dissable the use of soap action information. When enabled,
the message context will attempt to use the soap action URI
information during binding of soap messages to service methods. When
dissabled, it will make no such attempt.
this.useSOAPAction = useSOAPAction;
|
public void | setUsername(java.lang.String username)Set the username.
this.username = username;
|
public boolean | useSOAPAction()Indicates wether the soap action URI is being used or not.
return useSOAPAction;
|