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
Base class for all the POST servlets for the UserManager operations
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbindPostResponseCreator(PostResponseCreator creator, Map<String, Object> properties) Bind a new post response creatorprotected AbstractPostResponseDeprecated.protected voiddoPost(SlingHttpServletRequest request, SlingHttpServletResponse httpResponse) Called by theSlingAllMethodsServlet.mayService(SlingHttpServletRequest, SlingHttpServletResponse)method to handle an HTTP POST request.protected final StringexternalizePath(SlingHttpServletRequest request, String path) Returns an external form of the given path prepending the context path and appending a display extension.protected StringgetItemPath(SlingHttpServletRequest request) Returns the path of the resource of the request as the item path.protected intgetRanking(Map<String, Object> properties) protected StringgetRedirectUrl(javax.servlet.http.HttpServletRequest request, AbstractPostResponse ctx) Deprecated.usegetRedirectUrl(HttpServletRequest, PostResponse)insteadprotected StringgetRedirectUrl(javax.servlet.http.HttpServletRequest request, PostResponse ctx) compute redirect URL (SLING-126)protected voidhandleOperation(SlingHttpServletRequest request, AbstractPostResponse response, List<Modification> changes) Deprecated.protected abstract voidhandleOperation(SlingHttpServletRequest request, PostResponse response, List<Modification> changes) Extending Servlet should implement this operation to do the workprotected booleanisSetStatus(SlingHttpServletRequest request) protected voidunbindPostResponseCreator(PostResponseCreator creator, Map<String, Object> properties) Unbind a post response creatorMethods inherited from class org.apache.sling.api.servlets.SlingAllMethodsServlet
doDelete, doPut, getAllowedRequestMethods, isMethodValid, mayServiceMethods inherited from class org.apache.sling.api.servlets.SlingSafeMethodsServlet
doGeneric, doGet, doHead, doOptions, doTrace, getServletInfo, handleMethodNotImplemented, service, serviceMethods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, init, log, log
-
Constructor Details
-
AbstractPostServlet
public AbstractPostServlet()
-
-
Method Details
-
doPost
protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse httpResponse) throws javax.servlet.ServletException, IOException Description copied from class:SlingAllMethodsServletCalled by theSlingAllMethodsServlet.mayService(SlingHttpServletRequest, SlingHttpServletResponse)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 classSlingAllMethodsServlet- Parameters:
request- The HTTP requesthttpResponse- The HTTP response- Throws:
javax.servlet.ServletException- Not thrown by this implementation.IOException- If the error status cannot be reported back to the client.
-
createHtmlResponse
Deprecated.usecreatePostResponse(SlingHttpServletRequest)instead.Creates an instance of a HtmlResponse.- Parameters:
req- The request being serviced- Returns:
- a
JSONResponseif any of these conditions are true:- the response content type is application/json
HtmlResponseotherwise
-
handleOperation
@Deprecated protected void handleOperation(SlingHttpServletRequest request, AbstractPostResponse response, List<Modification> changes) throws javax.jcr.RepositoryException Deprecated.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- in case of exceptions during the operation
-
handleOperation
protected abstract void handleOperation(SlingHttpServletRequest request, PostResponse 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- in case of exceptions during the operation
-
getRedirectUrl
@Deprecated protected String getRedirectUrl(javax.servlet.http.HttpServletRequest request, AbstractPostResponse ctx) throws IOException Deprecated.usegetRedirectUrl(HttpServletRequest, PostResponse)insteadcompute redirect URL (SLING-126)- Parameters:
request- the requestctx- the post processor- Returns:
- the redirect location or
null - Throws:
IOException
-
getRedirectUrl
protected String getRedirectUrl(javax.servlet.http.HttpServletRequest request, PostResponse ctx) throws IOException compute redirect URL (SLING-126)- Parameters:
request- the requestctx- 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 current request- Returns:
- the path of the resource
-
externalizePath
Returns an external form of the given path prepending the context path and appending a display extension.- Parameters:
request- the requestpath- the path to externalize- Returns:
- the url
-
bindPostResponseCreator
Bind a new post response creator -
unbindPostResponseCreator
protected void unbindPostResponseCreator(PostResponseCreator creator, Map<String, Object> properties) Unbind a post response creator -
getRanking
-
createPostResponse(SlingHttpServletRequest)instead.