Class APIResource


  • public abstract class APIResource
    extends Object
    APIResource is the abstract implementation of a Resource in an Internal API. An InternalAPI must have one or more Resources. So if we want to register an internal api into EI, we need to create one or more Resources extending this abstract class and make it accessible through InternalAPI.getResources() method.
    • Constructor Detail

      • APIResource

        public APIResource​(String urlTemplate)
        Constructor for creating an API Resource.
        Parameters:
        urlTemplate - the url template of the Resource
    • Method Detail

      • getMethods

        public abstract Set<String> getMethods()
        Gets the HTTP methods supported by this Resource.
        Returns:
        the supported HTTP methods
      • invoke

        public abstract boolean invoke​(org.apache.synapse.MessageContext synCtx)
        Invokes the API Resource.
        Parameters:
        synCtx - the Synapse Message Context
        Returns:
        whether to continue post invocation tasks
      • getDispatcherHelper

        public final org.apache.synapse.api.dispatch.DispatcherHelper getDispatcherHelper()
        Gets the DispatcherHelper related to the the Resource.
        Returns:
        the DispatcherHelper
      • buildMessage

        public final void buildMessage​(org.apache.synapse.MessageContext synCtx)
        Builds the message by consuming the input stream.
        Parameters:
        synCtx - the Synapse Message Context