org.exoplatform.social.service.rest
Class RestChecker

java.lang.Object
  extended by 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 Summary
static void checkAuthenticatedRequest()
          Checks if the request is authenticated or not.
static javax.ws.rs.core.MediaType checkSupportedFormat(String expectedFormat, String[] supportedFormats)
          Checks if the expected format is supported or not.
static org.exoplatform.container.PortalContainer checkValidPortalContainerName(String portalContainerName)
          Checks if the provided portal container name exists or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkAuthenticatedRequest

public static void checkAuthenticatedRequest()
Checks if the request is authenticated or not. If not, throws WebApplicationException with 401 status code.


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


Copyright © 2003-2013 eXo Platform SAS. All Rights Reserved.