Class AbstractPostServlet

java.lang.Object
javax.servlet.GenericServlet
org.apache.sling.api.servlets.SlingSafeMethodsServlet
org.apache.sling.api.servlets.SlingAllMethodsServlet
org.apache.sling.jackrabbit.usermanager.impl.post.AbstractPostServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
AbstractAuthorizablePostServlet, DeleteAuthorizableServlet

public abstract class AbstractPostServlet extends org.apache.sling.api.servlets.SlingAllMethodsServlet
Base class for all the POST servlets for the UserManager operations
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    bindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)
    Bind a new post response creator
    protected org.apache.sling.servlets.post.AbstractPostResponse
    createHtmlResponse(org.apache.sling.api.SlingHttpServletRequest req)
    Deprecated.
    use createPostResponse(SlingHttpServletRequest) instead.
    protected void
    doPost(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse httpResponse)
     
    protected final 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.
    protected String
    getItemPath(org.apache.sling.api.SlingHttpServletRequest request)
    Returns the path of the resource of the request as the item path.
    protected int
    getRanking(Map<String,Object> properties)
     
    protected String
    getRedirectUrl(javax.servlet.http.HttpServletRequest request, org.apache.sling.servlets.post.AbstractPostResponse ctx)
    protected String
    getRedirectUrl(javax.servlet.http.HttpServletRequest request, org.apache.sling.servlets.post.PostResponse ctx)
    compute redirect URL (SLING-126)
    protected void
    handleOperation(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.servlets.post.AbstractPostResponse response, List<org.apache.sling.servlets.post.Modification> changes)
    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)
    Extending Servlet should implement this operation to do the work
    protected boolean
    isSetStatus(org.apache.sling.api.SlingHttpServletRequest request)
     
    protected void
    unbindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)
    Unbind a post response creator

    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

    Methods inherited from class javax.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

    • AbstractPostServlet

      public AbstractPostServlet()
  • Method Details

    • doPost

      protected void doPost(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse httpResponse) throws javax.servlet.ServletException, IOException
      Overrides:
      doPost in class org.apache.sling.api.servlets.SlingAllMethodsServlet
      Throws:
      javax.servlet.ServletException
      IOException
    • createHtmlResponse

      @Deprecated protected org.apache.sling.servlets.post.AbstractPostResponse createHtmlResponse(org.apache.sling.api.SlingHttpServletRequest req)
      Deprecated.
      use createPostResponse(SlingHttpServletRequest) instead.
      Creates an instance of a HtmlResponse.
      Parameters:
      req - The request being serviced
      Returns:
      a JSONResponse if any of these conditions are true:
      • the response content type is application/json
      or a HtmlResponse otherwise
    • 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
      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 - in case of exceptions during the operation
    • 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.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 - in case of exceptions during the operation
    • getRedirectUrl

      @Deprecated protected String getRedirectUrl(javax.servlet.http.HttpServletRequest request, org.apache.sling.servlets.post.AbstractPostResponse ctx) throws IOException
      compute redirect URL (SLING-126)
      Parameters:
      request - the request
      ctx - the post processor
      Returns:
      the redirect location or null
      Throws:
      IOException
    • 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 request
      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.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 current request
      Returns:
      the path of the resource
    • externalizePath

      protected final 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 request
      path - the path to externalize
      Returns:
      the url
    • bindPostResponseCreator

      protected void bindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)
      Bind a new post response creator
    • unbindPostResponseCreator

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

      protected int getRanking(Map<String,Object> properties)