|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.GenericServlet
org.apache.sling.api.servlets.SlingSafeMethodsServlet
org.apache.sling.api.servlets.SlingAllMethodsServlet
org.apache.sling.jackrabbit.usermanager.impl.post.AbstractAuthorizablePostServlet
public abstract class AbstractAuthorizablePostServlet
Base class for all the POST servlets for the UserManager operations
Constructor Summary | |
---|---|
AbstractAuthorizablePostServlet()
|
Method Summary | |
---|---|
protected void |
activate(org.osgi.service.component.ComponentContext context)
|
protected Map<String,RequestProperty> |
collectContent(SlingHttpServletRequest request,
HtmlResponse response,
String authorizablePath)
Collects the properties that form the content to be written back to the repository. |
protected HtmlResponse |
createHtmlResponse(SlingHttpServletRequest req)
Creates an instance of a HtmlResponse. |
protected void |
deactivate(org.osgi.service.component.ComponentContext context)
|
protected void |
doPost(SlingHttpServletRequest request,
SlingHttpServletResponse httpResponse)
Called by the SlingAllMethodsServlet.mayService(SlingHttpServletRequest, SlingHttpServletResponse) method to
handle an HTTP POST request. |
protected String |
externalizePath(SlingHttpServletRequest request,
String path)
Returns an external form of the given path prepending the context path and appending a display extension. |
protected String |
getItemPath(SlingHttpServletRequest request)
Returns the path of the resource of the request as the item path. |
protected String |
getRedirectUrl(javax.servlet.http.HttpServletRequest request,
HtmlResponse ctx)
compute redirect URL (SLING-126) |
protected abstract void |
handleOperation(SlingHttpServletRequest request,
HtmlResponse htmlResponse,
List<Modification> changes)
Extending Servlet should implement this operation to do the work |
protected boolean |
hasItemPathPrefix(String name)
Returns true if the name starts with either of
the prefixes , and . |
protected boolean |
isSetStatus(SlingHttpServletRequest request)
|
protected void |
processDeletes(org.apache.jackrabbit.api.security.user.Authorizable resource,
Map<String,RequestProperty> reqProperties,
List<Modification> changes)
Removes all properties listed as RequestProperty.isDelete() from
the authorizable. |
protected boolean |
requireItemPathPrefix(SlingHttpServletRequest request)
Returns true if any of the request parameters starts with . |
protected void |
writeContent(javax.jcr.Session session,
org.apache.jackrabbit.api.security.user.Authorizable authorizable,
Map<String,RequestProperty> reqProperties,
List<Modification> changes)
Writes back the content |
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, init, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractAuthorizablePostServlet()
Method Detail |
---|
protected void activate(org.osgi.service.component.ComponentContext context)
protected void deactivate(org.osgi.service.component.ComponentContext context)
protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse httpResponse) throws javax.servlet.ServletException, IOException
SlingAllMethodsServlet
SlingAllMethodsServlet.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.
doPost
in class SlingAllMethodsServlet
request
- The HTTP requesthttpResponse
- The HTTP response
javax.servlet.ServletException
- Not thrown by this implementation.
IOException
- If the error status cannot be reported back to the
client.protected HtmlResponse createHtmlResponse(SlingHttpServletRequest req)
req
- The request being serviced
JSONResponse
if any of these conditions are true:
HtmlResponse
otherwiseprotected abstract void handleOperation(SlingHttpServletRequest request, HtmlResponse htmlResponse, List<Modification> changes) throws javax.jcr.RepositoryException
request
- the sling http request to processhtmlResponse
- the responsechanges
-
javax.jcr.RepositoryException
protected String getRedirectUrl(javax.servlet.http.HttpServletRequest request, HtmlResponse ctx)
ctx
- the post processor
null
protected boolean isSetStatus(SlingHttpServletRequest request)
protected Map<String,RequestProperty> collectContent(SlingHttpServletRequest request, HtmlResponse response, String authorizablePath)
javax.jcr.RepositoryException
- if a repository error occurs
javax.servlet.ServletException
- if an internal error occursprotected void processDeletes(org.apache.jackrabbit.api.security.user.Authorizable resource, Map<String,RequestProperty> reqProperties, List<Modification> changes) throws javax.jcr.RepositoryException
RequestProperty.isDelete()
from
the authorizable.
authorizable
- The
org.apache.jackrabbit.api.security.user.Authorizable
that should have properties deleted.reqProperties
- The map of request properties to check for
properties to be removed.response
- The HtmlResponse
to be updated with
information on deleted properties.
javax.jcr.RepositoryException
- Is thrown if an error occurrs checking or
removing properties.protected void writeContent(javax.jcr.Session session, org.apache.jackrabbit.api.security.user.Authorizable authorizable, Map<String,RequestProperty> reqProperties, List<Modification> changes) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if a repository error occurs
javax.servlet.ServletException
- if an internal error occursprotected String getItemPath(SlingHttpServletRequest request)
This method may be overwritten by extension if the operation has different requirements on path processing.
protected final String externalizePath(SlingHttpServletRequest request, String path)
path
- the path to externalize
protected boolean hasItemPathPrefix(String name)
true
if the name
starts with either of
the prefixes ./
, ../
and /
.
protected final boolean requireItemPathPrefix(SlingHttpServletRequest request)
./
.
In this case only parameters starting with either of the prefixes
./
,
../
and /
are
considered as providing content to be stored. Otherwise all parameters
not starting with the command prefix :
are considered as
parameters to be stored.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |