站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 3.2.7 jaxrpc API Documentation 英文版文档

MessageContext (JAXRPC API) - JBoss 3.2.7 jaxrpc API Documentation 英文版文档


org.apache.axis
Class MessageContext

java.lang.Object
  extended byorg.apache.axis.MessageContext
All Implemented Interfaces:
javax.xml.rpc.handler.MessageContext, javax.xml.rpc.handler.soap.SOAPMessageContext

public class MessageContext
extends Object
implements javax.xml.rpc.handler.soap.SOAPMessageContext

A MessageContext is the Axis implementation of the javax SOAPMessageContext class, and is core to message processing in handlers and other parts of the system.

This class also contains constants for accessing some well-known properties. Using a hierarchical namespace is strongly suggested in order to lower the chance for conflicts.

(These constants should be viewed as an explicit list of well known and widely used context keys, there's nothing wrong with directly using the key strings. This is the reason for the hierarchical constant namespace.

Actually I think we might just list the keys in the docs and provide no such constants since they create yet another namespace, but we'd have no compile-time checks then.

Whaddya think? - todo by Jacek)

Author:
Doug Davis (dug@us.ibm.com), Jacek Kopecky (jacek@idoox.com)

Field Summary
static String ACCEPTMISSINGPARAMS
          A boolean param, to control whether we accept missing parameters as nulls or refuse to acknowledge them.
static String ATTACHMENTS_DIR
          The directory where in coming attachments are created.
static String AUTHUSER
          Place to store an AuthenticatedUser
static String CALL
          If on the client - this is the Call object
static String ENGINE_HANDLER
          Contains an instance of Handler, which is the ServiceContext and the entrypoint of this service.
static String HTTP_TRANSPORT_VERSION
          The value of the property is used by service WSDL generation (aka ?WSDL) Set this property to request a certain level of HTTP.
static String IS_MSG
          Are we doing Msg vs RPC? - For Java Binding
static String QUIT_REQUESTED
          Has a quit been requested? Hackish...
static String SECURITY_PROVIDER
           
protected static String systemTempDir
          temporary directory to store attachments
static String TRANS_URL
          This String is the URL that the message came to
static String WSDLGEN_INTFNAMESPACE
          The 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.
static String WSDLGEN_RESOURCE
          The value of the property is used by service WSDL generation (aka ?WSDL) If the wsdl documnet contains imports, this property is the relative path to the imported artifact.
static String WSDLGEN_SERV_LOC_URL
          The 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.
 
Constructor Summary
MessageContext(AxisEngine engine)
          Create a message context.
 
Method Summary
 boolean containsProperty(String name)
          Returns true if the MessageContext contains a property with the specified name.
 AxisEngine getAxisEngine()
          get the axis engine.
 ClassLoader getClassLoader()
          get the classloader, implicitly binding to the thread context classloader if an override has not been supplied
