Spring Web Services Framework

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

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.ws.server.endpoint.mapping.AbstractEndpointMapping
All Implemented Interfaces:
Aware, ApplicationContextAware, Ordered, EndpointMapping
Direct Known Subclasses:
AbstractMapBasedEndpointMapping, AbstractMethodEndpointMapping

public abstract class AbstractEndpointMapping
extends ApplicationObjectSupport
implements EndpointMapping, Ordered

Abstract base class for EndpointMapping implementations. Supports a default endpoint, and endpoint interceptors.

Since:
1.0.0
Author:
Arjen Poutsma
See Also:
getEndpointInternal(org.springframework.ws.context.MessageContext), EndpointInterceptor

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
AbstractEndpointMapping()
           
 
Method Summary
protected  EndpointInvocationChain createEndpointInvocationChain(MessageContext messageContext, Object endpoint, EndpointInterceptor[] interceptors)
          Creates a new EndpointInvocationChain based on the given message context, endpoint, and interceptors.
protected  Object getDefaultEndpoint()
          Returns the default endpoint for this endpoint mapping.
 EndpointInvocationChain getEndpoint(MessageContext messageContext)
          Look up an endpoint for the given message context, falling back to the default endpoint if no specific one is found.
protected abstract  Object getEndpointInternal(MessageContext messageContext)
          Lookup an endpoint for the given request, returning null if no specific one is found.
 EndpointInterceptor[] getInterceptors()
          Returns the the endpoint interceptors to apply to all endpoints mapped by this endpoint mapping.
 int getOrder()
           
protected  void initApplicationContext()
          Initializes the interceptors.
protected  void initInterceptors()
          Initialize the specified interceptors, adapting them where necessary.
protected  Object resolveStringEndpoint(String endpointName)
          Resolves an endpoint string.
 void setDefaultEndpoint(Object defaultEndpoint)
          Sets the default endpoint for this endpoint mapping.
 void setInterceptors(EndpointInterceptor[] interceptors)
          Sets the endpoint interceptors to apply to all endpoints mapped by this endpoint mapping.
 void setOrder(int order)
          Specify the order value for this mapping.
 
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

AbstractEndpointMapping

public AbstractEndpointMapping()
Method Detail

getInterceptors

public EndpointInterceptor[] getInterceptors()
Returns the the endpoint interceptors to apply to all endpoints mapped by this endpoint mapping.

Returns:
array of endpoint interceptors, or null if none

setInterceptors

public final void setInterceptors(EndpointInterceptor[] interceptors)
Sets the endpoint interceptors to apply to all endpoints mapped by this endpoint mapping.

Parameters:
interceptors - array of endpoint interceptors, or null if none

getOrder

public final int getOrder()
Specified by:
getOrder in interface Ordered

setOrder

public final void setOrder(int order)
Specify the order value for this mapping.

Default value is Integer.MAX_VALUE, meaning that it's non-ordered.

See Also:
Ordered.getOrder()

initApplicationContext

protected void initApplicationContext()
                               throws BeansException
Initializes the interceptors.

Overrides:
initApplicationContext in class ApplicationObjectSupport
Throws:
BeansException
See Also:
initInterceptors()

initInterceptors

protected void initInterceptors()
Initialize the specified interceptors, adapting them where necessary.

See Also:
setInterceptors(org.springframework.ws.server.EndpointInterceptor[])

getEndpoint

public final EndpointInvocationChain getEndpoint(MessageContext messageContext)
                                          throws Exception
Look up an endpoint for the given message context, falling back to the default endpoint if no specific one is found.

Specified by:
getEndpoint in interface EndpointMapping
Returns:
the looked up endpoint instance, or the default endpoint
Throws:
Exception - if there is an internal error
See Also:
getEndpointInternal(org.springframework.ws.context.MessageContext)

createEndpointInvocationChain

protected EndpointInvocationChain createEndpointInvocationChain(MessageContext messageContext,
                                                                Object endpoint,
                                                                EndpointInterceptor[] interceptors)
Creates a new EndpointInvocationChain based on the given message context, endpoint, and interceptors. Default implementation creates a simple EndpointInvocationChain based on the set interceptors.

Parameters:
endpoint - the endpoint
interceptors - the endpoint interceptors
Returns:
the created invocation chain
See Also:
setInterceptors(org.springframework.ws.server.EndpointInterceptor[])

getDefaultEndpoint

protected final Object getDefaultEndpoint()
Returns the default endpoint for this endpoint mapping.

Returns:
the default endpoint mapping, or null if none

setDefaultEndpoint

public final void setDefaultEndpoint(Object defaultEndpoint)
Sets the default endpoint for this endpoint mapping. This endpoint will be returned if no specific mapping was found.

Default is null, indicating no default endpoint.

Parameters:
defaultEndpoint - the default endpoint, or null if none

resolveStringEndpoint

protected Object resolveStringEndpoint(String endpointName)
Resolves an endpoint string. If the given string can is a bean name, it is resolved using the application context.

Parameters:
endpointName - the endpoint name
Returns:
the resolved endpoint, or null if the name could not be resolved

getEndpointInternal

protected abstract Object getEndpointInternal(MessageContext messageContext)
                                       throws Exception
Lookup an endpoint for the given request, returning null if no specific one is found. This template method is called by getEndpoint, a null return value will lead to the default handler, if one is set.

The returned endpoint can be a string, in which case it is resolved as a bean name. Also, it can take the form beanName#method, in which case the method is resolved.

Returns:
the looked up endpoint instance, or null
Throws:
Exception - if there is an error

Spring Web Services Framework

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