Class ApiUtils


  • public class ApiUtils
    extends Object
    • Constructor Detail

      • ApiUtils

        public ApiUtils()
    • Method Detail

      • trimSlashes

        public static String trimSlashes​(String url)
      • trimTrailingSlashes

        public static String trimTrailingSlashes​(String url)
      • populateQueryParamsToMessageContext

        public static void populateQueryParamsToMessageContext​(MessageContext synCtx)
        Populate Message context properties for the query parameters extracted from the url
        Parameters:
        synCtx - MessageContext of the request
      • isBound

        public static boolean isBound​(Resource resource,
                                      MessageContext synCtx)
        Checks whether the provided resource is capable of processing the message from the provided message context. The resource becomes capable to do this when the it contains either the name of the api caller, or , in its binds-to.
        Parameters:
        resource - Resource object
        synCtx - MessageContext object
        Returns:
        Whether the provided resource is bound to the provided message context
      • getSelectedAPI

        public static API getSelectedAPI​(MessageContext synCtx)
        This method is used to locate the specific API that has been invoked from the collection of all APIs.
        Parameters:
        synCtx - MessageContext of the request
        Returns:
        Selected API
      • matchApiPath

        public static boolean matchApiPath​(String path,
                                           String context)
        Identify the API by matching the context of the invoking api with the path of each api in the api list.
        Parameters:
        path - request path
        context - API context
        Returns:
        true if the invoking api context matches with the path and false if the two values don't match