Class AbstractAccessPostServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- org.apache.sling.api.servlets.SlingSafeMethodsServlet
-
- org.apache.sling.api.servlets.SlingAllMethodsServlet
-
- org.apache.sling.jcr.jackrabbit.accessmanager.post.AbstractAccessServlet
-
- org.apache.sling.jcr.jackrabbit.accessmanager.post.AbstractAccessPostServlet
-
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
- Direct Known Subclasses:
DeleteAcesServlet,ModifyAceServlet
public abstract class AbstractAccessPostServlet extends AbstractAccessServlet
Base class for all the POST servlets for the AccessManager operations- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractAccessPostServlet()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected booleanallowNonExistingPaths()Returns whether this operation can operate on paths that do not exist yetprotected voidbindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)Bind a new post response creatorprotected org.apache.sling.servlets.post.AbstractPostResponsecreateHtmlResponse(org.apache.sling.api.SlingHttpServletRequest req)Deprecated.usecreatePostResponse(SlingHttpServletRequest)insteadprotected voiddoPost(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse httpResponse)protected StringexternalizePath(org.apache.sling.api.SlingHttpServletRequest request, String path)Returns an external form of the given path prepending the context path and appending a display extension.protected javax.jcr.security.AccessControlListgetAccessControlList(javax.jcr.security.AccessControlManager accessControlManager, String resourcePath, boolean mayCreate)Returns anAccessControlListto edit for the node at the givenresourcePath.protected javax.jcr.security.AccessControlListgetAccessControlListOrNull(javax.jcr.security.AccessControlManager accessControlManager, String resourcePath, boolean mayCreate)Returns anAccessControlListto edit for the node at the givenresourcePath.protected StringgetItemPath(org.apache.sling.api.SlingHttpServletRequest request)Returns the path of the resource of the request as the item path.protected @Nullable StringgetParentPath(String path)Returns an external form of the parent pathprotected StringgetRedirectUrl(javax.servlet.http.HttpServletRequest request, org.apache.sling.servlets.post.AbstractPostResponse ctx)Deprecated.usegetRedirectUrl(HttpServletRequest, PostResponse)insteadprotected StringgetRedirectUrl(javax.servlet.http.HttpServletRequest request, org.apache.sling.servlets.post.PostResponse ctx)compute redirect URL (SLING-126)protected voidhandleOperation(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.servlets.post.AbstractPostResponse response, List<org.apache.sling.servlets.post.Modification> changes)Deprecated.protected abstract voidhandleOperation(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.servlets.post.PostResponse response, List<org.apache.sling.servlets.post.Modification> changes)Extending Servlet should implement this operation to do the workprotected booleanisSetStatus(org.apache.sling.api.SlingHttpServletRequest request)protected voidunbindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)Unbind a post response creatorprotected voidvalidateResourcePath(javax.jcr.Session jcrSession, String resourcePath)Override if the path does not need to exist-
Methods inherited from class org.apache.sling.jcr.jackrabbit.accessmanager.post.AbstractAccessServlet
bindRestrictionProvider, getRestrictionProvider, unbindRestrictionProvider
-
Methods inherited from class org.apache.sling.api.servlets.SlingAllMethodsServlet
doDelete, doPut, getAllowedRequestMethods, isMethodValid, mayService
-
Methods inherited from class org.apache.sling.api.servlets.SlingSafeMethodsServlet
doGeneric, doGet, doHead, doOptions, doTrace, getServletInfo, handleMethodNotImplemented, service, service
-
-
-
-
Method Detail
-
doPost
protected void doPost(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse httpResponse) throws javax.servlet.ServletException, IOException- Overrides:
doPostin classorg.apache.sling.api.servlets.SlingAllMethodsServlet- Throws:
javax.servlet.ServletExceptionIOException
-
validateResourcePath
protected void validateResourcePath(javax.jcr.Session jcrSession, String resourcePath) throws javax.jcr.RepositoryExceptionOverride if the path does not need to exist- Throws:
javax.jcr.RepositoryException
-
createHtmlResponse
@Deprecated protected org.apache.sling.servlets.post.AbstractPostResponse createHtmlResponse(org.apache.sling.api.SlingHttpServletRequest req)
Deprecated.usecreatePostResponse(SlingHttpServletRequest)insteadCreates an instance of a HtmlResponse.- Parameters:
req- The request being serviced- Returns:
- a
JSONResponseif any of these conditions are true:- the response content type is application/json
HtmlResponseotherwise
-
handleOperation
@Deprecated protected void handleOperation(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.servlets.post.AbstractPostResponse response, List<org.apache.sling.servlets.post.Modification> changes) throws javax.jcr.RepositoryException
Deprecated.Extending Servlet should implement this operation to do the work- Parameters:
request- the sling http request to processresponse- the responsechanges- the changes to report- Throws:
javax.jcr.RepositoryException- if any errors applying the changes
-
handleOperation
protected abstract void handleOperation(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.servlets.post.PostResponse response, List<org.apache.sling.servlets.post.Modification> changes) throws javax.jcr.RepositoryExceptionExtending Servlet should implement this operation to do the work- Parameters:
request- the sling http request to processresponse- the responsechanges- the changes to report- Throws:
javax.jcr.RepositoryException- if any errors applying the changes
-
getRedirectUrl
@Deprecated protected String getRedirectUrl(javax.servlet.http.HttpServletRequest request, org.apache.sling.servlets.post.AbstractPostResponse ctx) throws IOException
Deprecated.usegetRedirectUrl(HttpServletRequest, PostResponse)insteadcompute redirect URL (SLING-126)- Parameters:
request- the sling http request to processctx- the post processor- Returns:
- the redirect location or
null - Throws:
IOException- if there is something invalid with the :redirect value
-
getRedirectUrl
protected String getRedirectUrl(javax.servlet.http.HttpServletRequest request, org.apache.sling.servlets.post.PostResponse ctx) throws IOException
compute redirect URL (SLING-126)- Parameters:
request- the sling http request to processctx- the post processor- Returns:
- the redirect location or
null - Throws:
IOException- if there is something invalid with the :redirect value
-
isSetStatus
protected boolean isSetStatus(org.apache.sling.api.SlingHttpServletRequest request)
-
getItemPath
protected String getItemPath(org.apache.sling.api.SlingHttpServletRequest request)
Returns the path of the resource of the request as the item path.This method may be overwritten by extension if the operation has different requirements on path processing.
- Parameters:
request- the sling http request to process- Returns:
- the resolved path of the found item
-
externalizePath
protected String externalizePath(org.apache.sling.api.SlingHttpServletRequest request, String path)
Returns an external form of the given path prepending the context path and appending a display extension.- Parameters:
request- the sling http request to processpath- the path to externalize- Returns:
- the url
-
allowNonExistingPaths
protected boolean allowNonExistingPaths()
Returns whether this operation can operate on paths that do not exist yet- Returns:
- true if the resourcePath must exist, false otherwise
-
getParentPath
@Nullable protected @Nullable String getParentPath(String path)
Returns an external form of the parent path- Parameters:
path- the resource path- Returns:
- parent path
-
getAccessControlList
protected javax.jcr.security.AccessControlList getAccessControlList(javax.jcr.security.AccessControlManager accessControlManager, String resourcePath, boolean mayCreate) throws javax.jcr.RepositoryExceptionReturns anAccessControlListto edit for the node at the givenresourcePath.- Parameters:
accessControlManager- The manager providing access control listsresourcePath- The node path for which to return an access control listmayCreate-trueif an access control list should be created if the node does not have one yet.- Returns:
- The
AccessControlListto modify to control access to the node. - Throws:
javax.jcr.RepositoryException- If the access control manager does not provide aAccessControlPolicywhich is anAccessControlList.
-
getAccessControlListOrNull
protected javax.jcr.security.AccessControlList getAccessControlListOrNull(javax.jcr.security.AccessControlManager accessControlManager, String resourcePath, boolean mayCreate) throws javax.jcr.RepositoryExceptionReturns anAccessControlListto edit for the node at the givenresourcePath.- Parameters:
accessControlManager- The manager providing access control listsresourcePath- The node path for which to return an access control listmayCreate-trueif an access control list should be created if the node does not have one yet.- Returns:
- The
AccessControlListto modify to control access to the node or null if one could not be located or created - Throws:
javax.jcr.RepositoryException- if any errors reading the information
-
bindPostResponseCreator
protected void bindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)Bind a new post response creator- Parameters:
creator- the response creator service referenceproperties- the component properties for the service reference
-
unbindPostResponseCreator
protected void unbindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)Unbind a post response creator- Parameters:
creator- the response creator service referenceproperties- the component properties for the service reference
-
-