java.lang.Object
org.wso2.carbon.inbound.endpoint.internal.http.api.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 Summary

    Constructors
    Constructor
    Description
    APIResource(String urlTemplate)
    Constructor for creating an API Resource.
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    buildMessage(org.apache.synapse.MessageContext synCtx)
    Builds the message by consuming the input stream.
    final org.apache.synapse.api.dispatch.DispatcherHelper
    Gets the DispatcherHelper related to the the Resource.
    abstract Set<String>
    Gets the HTTP methods supported by this Resource.
    abstract boolean
    invoke(org.apache.synapse.MessageContext synCtx)
    Invokes the API Resource.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • APIResource

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

    • 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