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)
  • Method Details

    • 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 format
      supportedFormats - the supported formats
      Returns:
      the associated media type instance if the expected format is supported
    • checkAuthenticatedUserPermission

      public static void checkAuthenticatedUserPermission(String targetUser)