public abstract class BaseRemoteStore
extends org.springframework.extensions.webscripts.AbstractWebScript
Responsible for providing remote HTTP based access to a store. Designed to be accessed from a web-tier application to remotely mirror a WebScript Store instance.
Request format:
/ / [? ] / /s/ / [? ] / /s/ /w/ / [? ]
Example:
/service/remotestore/lastmodified/sites/xyz/pages/page.xml
where:
/service/remotestore -> service path /lastmodified -> method name /sites/../page.xml -> document path
optional request parameters:
s -> the store id
Note: path is relative to the root path as configured for this webscript bean
Further URL arguments may be provided if required by specific API methods.
For content create and update the request should be POSTed and the content sent as the payload of the request content.
Supported API methods:
GET lastmodified -> return timestamp of a document in ms since 1970 as a long string value GET has -> return true or false string as existence for a document GET get -> return raw document content - in addition the appropriate HTTP headers for the character encoding, content type, length and modified date will be set GET list -> return the list of available document paths under a path - UTF-8 response text GET listall -> return the list of available document paths (recursively) under a given path - UTF-8 response text GET listpattern -> return the list of document paths matching a file pattern under a given path - UTF-8 response text POST create -> create a new document with request content payload POST createmulti -> create multiple new documents with request content payload POST update -> update an existing document with request content payload DELETE delete -> delete an existing document
Modifier and Type | Field and Description |
---|---|
protected String |
defaultStore |
protected org.alfresco.service.cmr.repository.MimetypeService |
mimetypeService |
static String |
REQUEST_PARAM_STORE |
static String |
TOKEN_STORE |
protected static ThreadLocal<Transformer> |
transformer |
protected static TransformerFactory |
TRANSFORMER_FACTORY |
Constructor and Description |
---|
BaseRemoteStore() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
createDocument(org.springframework.extensions.webscripts.WebScriptResponse res,
String store,
String path,
InputStream content)
Creates a document.
|
protected abstract void |
createDocuments(org.springframework.extensions.webscripts.WebScriptResponse res,
String store,
InputStream content)
Creates multiple XML documents encapsulated in a single one.
|
protected abstract void |
deleteDocument(org.springframework.extensions.webscripts.WebScriptResponse res,
String store,
String path)
Deletes an existing document.
|
protected static String |
encodePath(String s) |
void |
execute(org.springframework.extensions.webscripts.WebScriptRequest req,
org.springframework.extensions.webscripts.WebScriptResponse res)
Execute the webscript based on the request parameters
|
protected abstract void |
getDocument(org.springframework.extensions.webscripts.WebScriptResponse res,
String store,
String path)
Gets a document.
|
protected List<String> |
getPathParts(String[] extPaths)
Helper to break down webscript extension path into path component elements
|
protected abstract void |
hasDocument(org.springframework.extensions.webscripts.WebScriptResponse res,
String store,
String path)
Determines if the document exists.
|
protected abstract void |
lastModified(org.springframework.extensions.webscripts.WebScriptResponse res,
String store,
String path)
Gets the last modified timestamp for the document.
|
protected abstract void |
listDocuments(org.springframework.extensions.webscripts.WebScriptResponse res,
String store,
String path,
boolean recurse)
Lists the document paths under a given path.
|
protected abstract void |
listDocuments(org.springframework.extensions.webscripts.WebScriptResponse res,
String store,
String path,
String pattern)
Lists the document paths matching a file pattern under a given path.
|
void |
setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService) |
void |
setStore(String defaultStore) |
protected abstract void |
updateDocument(org.springframework.extensions.webscripts.WebScriptResponse res,
String store,
String path,
InputStream content)
Updates an existing document.
|
addModuleBundleToCache, checkModuleBundleCache, createArgs, createArgsM, createHeaders, createHeadersM, createScriptParameters, createStatusException, createTemplateParameters, executeScript, getContainer, getDescription, getExecuteScript, getResources, getStatusTemplate, init, renderString, renderString, renderTemplate, sendStatus, setURLModelFactory, toString
public static final String TOKEN_STORE
public static final String REQUEST_PARAM_STORE
protected String defaultStore
protected org.alfresco.service.cmr.repository.MimetypeService mimetypeService
protected static final TransformerFactory TRANSFORMER_FACTORY
protected static ThreadLocal<Transformer> transformer
public void setStore(String defaultStore)
defaultStore
- the default store name of the store to process document requests againstpublic void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
mimetypeService
- the MimetypeService to setpublic void execute(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res) throws IOException
IOException
protected List<String> getPathParts(String[] extPaths)
protected abstract void lastModified(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path) throws IOException
store
- the store idpath
- document path to an existing documentIOException
protected abstract void hasDocument(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path) throws IOException
store
- the store idpath
- document pathIOException
protected abstract void getDocument(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path) throws IOException
store
- the store idpath
- document pathIOException
- if an error occurs retrieving the documentprotected abstract void listDocuments(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path, boolean recurse) throws IOException
store
- the store idpath
- document pathrecurse
- true to peform a recursive list, false for direct children only.IOException
- if an error occurs listing the documentsprotected abstract void listDocuments(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path, String pattern) throws IOException
store
- the store idpath
- document pathpattern
- file pattern to match - allows wildcards e.g. *.xml or site*.xmlIOException
- if an error occurs listing the documentsprotected abstract void createDocument(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path, InputStream content)
store
- the store idpath
- document pathcontent
- content of the document to writeprotected abstract void createDocuments(org.springframework.extensions.webscripts.WebScriptResponse res, String store, InputStream content)
res
- WebScriptResponsestore
- the store idcontent
- content of the document to writeprotected abstract void updateDocument(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path, InputStream content)
store
- the store idpath
- document pathcontent
- content to update the document withprotected abstract void deleteDocument(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path)
store
- the store idpath
- document pathCopyright © 2005–2017 Alfresco Software. All rights reserved.