Package com.jalios.jcms.rest
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
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Channelprotected booleanShould we check CSRF on POST request ?protected org.restlet.Contextprotected org.restlet.data.Formprotected javax.servlet.http.HttpServletRequestprotected JcmsContextprotected PagerDataprotected Stringprotected StringFields inherited from interface com.jalios.jcms.mashup.MashupConstants
DATA_TAG, DATASET_TAG, FIELD_CLASS, FIELD_ENTRY, FIELD_ITEM, FIELD_KEY, FIELD_NAME, FIELD_TAG, FIELD_VALUE, FILE_FIELD, FILE_ID, FILE_MTIME, FILE_SIZE, FILE_TAG, FILE_TICKET, FILESET_TAG, RELATED_TAGFields inherited from interface com.jalios.jcms.rest.RestConstants
CSRF_HEADER_NAME, HTTP_HEADERS, METHOD_OVERRIDE_HTTP_HEADER, UTS_ADMIN, UTS_ADMIN_CHECK_0, UTS_ADMIN_CHECK_1, UTS_ADMIN_CHECK_2, UTS_ADMIN_INDEX_SNAPSHOT, UTS_ADMIN_INSTANCE_REPORT_SEND, UTS_ADMIN_MEMBER_PREFERENCES, UTS_ADMIN_MEMBER_PREFERENCES_2, UTS_ADMIN_PLUGINS, UTS_ADMIN_PREFIX, UTS_ADMIN_PROPS_1, UTS_ADMIN_PROPS_2, UTS_ADMIN_PROPS_3, UTS_ADMIN_STATUS, UTS_ALERT, UTS_ALERT_LIST, UTS_ALERT_LIST_LEGACY, UTS_ALERT_WS, UTS_CHANNEL_NAME, UTS_DATA_CHILDREN, UTS_DATA_PARAM, UTS_DATATYPE_ITEM, UTS_DATATYPE_LIST, UTS_DOC, UTS_JSYNC_REQUEST, UTS_LOCK, UTS_MEMBER_ITEM, UTS_MEMBER_PHOTO_UPDATE, UTS_MEMBER_PREFERENCES_2_ITEM, UTS_MEMBER_PREFERENCES_ITEM, UTS_MSG_ENC_OPTIONS_ITEM, UTS_PUSH, UTS_SEARCH, UTS_SEARCH_CAT, UTS_SEARCH_GROUP, UTS_SEARCH_MBR, UTS_SEARCH_WS, UTS_STATE, UTS_UNLOCK, UTS_WHOAMI_ITEM, UTS_WORKFLOWS, UTS_WORKFLOWS_ITEM, UTS_WORKSPACE_ADMIN, UTS_WORKSPACE_ADMIN2 -
Constructor Summary
ConstructorsConstructorDescriptionJcmsRestResource(org.restlet.Context context, org.restlet.data.Request request, org.restlet.data.Response response) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckReadRight(Data theData) Check if the given Data may be read by the logged Member.final voiddelete()protected voiddoDelete()protected voidprotected voiddoPost(org.restlet.resource.Representation entity) protected voiddoPut(org.restlet.resource.Representation entity) protected voidprotected voidgenerateErrorRepresentation(String errorMessage, String applicationErrorCode, org.restlet.data.Status httpStatus, org.restlet.data.Response response) Deprecated.Prefer method with mediatype parameterprotected Stringprotected Stringprotected Stringprotected MemberRetrieve the PagerData associated to this Resource, if any.protected Stringorg.restlet.data.MediaTypefinal org.restlet.resource.RepresentationgetRepresentation(org.restlet.resource.Variant variant) protected Stringprotected Stringprotected Stringfinal voidpost(org.restlet.resource.Representation entity) final voidput(org.restlet.resource.Representation entity) protected voidsetCheckCSRF(boolean checkCSRF) Set wether CSRF control must be verified for POST request on this resource or not.voidMethods inherited from class org.restlet.resource.Resource
allowDelete, allowGet, allowPost, allowPut, generateRef, getContext, getLogger, getPreferredRepresentation, getPreferredVariant, getRequest, getResponse, getVariants, handleDelete, handleGet, handleHead, handleOptions, handlePost, handlePut, init, isNegotiateContent, setContext, setNegotiateContent, setRequest, setResponse
-
Field Details
-
channel
-
j2eeRequest
protected javax.servlet.http.HttpServletRequest j2eeRequest -
jcmsContext
-
xmlEncoding
-
pagerData
-
queryString
-
formQueryString
protected org.restlet.data.Form formQueryString -
context
protected org.restlet.Context context -
checkCSRF
protected boolean checkCSRFShould 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
-
forward
-
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
- 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
- Globally for all resources
-
getRepresentation
public final org.restlet.resource.Representation getRepresentation(org.restlet.resource.Variant variant) - Overrides:
getRepresentationin classorg.restlet.resource.Resource
-
getXmlRepresentation
-
getItemXmlRepresentation
-
insertBeforeXml
-
insertAfterXml
-
getPlainTextRepresentation
-
getJSONRepresentation
-
getAtomRepresentation
-
generateErrorRepresentation
protected void generateErrorRepresentation(String errorMessage, String applicationErrorCode, org.restlet.data.Status httpStatus, org.restlet.data.Response response) Deprecated.Prefer method with mediatype parameterGenerate an XML representation of an error response. Prefer method RestUtil.sendDetailedError- Parameters:
errorMessage- the error message.applicationErrorCode- the error code.httpStatus- the HTTP statusresponse- the response
-
post
public final void post(org.restlet.resource.Representation entity) - Overrides:
postin classorg.restlet.resource.Resource
-
doPost
protected void doPost(org.restlet.resource.Representation entity) -
doPost
-
put
public final void put(org.restlet.resource.Representation entity) - Overrides:
putin classorg.restlet.resource.Resource
-
doPut
protected void doPut(org.restlet.resource.Representation entity) -
delete
public final void delete()- Overrides:
deletein classorg.restlet.resource.Resource
-
doDelete
protected void doDelete() -
checkReadRight
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
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()
-