static MessageContext getCurrentContext()
          Get the active message context.
 Message getCurrentMessage()
          Return the current (i.e.
 String getEncodingStyle()
          Returns the encoding style as a URI that should be used for the SOAP message.
 boolean getMaintainSession()
          Are we maintaining session state?
 javax.xml.soap.SOAPMessage getMessage()
          Gets the SOAPMessage from this message context
 OperationDesc getOperation()
          the current operation
 OperationDesc getOperationByQName(javax.xml.namespace.QName qname)
          get the first possible operation that could match a body containing an element of the given QName.
 Style getOperationStyle()
          Get the operation style.
 Use getOperationUse()
          Get the operation use.
 String getPassword()
          Get the password
 boolean getPastPivot()
          Determine when we've passed the pivot
 OperationDesc[] getPossibleOperationsByQName(javax.xml.namespace.QName qname)
          getPossibleOperationsByQName Returns a list of operation descriptors that could may possibly match a body containing an element of the given QName.
 Object getProperty(String name)
          Returns the value associated with the named property - or null if not defined/set.
 Iterator getPropertyNames()
          Returns an Iterator view of the names of the properties in this MessageContext
 Message getRequestMessage()
          Get the request message.
 Message getResponseMessage()
          Get the response message.
 String[] getRoles()
          Not (yet) implemented method in the SOAPMessageContext interface

Gets the SOAP actor roles associated with an execution of the HandlerChain and its contained Handler instances.

 SchemaVersion getSchemaVersion()
          Schema version information
 SOAPService getService()
           
 Session getSession()
          Sessions
 String getSOAPActionURI()
          Get the soapAction URI.
 SOAPConstants getSOAPConstants()
          SOAP constants
 String getStrProp(String propName)
          Just a util so we don't have to cast the result
 String getTargetService()
           
 int getTimeout()
          Get timeout from our MessageContext.
 String getTransportName()
          Transport
 TypeMapping getTypeMapping()
          Return the type mapping currently in scope for our encoding style
 TypeMappingRegistry getTypeMappingRegistry()
          Get the currently in-scope type mapping registry.
 String getUsername()
          Get the user name
 boolean isClient()
          Let us know whether this is the client or the server.
 boolean isEncoded()
          Encoding
 boolean isHighFidelity()
           
 boolean isPropertyTrue(String propName)
          Tests to see if the named property is set in the 'bag'.
 boolean isPropertyTrue(String propName, boolean defaultVal)
          Tests to see if the named property is set in the 'bag'.
 void removeProperty(String propName)
           
 void reset()
           
 void setClassLoader(ClassLoader cl)
          set a new classloader
 void setCurrentMessage(Message curMsg)
          Set the current (i.e.
 void setEncodingStyle(String namespaceURI)
          Sets the encoding style to the URI passed in.
 void setHighFidelity(boolean highFidelity)
           
 void setMaintainSession(boolean yesno)
          Set whether we are maintaining session state
 void setMessage(javax.xml.soap.SOAPMessage message)
          Sets the SOAPMessage for this message context
 void setOperation(OperationDesc operation)
          set the current operation
 void setPassword(String password)
          Set the password.
 void setPastPivot(boolean pastPivot)
          Indicate when we've passed the pivot
 void setProperty(String name, Object value)
          Allows you to set a named property to the passed in value.
 void setPropertyParent(Hashtable parent)
           
 void setRequestMessage(Message reqMsg)
          Set the request message, and make sure that message is associated with this MessageContext.
 void setResponseMessage(Message respMsg)
          Set the response message, and make sure that message is associated with this MessageContext.
 void setSchemaVersion(SchemaVersion schemaVersion)
           
 void setService(SOAPService sh)
           
 void setSession(Session session)
           
 void setSOAPActionURI(String SOAPActionURI)
          Set the soapAction URI.
 void setSOAPConstants(SOAPConstants soapConstants)
           
 void setTargetService(String tServ)
          Set the target service for this message.
 void setTimeout(int value)
          Set timeout in our MessageContext.
 void setTransportName(String transportName)
           
 void setTypeMappingRegistry(TypeMappingRegistry reg)
          replace the engine's type mapping registry with a local one
 void setUsername(String username)
          Set the username.
 void setUseSOAPAction(boolean useSOAPAction)
          Should soapAction be used?
 boolean useSOAPAction()
          Are we using soapAction?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

systemTempDir

protected static String systemTempDir
temporary directory to store attachments


ENGINE_HANDLER

public static final String ENGINE_HANDLER
Contains 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)

See Also:
Constant Field Values

TRANS_URL

public static final String TRANS_URL
This String is the URL that the message came to

See Also:
Constant Field Values

QUIT_REQUESTED

public static final String QUIT_REQUESTED
Has a quit been requested? Hackish... but useful... -- RobJ

See Also:
Constant Field Values

AUTHUSER

public static final String AUTHUSER
Place to store an AuthenticatedUser

See Also:
Constant Field Values

CALL

public static final String CALL
If on the client - this is the Call object

See Also:
Constant Field Values

IS_MSG

public static final String IS_MSG
Are we doing Msg vs RPC? - For Java Binding

See Also:
Constant Field Values

ATTACHMENTS_DIR

public static final String ATTACHMENTS_DIR
The directory where in coming attachments are created.

See Also:
Constant Field Values

ACCEPTMISSINGPARAMS

public static final String ACCEPTMISSINGPARAMS
A boolean param, to control whether we accept missing parameters as nulls or refuse to acknowledge them.

See Also:
Constant Field Values

WSDLGEN_INTFNAMESPACE

public static final String WSDLGEN_INTFNAMESPACE
The 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.

See Also:
Constant Field Values

WSDLGEN_SERV_LOC_URL

public static final String WSDLGEN_SERV_LOC_URL
The 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.

See Also:
Constant Field Values

WSDLGEN_RESOURCE

public static final String WSDLGEN_RESOURCE
The value of the property is used by service WSDL generation (aka ?WSDL) If the wsdl documnet contains imports, this property is the relative path to the imported artifact.

See Also:
Constant Field Values

HTTP_TRANSPORT_VERSION

public static final String HTTP_TRANSPORT_VERSION
The 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

See Also:
Constant Field Values

SECURITY_PROVIDER

public static final String SECURITY_PROVIDER
See Also:
Constant Field Values
Constructor Detail

MessageContext

public MessageContext(AxisEngine engine)
Create a message context.

Parameters:
engine - the controlling axis engine. Null is actually accepted here, though passing a null engine in is strongly discouraged as many of the methods assume that it is in fact defined.
Method Detail

getOperation

public OperationDesc getOperation()
the current operation

Returns:
the current operation; may be null

setOperation

public void setOperation(OperationDesc operation)
set the current operation

Parameters:
operation -

getPossibleOperationsByQName

public OperationDesc[] getPossibleOperationsByQName(javax.xml.namespace.QName qname)
                                             throws AxisFault
getPossibleOperationsByQName 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

Parameters:
qname - of the first element in the body
Returns:
list of operation descriptions
Throws:
AxisFault

getOperationByQName

public OperationDesc getOperationByQName(javax.xml.namespace.QName qname)
                                  throws AxisFault
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

Parameters:
qname - name of the message body
Returns:
an operation or null
Throws:
AxisFault

getCurrentContext

public static MessageContext getCurrentContext()
Get the active message context.

Returns:
the current active message context

setTypeMappingRegistry

public void setTypeMappingRegistry(TypeMappingRegistry reg)
replace the engine's type mapping registry with a local one

Parameters:
reg -

getTypeMappingRegistry

public 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).

