|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 abstract void |
doRun(SlingHttpServletRequest request,
HtmlResponse response,
java.util.List<Modification> changes)
|
protected java.lang.String |
externalizePath(SlingHttpServletRequest request,
java.lang.String path)
Returns an external form of the given path prepending the context path and appending a display extension. |
protected java.util.Iterator<Resource> |
getApplyToResources(SlingHttpServletRequest request)
Returns an iterator on Resource instances addressed in the
SlingPostConstants.RP_APPLY_TO request parameter. |
protected java.lang.String |
getItemPath(SlingHttpServletRequest request)
Returns the path of the resource of the request as the item path. |
protected boolean |
hasItemPathPrefix(java.lang.String name)
Returns true if the name starts with either
of the prefixes
{@link SlingPostConstants#ITEM_PREFIX_RELATIVE_CURRENT . |
protected void |
orderNode(SlingHttpServletRequest request,
javax.jcr.Item item,
java.util.List<Modification> changes)
Orders the given node according to the specified command. |
protected boolean |
requireItemPathPrefix(SlingHttpServletRequest request)
Returns true if any of the request parameters starts with {@link SlingPostConstants#ITEM_PREFIX_RELATIVE_CURRENT . |
protected java.lang.String |
resolvePath(java.lang.String absPath,
java.lang.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 java.lang.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, java.util.List<Modification> changes) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected java.util.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 java.lang.String externalizePath(SlingHttpServletRequest request, java.lang.String path)
path
- the path to externalize
protected final java.lang.String resolvePath(java.lang.String absPath, java.lang.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(java.lang.String name)
true
if the name
starts with either
of the prefixes
./
,
../
and /
.
protected void orderNode(SlingHttpServletRequest request, javax.jcr.Item item, java.util.List<Modification> changes) throws javax.jcr.RepositoryException
item
- node to order
javax.jcr.RepositoryException
- if an error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |