public class RestApiUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ALLOW_ALL_ORIGINS |
static String |
WEB_PROTOCOL_SUFFIX |
| Constructor and Description |
|---|
RestApiUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getAllowedOrigin(String origin) |
static String |
getApiPath(Method method) |
static String |
getDefinedMethodHeadersInSwaggerContent(org.wso2.msf4j.Request request,
Method method)
Get defined HTTP methods in the swagger definition as a comma separated string
|
static ErrorDTO |
getErrorDTO(org.wso2.carbon.auth.core.exception.ExceptionCodeHandler exceptionCodeHandler)
Returns an errorDTO based on a provided ExceptionCodeHandler
|
static ErrorDTO |
getInternalServerErrorDTO()
Returns an Internal Server Error DTO
|
static String |
getLoggedInUsername(org.wso2.msf4j.Request request)
Get the current logged in user's username
|
static Map<String,Integer> |
getPaginationParams(Integer offset,
Integer limit,
Integer total)
Returns the next/previous offset/limit parameters properly when current offset,
limit and size parameters are specified
|
public static final String WEB_PROTOCOL_SUFFIX
public static final String ALLOW_ALL_ORIGINS
public static String getLoggedInUsername(org.wso2.msf4j.Request request)
request - msf4j requestpublic static ErrorDTO getInternalServerErrorDTO()
public static ErrorDTO getErrorDTO(org.wso2.carbon.auth.core.exception.ExceptionCodeHandler exceptionCodeHandler)
exceptionCodeHandler - with mapped HTTP error detailspublic static Map<String,Integer> getPaginationParams(Integer offset, Integer limit, Integer total)
offset - current starting indexlimit - current max recordstotal - maximum index possiblepublic static String getDefinedMethodHeadersInSwaggerContent(org.wso2.msf4j.Request request, Method method) throws org.wso2.carbon.auth.core.exception.AuthException
request - Requestmethod - Method information for the requestorg.wso2.carbon.auth.core.exception.AuthException - if failed to get defined http methodsCopyright © 2018 WSO2. All rights reserved.