Class CreateGroupServlet
- 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
-
- org.apache.sling.jackrabbit.usermanager.impl.post.AbstractAuthorizablePostServlet
-
- org.apache.sling.jackrabbit.usermanager.impl.post.AbstractGroupPostServlet
-
- org.apache.sling.jackrabbit.usermanager.impl.post.CreateGroupServlet
-
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig,CreateGroup
public class CreateGroupServlet extends AbstractGroupPostServlet implements CreateGroup
Sling Post Servlet implementation for creating a group in the jackrabbit UserManager.
Rest Service Description
Creates a new group. Maps on to nodes of resourceType
sling/groupslike/rep:system/rep:userManager/rep:groupsmapped to a resource url/system/userManager/group. This servlet responds at/system/userManager/group.create.htmlMethods
- POST
Post Parameters
- :name
- The name of the new group (required)
- *
- Any additional parameters become properties of the group node (optional)
Response
- 200
- Success, a redirect is sent to the group resource locator. The redirect comes with HTML describing the status.
- 500
- Failure, including group already exists. HTML explains the failure.
Example
curl -F:name=newGroupA -Fproperty1=value1 http://localhost:8080/system/userManager/group.create.htmlNotes
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.sling.jackrabbit.usermanager.impl.post.AbstractAuthorizablePostServlet
PROP_DATE_FORMAT, systemUserManagerPaths
-
-
Constructor Summary
Constructors Constructor Description CreateGroupServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidactivate(Map<String,Object> props)protected voidbindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)Overridden since the @Reference annotation is not inherited from the super methodprotected voidbindSystemUserManagerPaths(SystemUserManagerPaths sump)org.apache.jackrabbit.api.security.user.GroupcreateGroup(javax.jcr.Session jcrSession, String name, Map<String,?> properties, List<org.apache.sling.servlets.post.Modification> changes)Create a new group for the repositoryprotected voiddeactivate()protected voidhandleOperation(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 workprotected voidunbindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)Unbind a post response creator-
Methods inherited from class org.apache.sling.jackrabbit.usermanager.impl.post.AbstractGroupPostServlet
updateGroupMembership
-
Methods inherited from class org.apache.sling.jackrabbit.usermanager.impl.post.AbstractAuthorizablePostServlet
collectContent, convertToRequestParameterArray, convertToString, convertToStringArray, hasItemPathPrefix, processDeletes, requireItemPathPrefix, writeContent
-
Methods inherited from class org.apache.sling.jackrabbit.usermanager.impl.post.AbstractPostServlet
createHtmlResponse, doPost, externalizePath, getItemPath, getRedirectUrl, getRedirectUrl, handleOperation, isSetStatus
-
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
-
-
-
-
Method Detail
-
activate
protected void activate(Map<String,Object> props)
- Overrides:
activatein classAbstractAuthorizablePostServlet
-
deactivate
protected void deactivate()
- Overrides:
deactivatein classAbstractAuthorizablePostServlet
-
bindSystemUserManagerPaths
protected void bindSystemUserManagerPaths(SystemUserManagerPaths sump)
- Overrides:
bindSystemUserManagerPathsin classAbstractAuthorizablePostServlet
-
bindPostResponseCreator
protected void bindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)Overridden since the @Reference annotation is not inherited from the super method
-
unbindPostResponseCreator
protected void unbindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)Description copied from class:AbstractPostServletUnbind a post response creator- Overrides:
unbindPostResponseCreatorin classAbstractPostServlet
-
handleOperation
protected 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.RepositoryExceptionDescription copied from class:AbstractPostServletExtending Servlet should implement this operation to do the work- Specified by:
handleOperationin classAbstractPostServlet- 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
-
createGroup
public org.apache.jackrabbit.api.security.user.Group createGroup(javax.jcr.Session jcrSession, String name, Map<String,?> properties, List<org.apache.sling.servlets.post.Modification> changes) throws javax.jcr.RepositoryExceptionDescription copied from interface:CreateGroupCreate a new group for the repository- Specified by:
createGroupin interfaceCreateGroup- Parameters:
jcrSession- the JCR session of the user creating the groupname- The name of the new group (required)properties- Extra properties to update on the group. The entry values should be either a String or String[] (optional)changes- The list of changes for this operation (optional)- Returns:
- the group that was created
- Throws:
javax.jcr.RepositoryException- if group can't be created
-
-