Class DenyPostServiceImpl
- java.lang.Object
-
- com.composum.sling.clientlibs.service.DenyPostServiceImpl
-
- All Implemented Interfaces:
org.apache.sling.servlets.post.SlingPostProcessor
public class DenyPostServiceImpl extends Object implements org.apache.sling.servlets.post.SlingPostProcessor
ASlingPostProcessor
whose purpose is to block the processing of POST requests by the defaultSlingPostServlet
for a configurable set of paths. This prevents accidentially creating JCR nodes when trying to access a servlet that is not active for some reason.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
DenyPostServiceImpl.Configuration
-
Field Summary
Fields Modifier and Type Field Description protected @NotNull List<Pattern>
deniedPathList
-
Constructor Summary
Constructors Constructor Description DenyPostServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
activate(DenyPostServiceImpl.Configuration configuration)
protected void
deactivate()
void
process(org.apache.sling.api.SlingHttpServletRequest request, List<org.apache.sling.servlets.post.Modification> changes)
We check whether the resource path matches a configurable set of paths (configured via regex).
-
-
-
Method Detail
-
process
public void process(org.apache.sling.api.SlingHttpServletRequest request, List<org.apache.sling.servlets.post.Modification> changes) throws org.apache.sling.api.resource.ResourceNotFoundException
We check whether the resource path matches a configurable set of paths (configured via regex). If it matches, this request is forbidden, and we throw an exception.- Specified by:
process
in interfaceorg.apache.sling.servlets.post.SlingPostProcessor
- Throws:
org.apache.sling.api.resource.ResourceNotFoundException
-
activate
protected void activate(DenyPostServiceImpl.Configuration configuration)
-
deactivate
protected void deactivate()
-
-