|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.sling.servlets.post.AbstractSlingPostOperation
public abstract class AbstractSlingPostOperation
Holds various states and encapsulates methods that are needed to handle a post request.
Field Summary | |
---|---|
protected org.slf4j.Logger |
log
default log |
Fields inherited from interface org.apache.sling.servlets.post.SlingPostOperation |
---|
PROP_OPERATION_NAME, SERVICE_NAME |
Constructor Summary | |
---|---|
AbstractSlingPostOperation()
|
Method Summary | |
---|---|
protected void |
checkoutIfNecessary(javax.jcr.Node node,
List<Modification> changes,
VersioningConfiguration versioningConfiguration)
|
protected abstract void |
doRun(SlingHttpServletRequest request,
HtmlResponse response,
List<Modification> changes)
|
protected String |
externalizePath(SlingHttpServletRequest request,
String path)
Returns an external form of the given path prepending the context path and appending a display extension. |
protected javax.jcr.Node |
findVersionableAncestor(javax.jcr.Node node)
|
protected Iterator<Resource> |
getApplyToResources(SlingHttpServletRequest request)
Returns an iterator on Resource instances addressed in the
SlingPostConstants.RP_APPLY_TO request parameter. |
protected String |
getItemPath(SlingHttpServletRequest request)
Returns the path of the resource of the request as the item path. |
protected VersioningConfiguration |
getVersioningConfiguration(SlingHttpServletRequest request)
|
protected boolean |
hasItemPathPrefix(String name)
Returns true if the name starts with either
of the prefixes
{@link SlingPostConstants#ITEM_PREFIX_RELATIVE_CURRENT . |
protected boolean |
isSkipCheckin(SlingHttpServletRequest request)
|
protected boolean |
isVersionable(javax.jcr.Node node)
|
protected void |
orderNode(SlingHttpServletRequest request,
javax.jcr.Item item,
List<Modification> changes)
Orders the given node according to the specified command. |
protected String |
removeAndValidateWorkspace(String path,
javax.jcr.Session session)
Remove the workspace name, if any, from the start of the path and validate that the session's workspace name matches the path workspace name. |
protected boolean |
requireItemPathPrefix(SlingHttpServletRequest request)
Returns true if any of the request parameters starts with {@link SlingPostConstants#ITEM_PREFIX_RELATIVE_CURRENT . |
protected String |
resolvePath(String absPath,
String relPath)
Resolves the given path with respect to the current root path. |
void |
run(SlingHttpServletRequest request,
HtmlResponse response,
SlingPostProcessor[] processors)
Prepares and finalizes the actual operation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.slf4j.Logger log
Constructor Detail |
---|
public AbstractSlingPostOperation()
Method Detail |
---|
public void run(SlingHttpServletRequest request, HtmlResponse response, SlingPostProcessor[] processors)
getItemPath(SlingHttpServletRequest)
method and setting the
location and parent location on the response. After the operation has
been done in the doRun(SlingHttpServletRequest, HtmlResponse, List)
method the session is saved if there are unsaved modifications. In case
of errorrs, the unsaved changes in the session are rolled back.
run
in interface SlingPostOperation
request
- the request to operate onresponse
- The HtmlResponse
to record execution
progress.protected VersioningConfiguration getVersioningConfiguration(SlingHttpServletRequest request)
protected boolean isSkipCheckin(SlingHttpServletRequest request)
protected String removeAndValidateWorkspace(String path, javax.jcr.Session session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected String getItemPath(SlingHttpServletRequest request)
This method may be overwritten by extension if the operation has different requirements on path processing.
protected abstract void doRun(SlingHttpServletRequest request, HtmlResponse response, List<Modification> changes) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected Iterator<Resource> getApplyToResources(SlingHttpServletRequest request)
Resource
instances addressed in the
SlingPostConstants.RP_APPLY_TO
request parameter. If the request
parameter is not set, null
is returned. If the parameter
is set with valid resources an empty iterator is returned. Any resources
addressed in the SlingPostConstants.RP_APPLY_TO
parameter is
ignored.
request
- The SlingHttpServletRequest
object used to
get the SlingPostConstants.RP_APPLY_TO
parameter.
null
if the parameter is not set in the request.protected final String externalizePath(SlingHttpServletRequest request, String path)
path
- the path to externalize
protected final String resolvePath(String absPath, String relPath)
relPath
- the path to resolve
protected final boolean requireItemPathPrefix(SlingHttpServletRequest request)
./
.
In this case only parameters starting with either of the prefixes
./
,
../
and /
are
considered as providing content to be stored. Otherwise all parameters
not starting with the command prefix :
are considered as
parameters to be stored.
protected boolean hasItemPathPrefix(String name)
true
if the name
starts with either
of the prefixes
./
,
../
and /
.
protected void orderNode(SlingHttpServletRequest request, javax.jcr.Item item, List<Modification> changes) throws javax.jcr.RepositoryException
item
- node to order
javax.jcr.RepositoryException
- if an error occursprotected javax.jcr.Node findVersionableAncestor(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected boolean isVersionable(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected void checkoutIfNecessary(javax.jcr.Node node, List<Modification> changes, VersioningConfiguration versioningConfiguration) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |