Class CommunityWebResource

  • All Implemented Interfaces:
    org.silverpeas.core.web.rs.ProtectedWebResource, org.silverpeas.core.web.rs.WebAuthenticationValidation, org.silverpeas.core.web.rs.WebAuthorizationValidation, org.silverpeas.core.web.SilverpeasWebResource
    Direct Known Subclasses:
    CommunityMembershipResource, CommunityOfUsersResource

    @Authorized
    public abstract class CommunityWebResource
    extends org.silverpeas.core.web.rs.RESTWebService
    Base class of all the resources in the community application exposed through the Web. It is expected the web resource to be spawn for each incoming request; the life-cycle of each web resource instance is within the one of the request.
    Author:
    mmoquillon
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected static interface  CommunityWebResource.WebFunction<R>  
      • Nested classes/interfaces inherited from class org.silverpeas.core.web.rs.RESTWebService

        org.silverpeas.core.web.rs.RESTWebService.WebProcess<R extends Object>, org.silverpeas.core.web.rs.RESTWebService.WebTreatment<R extends Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static org.silverpeas.core.admin.PaginationPage NO_PAGINATION  
      protected static String RESOURCE_NAME  
      • Fields inherited from class org.silverpeas.core.web.rs.RESTWebService

        RESPONSE_HEADER_ARRAYSIZE
      • Fields inherited from interface org.silverpeas.core.web.SilverpeasWebResource

        BASE_PATH
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.silverpeas.components.community.web.CommunityWebResourceURIBuilder getCommunityUriBuilder()
      Gets the builder of URIs of the web resources managed by the community application.
      protected String getResourceBasePath()
      Gets the relative base path at which are all exposed the resources in the community application.
      protected Collection<org.silverpeas.core.admin.user.model.SilverpeasRole> getUserRoles()
      Gets the roles the user requesting currently this web resource plays in the community of users.
      protected CommunityWebManager getWebManager()
      Gets the Web Manager to use to fulfill the incoming request.
      protected void initURIBuilder()  
      protected <T> T process​(CommunityWebResource.WebFunction<T> function)
      Processes the specified web function behalf the community of users concerned by the incoming request.
      • Methods inherited from class org.silverpeas.core.web.rs.RESTWebService

        createWebResourceUri, fromPage, getBundle, getBundleLocation, getHighestUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getOrganisationController, getSilverpeasContext, getUri, getUser, getUserPreferences, identifiedBy, identifiedBy, initContext, initWebResourceUri, isUserDefined, process
      • Methods inherited from interface org.silverpeas.core.web.rs.ProtectedWebResource

        validateUserAuthorization
      • Methods inherited from interface org.silverpeas.core.web.SilverpeasWebResource

        getComponentId
      • Methods inherited from interface org.silverpeas.core.web.rs.WebAuthenticationValidation

        validateUserAuthentication
    • Field Detail

      • NO_PAGINATION

        protected static final org.silverpeas.core.admin.PaginationPage NO_PAGINATION
    • Constructor Detail

      • CommunityWebResource

        public CommunityWebResource()
    • Method Detail

      • initURIBuilder

        @PostConstruct
        protected void initURIBuilder()
      • getResourceBasePath

        protected String getResourceBasePath()
        Gets the relative base path at which are all exposed the resources in the community application.
        Specified by:
        getResourceBasePath in class org.silverpeas.core.web.rs.RESTWebService
        Returns:
        the base path of the resource relative to the URI at which are all exposed the REST-based web services in Silverpeas.
      • getUserRoles

        protected Collection<org.silverpeas.core.admin.user.model.SilverpeasRole> getUserRoles()
        Gets the roles the user requesting currently this web resource plays in the community of users.
        Overrides:
        getUserRoles in class org.silverpeas.core.web.rs.RESTWebService
        Returns:
        a collection of roles the current user plays.
      • getWebManager

        protected CommunityWebManager getWebManager()
        Gets the Web Manager to use to fulfill the incoming request. The web manager centralizes all the behaviour provided in the website, both by the Web GUI and the REST web resources.
        Returns:
        a community web manager.
      • process

        protected <T> T process​(CommunityWebResource.WebFunction<T> function)
        Processes the specified web function behalf the community of users concerned by the incoming request.
        Type Parameters:
        T - the concrete type of the answer.
        Parameters:
        function - the web function to apply.
        Returns:
        the answer of the web function.
      • getCommunityUriBuilder

        protected org.silverpeas.components.community.web.CommunityWebResourceURIBuilder getCommunityUriBuilder()
        Gets the builder of URIs of the web resources managed by the community application.
        Returns:
        a builder of URIS to identify the web resources handled in a community application instance.