org.apache.ws.addressing.handler
Class ServerSideAddressingHandler

java.lang.Object
  extended by javax.xml.rpc.handler.GenericHandler
      extended by org.apache.ws.addressing.handler.AbstractAddressingHandler
          extended by org.apache.ws.addressing.handler.ServerSideAddressingHandler
All Implemented Interfaces:
javax.xml.rpc.handler.Handler
Direct Known Subclasses:
AxisServerSideAddressingHandler

public class ServerSideAddressingHandler
extends AbstractAddressingHandler

A server-side JAX-RPC Handler that extracts WS-Addressing headers from incoming SOAP requests and inserts them into outgoing SOAP responses.

Version:
$Revision: 14 $
Author:
Davanum Srinivas, Ian P. Springer

Field Summary
static org.apache.ws.addressing.handler.ServerSideAddressingHandler.FactoryThreadLocal TRANSFORMER_FACTORY
          Thread local that gives each thread its own TransformerFactory (since it is not thread-safe).
 
Fields inherited from class org.apache.ws.addressing.handler.AbstractAddressingHandler
CONFIG_PROP_ACTOR, CONFIG_PROP_REFERENCE_PROPERTY_NAMES, CONFIG_PROP_REMOVE_HEADERS, CONTINUE_HANDLER_CHAIN_PROCESSING
 
Constructor Summary
ServerSideAddressingHandler()
           
 
Method Summary
protected  void configureCall(javax.xml.rpc.Call call, javax.xml.rpc.handler.soap.SOAPMessageContext oldContext)
          Override this method to prepare the new call, for instance to add properties from the old MessageContext that may be needed by other handlers.
protected  void forwardMessage(javax.xml.rpc.handler.soap.SOAPMessageContext ctx, EndpointReference ref)
          Forward the SOAP message contained in the specified SOAP message context on to the specified end-point reference.
protected  javax.xml.rpc.Service getService(javax.xml.rpc.handler.MessageContext ctx)
          Override this method if you need something other than the default Service.
protected  java.lang.String getTargetServiceName(AddressingHeaders headers)
          Can be overridden by subclasses to customize how the wsa:to header is interpreted.
 boolean handleFault(javax.xml.rpc.handler.MessageContext ctx)
          
 boolean handleRequest(javax.xml.rpc.handler.MessageContext msgContext)
          
 boolean handleResponse(javax.xml.rpc.handler.MessageContext ctx)
          
protected static void removeAllChildElements(javax.xml.soap.SOAPElement soapElem)
          Removes all child elements from the specified SOAPElement.
protected  void setTargetService(javax.xml.rpc.handler.soap.SOAPMessageContext ctx, AddressingHeaders headers)
          Platform-specific subclasses can optionally implement this method.
 
Methods inherited from class org.apache.ws.addressing.handler.AbstractAddressingHandler
createMessageID, generateUUId, getActor, getHandlerConfigProperties, getHandlerConfigProperty, getHeaders, getReferencePropertyQNames, init, initReferencePropertyQNames, isHandlerConfigPropertyTrue, isMustUnderstandEnabled, isPropertyTrue, isRemoveHeadersEnabled
 
Methods inherited from class javax.xml.rpc.handler.GenericHandler
destroy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRANSFORMER_FACTORY

public static final org.apache.ws.addressing.handler.ServerSideAddressingHandler.FactoryThreadLocal TRANSFORMER_FACTORY
Thread local that gives each thread its own TransformerFactory (since it is not thread-safe).

Constructor Detail

ServerSideAddressingHandler

public ServerSideAddressingHandler()
Method Detail

handleRequest

public boolean handleRequest(javax.xml.rpc.handler.MessageContext msgContext)

Specified by:
handleRequest in interface javax.xml.rpc.handler.Handler
Overrides:
handleRequest in class javax.xml.rpc.handler.GenericHandler

handleResponse

public boolean handleResponse(javax.xml.rpc.handler.MessageContext ctx)

Specified by:
handleResponse in interface javax.xml.rpc.handler.Handler
Overrides:
handleResponse in class javax.xml.rpc.handler.GenericHandler

handleFault

public boolean handleFault(javax.xml.rpc.handler.MessageContext ctx)

Specified by:
handleFault in interface javax.xml.rpc.handler.Handler
Overrides:
handleFault in class javax.xml.rpc.handler.GenericHandler

forwardMessage

protected void forwardMessage(javax.xml.rpc.handler.soap.SOAPMessageContext ctx,
                              EndpointReference ref)
Forward the SOAP message contained in the specified SOAP message context on to the specified end-point reference.

Parameters:
ctx - Message context to get the message from
ref - End-point reference to forward to

getService

protected javax.xml.rpc.Service getService(javax.xml.rpc.handler.MessageContext ctx)
                                    throws javax.xml.rpc.ServiceException
Override this method if you need something other than the default Service.

The service returned by this method is used in creating the new Call object. Something like:

 Service service = getService(msgContext);
 Call call = service.createCall()
 call.setTargetEndpointAddress(toEndPointReference.getAddress().toString());
 

Parameters:
ctx - Message context
Returns:
Service instance
Throws:
javax.xml.rpc.ServiceException

configureCall

protected void configureCall(javax.xml.rpc.Call call,
                             javax.xml.rpc.handler.soap.SOAPMessageContext oldContext)
Override this method to prepare the new call, for instance to add properties from the old MessageContext that may be needed by other handlers.

Parameters:
call - Call object about to be invoked
oldContext - MessageContext of the original request/response.

getTargetServiceName

protected java.lang.String getTargetServiceName(AddressingHeaders headers)
                                         throws java.lang.Exception
Can be overridden by subclasses to customize how the wsa:to header is interpreted.

Parameters:
headers - Headers to extract the information from
Returns:
The target service name
Throws:
java.lang.Exception - If an error occurs

setTargetService

protected void setTargetService(javax.xml.rpc.handler.soap.SOAPMessageContext ctx,
                                AddressingHeaders headers)
                         throws java.lang.Exception
Platform-specific subclasses can optionally implement this method.

Parameters:
ctx - Context to get information from
headers - Headers to use
Throws:
java.lang.Exception - If an error occurs

removeAllChildElements

protected static void removeAllChildElements(javax.xml.soap.SOAPElement soapElem)
Removes all child elements from the specified SOAPElement.

Parameters:
soapElem - Element to strip


Copyright © 2008-2009 Rodrigo Ruiz. All Rights Reserved.