Package org.apache.sling.jcr.jackrabbit.accessmanager.post

# 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`

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

Modifier and Type
Method
Description
`protected boolean`
`allowNonExistingPaths()`
Returns whether this operation can operate on paths that do not exist yet
`protected void`
`bindPostResponseCreator(org.apache.sling.servlets.post.JakartaPostResponseCreator creator, Map<String,Object> properties)`
Bind a new post response creator
`protected void`
`doPost(org.apache.sling.api.SlingJakartaHttpServletRequest request, org.apache.sling.api.SlingJakartaHttpServletResponse httpResponse)`
`protected String`
`externalizePath(org.apache.sling.api.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.AccessControlList`
`getAccessControlList(javax.jcr.security.AccessControlManager accessControlManager, String resourcePath, boolean mayCreate)`
Returns an `AccessControlList` to edit for the node at the given `resourcePath`.
`protected javax.jcr.security.AccessControlList`
`getAccessControlListOrNull(javax.jcr.security.AccessControlManager accessControlManager, String resourcePath, boolean mayCreate)`
Returns an `AccessControlList` to edit for the node at the given `resourcePath`.
`protected String`
`getItemPath(org.apache.sling.api.SlingJakartaHttpServletRequest request)`
Returns the path of the resource of the request as the item path.
`protected @Nullable String`
`getParentPath(String path)`
Returns an external form of the parent path
`protected String`
`getRedirectUrl(jakarta.servlet.http.HttpServletRequest request, org.apache.sling.servlets.post.JakartaPostResponse ctx)`
compute redirect URL (SLING-126)
`protected abstract void`
`handleOperation(org.apache.sling.api.SlingJakartaHttpServletRequest request, org.apache.sling.servlets.post.JakartaPostResponse response, List<org.apache.sling.servlets.post.Modification> changes)`
Extending Servlet should implement this operation to do the work
`protected boolean`
`isSetStatus(org.apache.sling.api.SlingJakartaHttpServletRequest request)`
`protected void`
`unbindPostResponseCreator(org.apache.sling.servlets.post.JakartaPostResponseCreator creator, Map<String,Object> properties)`
Unbind a post response creator
`protected void`
`validateResourcePath(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.SlingJakartaAllMethodsServlet

`doDelete, doPut, getAllowedRequestMethods, isMethodValid, mayService`

### Methods inherited from class org.apache.sling.api.servlets.SlingJakartaSafeMethodsServlet

`doGeneric, doGet, doHead, doOptions, doTrace, getServletInfo, handleMethodNotImplemented, service, service`

### Methods inherited from class jakarta.servlet.GenericServlet

`destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, init, log, log`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AbstractAccessPostServlet

public AbstractAccessPostServlet()

## Method Details

### doPost

protected void doPost(org.apache.sling.api.SlingJakartaHttpServletRequest request, org.apache.sling.api.SlingJakartaHttpServletResponse httpResponse) throws jakarta.servlet.ServletException, IOException

Overrides:
  `doPost` in class `org.apache.sling.api.servlets.SlingJakartaAllMethodsServlet`
Throws:
  `jakarta.servlet.ServletException`
  `IOException`

### 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(org.apache.sling.api.SlingJakartaHttpServletRequest request, org.apache.sling.servlets.post.JakartaPostResponse response, List<org.apache.sling.servlets.post.Modification> changes) throws javax.jcr.RepositoryException
Extending Servlet should implement this operation to do the work

Parameters:
  `request` - the sling http request to process
  `response` - the response
  `changes` - the changes to report
Throws:
  `javax.jcr.RepositoryException` - if any errors applying the changes

### getRedirectUrl

protected String getRedirectUrl(jakarta.servlet.http.HttpServletRequest request, org.apache.sling.servlets.post.JakartaPostResponse ctx) throws IOException
compute redirect URL (SLING-126)

Parameters:
  `request` - the sling http request to process
  `ctx` - 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.SlingJakartaHttpServletRequest request)

### getItemPath

protected String getItemPath(org.apache.sling.api.SlingJakartaHttpServletRequest 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.SlingJakartaHttpServletRequest 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 process
  `path` - 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.RepositoryException
Returns an `AccessControlList` to edit for the node at the given `resourcePath`.

Parameters:
  `accessControlManager` - The manager providing access control lists
  `resourcePath` - The node path for which to return an access control list
  `mayCreate` - `true` if an access control list should be created if the node does not have one yet.
Returns:
  The `AccessControlList` to modify to control access to the node.
Throws:
  `javax.jcr.RepositoryException` - If the access control manager does not provide a `AccessControlPolicy` which is an `AccessControlList`.

### getAccessControlListOrNull

protected javax.jcr.security.AccessControlList getAccessControlListOrNull(javax.jcr.security.AccessControlManager accessControlManager, String resourcePath, boolean mayCreate) throws javax.jcr.RepositoryException
Returns an `AccessControlList` to edit for the node at the given `resourcePath`.

Parameters:
  `accessControlManager` - The manager providing access control lists
  `resourcePath` - The node path for which to return an access control list
  `mayCreate` - `true` if an access control list should be created if the node does not have one yet.
Returns:
  The `AccessControlList` to 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.JakartaPostResponseCreator creator, Map<String,Object> properties)
Bind a new post response creator

Parameters:
  `creator` - the response creator service reference
  `properties` - the component properties for the service reference

### unbindPostResponseCreator

protected void unbindPostResponseCreator(org.apache.sling.servlets.post.JakartaPostResponseCreator creator, Map<String,Object> properties)
Unbind a post response creator

Parameters:
  `creator` - the response creator service reference
  `properties` - the component properties for the service reference