Class RestChecker
- java.lang.Object
-
- org.exoplatform.social.service.rest.RestChecker
-
public final class RestChecker extends Object
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 Modifier and Type Class Description static classRestChecker.SUPPORT_VERSION
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckAuthenticatedRequest()Checks 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 Detail
-
checkAuthenticatedRequest
public static void checkAuthenticatedRequest()
Checks if the request is authenticated or not. If not, throws WebApplicationException with 401 status code.
-
checkSupportedVersion
public static int checkSupportedVersion(String version)
-
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
public static void checkAuthenticatedUserPermission(String targetUser)
-
-