Returns:
the type mapping registry to use for this request.

getTypeMapping

public TypeMapping getTypeMapping()
Return the type mapping currently in scope for our encoding style


getTransportName

public String getTransportName()
Transport


setTransportName

public void setTransportName(String transportName)

getSOAPConstants

public SOAPConstants getSOAPConstants()
SOAP constants


setSOAPConstants

public void setSOAPConstants(SOAPConstants soapConstants)

getSchemaVersion

public SchemaVersion getSchemaVersion()
Schema version information


setSchemaVersion

public void setSchemaVersion(SchemaVersion schemaVersion)

getSession

public Session getSession()
Sessions


setSession

public void setSession(Session session)

isEncoded

public boolean isEncoded()
Encoding


setMaintainSession

public void setMaintainSession(boolean yesno)
Set whether we are maintaining session state

Parameters:
yesno - flag to set to true to maintain sessions

getMaintainSession

public boolean getMaintainSession()
Are we maintaining session state?


getRequestMessage

public Message getRequestMessage()
Get the request message.

Returns:
the request message (may be null).

setRequestMessage

public void setRequestMessage(Message reqMsg)
Set the request message, and make sure that message is associated with this MessageContext.

Parameters:
reqMsg - the new request Message.

getResponseMessage

public Message getResponseMessage()
Get the response message.

Returns:
the response message (may be null).

setResponseMessage

public void setResponseMessage(Message respMsg)
Set the response message, and make sure that message is associated with this MessageContext.

Parameters:
respMsg - the new response Message.

getCurrentMessage

public Message getCurrentMessage()
Return the current (i.e. request before the pivot, response after) message.


getMessage

public javax.xml.soap.SOAPMessage getMessage()
Gets the SOAPMessage from this message context

Specified by:
getMessage in interface javax.xml.rpc.handler.soap.SOAPMessageContext
Returns:
Returns the SOAPMessage; returns null if no request SOAPMessage is present in this SOAPMessageContext

setCurrentMessage

public void setCurrentMessage(Message curMsg)
Set the current (i.e. request before the pivot, response after) message.


setMessage

public void setMessage(javax.xml.soap.SOAPMessage message)
Sets the SOAPMessage for this message context

Specified by:
setMessage in interface javax.xml.rpc.handler.soap.SOAPMessageContext
Parameters:
message - Request SOAP message
Throws:
UnsupportedOperationException - If this operation is not supported

getPastPivot

public boolean getPastPivot()
Determine when we've passed the pivot


setPastPivot

public void setPastPivot(boolean pastPivot)
Indicate when we've passed the pivot


setTimeout

public void setTimeout(int value)
Set timeout in our MessageContext.

