Class JcmsRestResource

    • Field Detail

      • channel

        protected Channel channel
      • j2eeRequest

        protected javax.servlet.http.HttpServletRequest j2eeRequest
      • xmlEncoding

        protected java.lang.String xmlEncoding
      • queryString

        protected java.lang.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 Detail

      • JcmsRestResource

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

      • getLoggedMember

        protected Member getLoggedMember()
      • forward

        protected void forward​(java.lang.String path)
      • getXmlProlog

        public java.lang.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 java.lang.String getXmlRepresentation()
      • getItemXmlRepresentation

        protected java.lang.String getItemXmlRepresentation​(java.lang.Object item)
      • insertBeforeXml

        protected java.lang.String insertBeforeXml()
      • insertAfterXml

        protected java.lang.String insertAfterXml()
      • getPlainTextRepresentation

        protected java.lang.String getPlainTextRepresentation()
      • getJSONRepresentation

        protected java.lang.String getJSONRepresentation()
      • getAtomRepresentation

        protected java.lang.String getAtomRepresentation()
      • generateErrorRepresentation

        protected void generateErrorRepresentation​(java.lang.String errorMessage,
                                                   java.lang.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​(java.lang.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()