Spring Web Services Framework

org.springframework.ws.server.endpoint.mapping
Class XPathPayloadEndpointMapping

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.ws.server.endpoint.mapping.AbstractEndpointMapping
          extended by org.springframework.ws.server.endpoint.mapping.AbstractMapBasedEndpointMapping
              extended by org.springframework.ws.server.endpoint.mapping.XPathPayloadEndpointMapping
All Implemented Interfaces:
InitializingBean, ApplicationContextAware, Ordered, EndpointMapping

public class XPathPayloadEndpointMapping
extends AbstractMapBasedEndpointMapping
implements InitializingBean

Implementation of the EndpointMapping interface that maps to endpoint using an XPath expression. Supports both mapping to bean instances and mapping to bean names: the latter is required for prototype endpoints.

The XPath expression can be set using the expression property. Setting this property is required. There is also an optional namespaces property, which defines to set namespace bindings that are used in the expression.

The endpointMap property is suitable for populating the endpoint map with bean references, e.g. via the map element in XML bean definitions.

Mappings to bean names can be set via the mappings property, in a form accepted by the java.util.Properties class, like as follows:

 BookFlight=bookFlightEndpoint
 GetFlights=getFlightsEndpoint
 
The syntax is XPATH_EVALUATION=ENDPOINT_BEAN_NAME. The key is the evaluation of the XPath expression for the incoming message, the value is the name of the endpoint.

Since:
1.0.0
Author:
Arjen Poutsma
See Also:
setExpression(String), setNamespaces(java.util.Properties)

Field Summary
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
XPathPayloadEndpointMapping()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  String getLookupKeyForMessage(MessageContext messageContext)
          Returns the the endpoint key for the given message context.
 void setExpression(String expression)
          Sets the XPath expression to be used.
 void setNamespaces(Properties namespaces)
          Sets the namespaces bindings used in the expression.
protected  boolean validateLookupKey(String key)
          Validates the given endpoint key.
 
Methods inherited from class org.springframework.ws.server.endpoint.mapping.AbstractMapBasedEndpointMapping
getEndpointInternal, initApplicationContext, lookupEndpoint, registerEndpoint, setEndpointMap, setLazyInitEndpoints, setMappings, setRegisterBeanNames
 
Methods inherited from class org.springframework.ws.server.endpoint.mapping.AbstractEndpointMapping
createEndpointInvocationChain, getDefaultEndpoint, getEndpoint, getInterceptors, getOrder, resolveStringEndpoint, setDefaultEndpoint, setInterceptors, setOrder
 
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, isContextRequired, requiredContextClass, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPathPayloadEndpointMapping

public XPathPayloadEndpointMapping()
Method Detail

setExpression

public void setExpression(String expression)
Sets the XPath expression to be used.


setNamespaces

public void setNamespaces(Properties namespaces)
Sets the namespaces bindings used in the expression. Keys are prefixes, values are namespaces.


afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

getLookupKeyForMessage

protected String getLookupKeyForMessage(MessageContext messageContext)
                                 throws Exception
Description copied from class: AbstractMapBasedEndpointMapping
Returns the the endpoint key for the given message context. Returns null if a key cannot be found.

Specified by:
getLookupKeyForMessage in class AbstractMapBasedEndpointMapping
Returns:
the registration key; or null
Throws:
Exception

validateLookupKey

protected boolean validateLookupKey(String key)
Description copied from class: AbstractMapBasedEndpointMapping
Validates the given endpoint key. Should return true is the given string is valid.

Specified by:
validateLookupKey in class AbstractMapBasedEndpointMapping

Spring Web Services Framework

Copyright © 2005-2010 The Spring Web Services Framework. All Rights Reserved.