Class DenyPostServiceImpl

  • All Implemented Interfaces:
    org.apache.sling.servlets.post.SlingPostProcessor

    public class DenyPostServiceImpl
    extends Object
    implements org.apache.sling.servlets.post.SlingPostProcessor
    A SlingPostProcessor whose purpose is to block the processing of POST requests by the default SlingPostServlet 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.
    • Field Detail

      • deniedPathList

        @NotNull
        protected volatile @NotNull List<Pattern> deniedPathList
    • Constructor Detail

      • DenyPostServiceImpl

        public DenyPostServiceImpl()
    • 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 interface org.apache.sling.servlets.post.SlingPostProcessor
        Throws:
        org.apache.sling.api.resource.ResourceNotFoundException
      • deactivate

        protected void deactivate()