Parameters:
value - the maximum amount of time, in milliseconds

getTimeout

public int getTimeout()
Get timeout from our MessageContext.

Returns:
value the maximum amount of time, in milliseconds

getClassLoader

public ClassLoader getClassLoader()
get the classloader, implicitly binding to the thread context classloader if an override has not been supplied

Returns:

setClassLoader

public void setClassLoader(ClassLoader cl)
set a new classloader

Parameters:
cl -

getTargetService

public String getTargetService()

getAxisEngine

public AxisEngine getAxisEngine()
get the axis engine. Will be null if the message was created outside an engine

Returns:
the current axis engine

setTargetService

public void setTargetService(String tServ)
                      throws AxisFault
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.

Parameters:
tServ - the name of the target service.
Throws:
AxisFault

getService

public SOAPService getService()

setService

public void setService(SOAPService sh)
                throws AxisFault
Throws:
AxisFault

isClient

public boolean isClient()
Let us know whether this is the client or the server.


getStrProp

public String getStrProp(String propName)
Just a util so we don't have to cast the result


isPropertyTrue

public boolean isPropertyTrue(String propName)
Tests to see if the named property is set in the 'bag'. If not there then 'false' 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'


isPropertyTrue

public boolean isPropertyTrue(String propName,
                              boolean defaultVal)
Tests to see if the named property is set in the 'bag'. If not there then 'defaultVal' will be 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', 'no', or '0' - else 'true' All other types return 'true'


setProperty

public void setProperty(String name,
                        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.

Specified by:
setProperty in interface javax.xml.rpc.handler.MessageContext
Parameters:
name - Name of the property
value - Value of the property

containsProperty

public boolean containsProperty(String name)
Returns true if the MessageContext contains a property with the specified name.

Specified by:
containsProperty in interface javax.xml.rpc.handler.MessageContext
Parameters:
name - Name of the property whose presense is to be tested
Returns:
Returns true if the MessageContext contains the property; otherwise false

getPropertyNames

public Iterator getPropertyNames()
Returns an Iterator view of the names of the properties in this MessageContext

Specified by:
getPropertyNames in interface javax.xml.rpc.handler.MessageContext
Returns:
Iterator for the property names

getProperty

public Object getProperty(String name)
Returns the value associated with the named property - or null if not defined/set.

Specified by:
getProperty in interface javax.xml.rpc.handler.MessageContext
Returns:
Object value of the property - or null

setPropertyParent

public void setPropertyParent(Hashtable parent)

setUsername

public void setUsername(String username)
Set the username.


getUsername

public String getUsername()
Get the user name


setPassword

public void setPassword(String password)
Set the password.


getPassword

public String getPassword()
Get the password


getOperationStyle

public Style getOperationStyle()
Get the operation style.


getOperationUse

public Use getOperationUse()
Get the operation use.


setUseSOAPAction

public void setUseSOAPAction(boolean useSOAPAction)
Should soapAction be used?


useSOAPAction

public boolean useSOAPAction()
Are we using soapAction?


setSOAPActionURI

public void setSOAPActionURI(String SOAPActionURI)
                      throws IllegalArgumentException
Set the soapAction URI.

Throws:
IllegalArgumentException

getSOAPActionURI

public String getSOAPActionURI()
Get the soapAction URI.


setEncodingStyle

public void setEncodingStyle(String namespaceURI)
Sets the encoding style to the URI passed in.

Parameters:
namespaceURI - URI of the encoding to use.

getEncodingStyle

public String getEncodingStyle()
Returns the encoding style as a URI that should be used for the SOAP message.

Returns:
String URI of the encoding style to use

removeProperty

public void removeProperty(String propName)
Specified by:
removeProperty in interface javax.xml.rpc.handler.MessageContext

reset

public void reset()

isHighFidelity

public boolean isHighFidelity()

setHighFidelity

public void setHighFidelity(boolean highFidelity)

getRoles

public String[] getRoles()
Not (yet) implemented method in the SOAPMessageContext interface

Gets the SOAP actor roles associated with an execution of the HandlerChain and its contained Handler instances. Note that 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.

Specified by:
getRoles in interface javax.xml.rpc.handler.soap.SOAPMessageContext
Returns:
Array of URIs for SOAP actor roles
See Also:
HandlerChain.setRoles(java.lang.String[]), HandlerChain.getRoles()


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.