Class AbstractAccessPostServlet
java.lang.Object
jakarta.servlet.GenericServlet
org.apache.sling.api.servlets.SlingJakartaSafeMethodsServlet
org.apache.sling.api.servlets.SlingJakartaAllMethodsServlet
org.apache.sling.jcr.jackrabbit.accessmanager.post.AbstractAccessServlet
org.apache.sling.jcr.jackrabbit.accessmanager.post.AbstractAccessPostServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
- Direct Known Subclasses:
DeleteAcesServlet,ModifyAceServlet
Base class for all the POST servlets for the AccessManager operations
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanReturns whether this operation can operate on paths that do not exist yetprotected voidbindPostResponseCreator(JakartaPostResponseCreator creator, Map<String, Object> properties) Bind a new post response creatorprotected voiddoPost(SlingJakartaHttpServletRequest request, SlingJakartaHttpServletResponse httpResponse) Called by theSlingJakartaAllMethodsServlet.mayService(SlingJakartaHttpServletRequest, SlingJakartaHttpServletResponse)method to handle an HTTP POST request.protected StringexternalizePath(SlingJakartaHttpServletRequest 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 StringReturns 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(jakarta.servlet.http.HttpServletRequest request, JakartaPostResponse ctx) compute redirect URL (SLING-126)protected abstract voidhandleOperation(SlingJakartaHttpServletRequest request, JakartaPostResponse response, List<Modification> changes) Extending Servlet should implement this operation to do the workprotected booleanprotected voidunbindPostResponseCreator(JakartaPostResponseCreator 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 existMethods inherited from class org.apache.sling.jcr.jackrabbit.accessmanager.post.AbstractAccessServlet
bindRestrictionProvider, getRestrictionProvider, unbindRestrictionProviderMethods inherited from class org.apache.sling.api.servlets.SlingJakartaAllMethodsServlet
doDelete, doPut, getAllowedRequestMethods, isMethodValid, mayServiceMethods inherited from class org.apache.sling.api.servlets.SlingJakartaSafeMethodsServlet
doGeneric, doGet, doHead, doOptions, doTrace, getServletInfo, handleMethodNotImplemented, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, init, log, log
-
Constructor Details
-
AbstractAccessPostServlet
public AbstractAccessPostServlet()
-
-
Method Details
-
doPost
protected void doPost(SlingJakartaHttpServletRequest request, SlingJakartaHttpServletResponse httpResponse) throws jakarta.servlet.ServletException, IOException Description copied from class:SlingJakartaAllMethodsServletCalled by theSlingJakartaAllMethodsServlet.mayService(SlingJakartaHttpServletRequest, SlingJakartaHttpServletResponse)method to handle an HTTP POST request.This default implementation reports back to the client that the method is not supported.
Implementations of this class should overwrite this method with their implementation for the HTTP POST method support.
- Overrides:
doPostin classSlingJakartaAllMethodsServlet- Parameters:
request- The HTTP requesthttpResponse- The HTTP response- Throws:
jakarta.servlet.ServletException- Not thrown by this implementation.IOException- If the error status cannot be reported back to the client.
-
validateResourcePath
protected void validateResourcePath(javax.jcr.Session jcrSession, String resourcePath) throws javax.jcr.RepositoryException Override if the path does not need to exist- Throws:
javax.jcr.RepositoryException
-
handleOperation
protected abstract void handleOperation(SlingJakartaHttpServletRequest request, JakartaPostResponse response, List<Modification> changes) throws javax.jcr.RepositoryException 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
-
getRedirectUrl
protected String getRedirectUrl(jakarta.servlet.http.HttpServletRequest request, JakartaPostResponse 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
-
getItemPath
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
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
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.RepositoryException Returns 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.RepositoryException Returns 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(JakartaPostResponseCreator 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(JakartaPostResponseCreator creator, Map<String, Object> properties) Unbind a post response creator- Parameters:
creator- the response creator service referenceproperties- the component properties for the service reference
-