Class AbstractEndpointMapping

All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.core.Ordered, EndpointMapping
Direct Known Subclasses:
AbstractMapBasedEndpointMapping, AbstractMethodEndpointMapping

public abstract class AbstractEndpointMapping extends implements EndpointMapping, org.springframework.core.Ordered
Abstract base class for EndpointMapping implementations. Supports a default endpoint, and endpoint interceptors.
Arjen Poutsma
See Also:
  • Constructor Details

    • AbstractEndpointMapping

      public AbstractEndpointMapping()
  • Method Details

    • getInterceptors

      public EndpointInterceptor[] getInterceptors()
      Returns the endpoint interceptors to apply to all endpoints mapped by this endpoint mapping.
      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.
      interceptors - array of endpoint interceptors, or null if none
    • getOrder

      public final int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.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 org.springframework.beans.BeansException
      Initializes the interceptors.
      initApplicationContext in class
      See Also:
    • initInterceptors

      protected void initInterceptors()
      Initialize the specified interceptors, adapting them where necessary.
      See Also:
    • 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
      the looked up endpoint instance, or the default endpoint
      Exception - if there is an internal error
      See Also:
    • 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.
      endpoint - the endpoint
      interceptors - the endpoint interceptors
      the created invocation chain
      See Also:
    • getDefaultEndpoint

      protected final Object getDefaultEndpoint()
      Returns the default endpoint for this endpoint mapping.
      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.

      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.
      endpointName - the endpoint name
      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.

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