com.silverpeas.web
Class RESTWebService.WebProcess<RETURN_VALUE>

java.lang.Object
  extended by com.silverpeas.web.RESTWebService.WebProcess<RETURN_VALUE>
Type Parameters:
RETURN_VALUE - the type of the value returned by the web treatment.
Enclosing class:
RESTWebService

protected final class RESTWebService.WebProcess<RETURN_VALUE>
extends Object

This class handles the execution of a RESTWebService.WebTreatment. It provides the centralization of exception catches and handles the lowest role access that must the user verify.


Constructor Summary
protected RESTWebService.WebProcess(RESTWebService.WebTreatment<RETURN_VALUE> webTreatment)
          Default constructor.
 
Method Summary
 RETURN_VALUE execute()
          This method calls the execute method of a .WebTreatment instance.
 RESTWebService.WebProcess<RETURN_VALUE> lowestAccessRole(SilverpeasRole lowestRoleAccess)
          Sets the lowest role access that the user behind the service call must verify.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RESTWebService.WebProcess

protected RESTWebService.WebProcess(RESTWebService.WebTreatment<RETURN_VALUE> webTreatment)
Default constructor.

Parameters:
webTreatment -
Method Detail

lowestAccessRole

public RESTWebService.WebProcess<RETURN_VALUE> lowestAccessRole(SilverpeasRole lowestRoleAccess)
Sets the lowest role access that the user behind the service call must verify.

Parameters:
lowestRoleAccess -
Returns:

execute

public RETURN_VALUE execute()
This method calls the execute method of a .WebTreatment instance. One of the aim of this mechanism is to centralize the exception catching and also to avoid redundant coding around web exceptions. If a lowest role access is defined, the user must verify it. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.

Returns:
the value computed by the specified web treatment.


Copyright © 2016 Silverpeas. All Rights Reserved.