Class JcmsRestResource

java.lang.Object
org.restlet.resource.Resource
com.jalios.jcms.rest.JcmsRestResource
All Implemented Interfaces:
MashupConstants, RestConstants
Direct Known Subclasses:
AbstractAdminRestResource, AdminResource, ChannelNameResource, DataRestResource, DataTypeCollectionResource, DataTypeItemResource, DefaultMemberPreferenceResource, InstanceReportResource, MemberPreferenceResource, NotificationResource, StateResource, WorkflowItemResource, WorkflowsResource, WorkspaceAdminResource

public abstract class JcmsRestResource extends org.restlet.resource.Resource implements RestConstants, MashupConstants
Generic Abstract Restlet Resource for all JCMS OpenAPI resource. It MUST be implemented by all such Resources. It : - provides facilities; - ensures stats are logged ... - formats list results.
Since:
JCMS-6.0
Author:
dissert
  • Field Details

    • channel

      protected Channel channel
    • j2eeRequest

      protected javax.servlet.http.HttpServletRequest j2eeRequest
    • jcmsContext

      protected JcmsContext jcmsContext
    • xmlEncoding

      protected String xmlEncoding
    • pagerData

      protected PagerData pagerData
    • queryString

      protected String queryString
    • formQueryString

      protected org.restlet.data.Form formQueryString
    • context

      protected org.restlet.Context context
    • checkCSRF

      protected boolean checkCSRF
      Should we check CSRF on POST request ?
  • Constructor Details

    • JcmsRestResource

      public JcmsRestResource(org.restlet.Context context, org.restlet.data.Request request, org.restlet.data.Response response)
  • Method Details

    • getLoggedMember

      protected Member getLoggedMember()
    • forward

      protected void forward(String path)
    • getXmlProlog

      public String getXmlProlog()
    • setXmlUTF8Encoding

      public void setXmlUTF8Encoding()
    • setCheckCSRF

      protected void setCheckCSRF(boolean checkCSRF)
      Set wether CSRF control must be verified for POST request on this resource or not.

      Default behavior is configured with properties :

      • Globally for all resources rest.check-csrf: true|false
      • Per resources, using type hierarchy; rest.check-csrf.{class-fqn}: true|false
      Invoking this method override the default value.
      Parameters:
      checkCSRF - true to require valid CSRF prevention measures on client POST request, false to skip CSRF control
      Since:
      jcms-10.0.5 / JCMS-8546
    • getRepresentation

      public final org.restlet.resource.Representation getRepresentation(org.restlet.resource.Variant variant)
      Overrides:
      getRepresentation in class org.restlet.resource.Resource
    • getXmlRepresentation

      protected String getXmlRepresentation()
    • getItemXmlRepresentation

      protected String getItemXmlRepresentation(Object item)
    • insertBeforeXml

      protected String insertBeforeXml()
    • insertAfterXml

      protected String insertAfterXml()
    • getPlainTextRepresentation

      protected String getPlainTextRepresentation()
    • getJSONRepresentation

      protected String getJSONRepresentation()
    • getAtomRepresentation

      protected String getAtomRepresentation()
    • generateErrorRepresentation

      protected void generateErrorRepresentation(String errorMessage, String applicationErrorCode, org.restlet.data.Status httpStatus, org.restlet.data.Response response)
      Deprecated.
      Prefer method with mediatype parameter
      Generate an XML representation of an error response. Prefer method RestUtil.sendDetailedError
      Parameters:
      errorMessage - the error message.
      applicationErrorCode - the error code.
      httpStatus - the HTTP status
      response - the response
    • post

      public final void post(org.restlet.resource.Representation entity)
      Overrides:
      post in class org.restlet.resource.Resource
    • doPost

      protected void doPost(org.restlet.resource.Representation entity)
    • doPost

      protected void doPost(String action, org.restlet.data.Form requestEntityForm)
    • put

      public final void put(org.restlet.resource.Representation entity)
      Overrides:
      put in class org.restlet.resource.Resource
    • doPut

      protected void doPut(org.restlet.resource.Representation entity)
    • delete

      public final void delete()
      Overrides:
      delete in class org.restlet.resource.Resource
    • doDelete

      protected void doDelete()
    • checkReadRight

      protected boolean checkReadRight(Data theData)
      Check if the given Data may be read by the logged Member. For specific types (not Publication, Category, Workspace, Member), the data may be read only by their author or an admin member.
      Parameters:
      theData - the data
      Returns:
      true is the Data can be read by the logged member
    • getPagerData

      public PagerData getPagerData()
      Retrieve the PagerData associated to this Resource, if any.

      The pager data instance returned may not contain any data if only one results was returned, in such case, see DataRestResource.getData().

      Returns:
      a PagerData instance or null if channel was not available.
    • getPreferredMediaType

      public org.restlet.data.MediaType getPreferredMediaType()