Class RestChecker
java.lang.Object
org.exoplatform.social.service.rest.RestChecker
The utility class for flow checking on rest methods.
1. is authenticated?
2. is valid portal container name?
4. is supported media type?
4. is id found?
5. is allowed to access?
6. is any invalid params?
7. returns results.
- Since:
- Sep 29, 2011, 1.2.3
- Author:
- hoatle (hoatlevan at gmail dot com)
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic voidChecks if the request is authenticated or not.static voidcheckAuthenticatedUserPermission(String targetUser) static javax.ws.rs.core.MediaTypecheckSupportedFormat(String expectedFormat, String[] supportedFormats) Checks if the expected format is supported or not.static intcheckSupportedVersion(String version) static org.exoplatform.container.PortalContainercheckValidPortalContainerName(String portalContainerName) Checks if the provided portal container name exists or not.
-
Method Details
-
checkAuthenticatedRequest
public static void checkAuthenticatedRequest()Checks if the request is authenticated or not. If not, throws WebApplicationException with 401 status code. -
checkSupportedVersion
-
checkValidPortalContainerName
public static org.exoplatform.container.PortalContainer checkValidPortalContainerName(String portalContainerName) Checks if the provided portal container name exists or not. If not, throws WebApplicationException with 400 status code.- Parameters:
portalContainerName- the provided portal container name- Returns:
- the associated portal container instance if valid portal container name
-
checkSupportedFormat
public static javax.ws.rs.core.MediaType checkSupportedFormat(String expectedFormat, String[] supportedFormats) Checks if the expected format is supported or not. If not, throws WebApplicationException with 415 status code.- Parameters:
expectedFormat- the expected formatsupportedFormats- the supported formats- Returns:
- the associated media type instance if the expected format is supported
-
checkAuthenticatedUserPermission
-