Package org.apache.synapse.api
Class ApiUtils
- java.lang.Object
-
- org.apache.synapse.api.ApiUtils
-
public class ApiUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description ApiUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Set<Resource>
getAcceptableResources(Map<String,Resource> resources, MessageContext synCtx)
static List<RESTDispatcher>
getDispatchers()
static String
getFullRequestPath(MessageContext synCtx)
static API
getSelectedAPI(MessageContext synCtx)
This method is used to locate the specific API that has been invoked from the collection of all APIs.static String
getSubRequestPath(MessageContext synCtx)
static boolean
isBound(Resource resource, MessageContext synCtx)
Checks whether the provided resource is capable of processing the message from the provided message context.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.static void
populateQueryParamsToMessageContext(MessageContext synCtx)
Populate Message context properties for the query parameters extracted from the urlstatic String
trimSlashes(String url)
static String
trimTrailingSlashes(String url)
-
-
-
Method Detail
-
getFullRequestPath
public static String getFullRequestPath(MessageContext synCtx)
-
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
-
getSubRequestPath
public static String getSubRequestPath(MessageContext synCtx)
-
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 objectsynCtx
- MessageContext object- Returns:
- Whether the provided resource is bound to the provided message context
-
getAcceptableResources
public static Set<Resource> getAcceptableResources(Map<String,Resource> resources, MessageContext synCtx)
-
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
-
getDispatchers
public static List<RESTDispatcher> getDispatchers()
-
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 pathcontext
- API context- Returns:
- true if the invoking api context matches with the path and false if the two values don't match
-
-