com.jalios.jcms.rest
Class JcmsRestResource

java.lang.Object
  extended by org.restlet.resource.Resource
      extended by com.jalios.jcms.rest.JcmsRestResource
All Implemented Interfaces:
MashupConstants, RestConstants
Direct Known Subclasses:
AdminResource, DataRestResource, DataTypeCollectionResource, DataTypeItemResource, WorkflowItemResource, WorkflowsResource

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 Summary
protected  Channel channel
           
protected  org.restlet.Context context
           
protected  org.restlet.data.Form formQueryString
           
protected  javax.servlet.http.HttpServletRequest j2eeRequest
           
protected  JcmsContext jcmsContext
           
protected  PagerData pagerData
           
protected  String queryString
           
protected  String xmlEncoding
           
 
Fields inherited from interface com.jalios.jcms.rest.RestConstants
HTTP_HEADERS, METHOD_OVERRIDE_HTTP_HEADER, SERVER_REQUEST_HTTP_HEADER_PREFIX, UTS_ADMIN, UTS_DATA_CHILDREN, UTS_DATA_PARAM, UTS_DATATYPE_ITEM, UTS_DATATYPE_LIST, UTS_DOC, UTS_MEMBER_ITEM, UTS_SEARCH, UTS_WORKFLOWS, UTS_WORKFLOWS_ITEM
 
Fields 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_TAG, REVISION
 
Constructor Summary
JcmsRestResource(org.restlet.Context context, org.restlet.data.Request request, org.restlet.data.Response response)
           
 
Method Summary
protected  boolean checkReadRight(Data theData)
          Check if the given Data may be read by the logged Member.
 void delete()
           
protected  void doDelete()
           
protected  void doPost(org.restlet.resource.Representation entity)
           
protected  void doPost(String action, org.restlet.data.Form requestEntityForm)
           
protected  void doPut(org.restlet.resource.Representation entity)
           
protected  void doStat()
           
protected  void forward(String path)
           
protected  void generateErrorRepresentation(String errorMessage, String applicationErrorCode, org.restlet.data.Status httpStatus, org.restlet.data.Response response)
          Generate an XML representation of an error response.
protected  String getAtomRepresentation()
           
protected  String getItemXmlRepresentation(Object item)
           
protected  String getJSONRepresentation()
           
protected  Member getLoggedMember()
           
protected  String getPlainTextRepresentation()
           
 org.restlet.resource.Representation getRepresentation(org.restlet.resource.Variant variant)
           
 String getXmlProlog()
           
protected  String getXmlRepresentation()
           
protected  String insertAfterXml()
           
protected  String insertBeforeXml()
           
 void post(org.restlet.resource.Representation entity)
           
 void put(org.restlet.resource.Representation entity)
           
 void setXmlUTF8Encoding()
           
 
Methods 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
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(String path)

getXmlProlog

public String getXmlProlog()

setXmlUTF8Encoding

public void setXmlUTF8Encoding()

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)
Generate an XML representation of an error response.

Parameters:
errorMessage - the error message.
applicationErrorCode - the error code.

doStat

protected void doStat()

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 -
Returns:
true is the Data can be read by the logged member


Copyright © 2001-2007 Jalios SA. All Rights Reserved.