Package com.composum.sling.nodes.servlet
Class NodeServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- org.apache.sling.api.servlets.SlingSafeMethodsServlet
-
- org.apache.sling.api.servlets.SlingAllMethodsServlet
-
- com.composum.sling.core.servlet.AbstractServiceServlet
-
- com.composum.sling.core.servlet.NodeTreeServlet
-
- com.composum.sling.nodes.servlet.NodeServlet
-
- All Implemented Interfaces:
com.composum.sling.core.service.RestrictedService
,Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
public class NodeServlet extends com.composum.sling.core.servlet.NodeTreeServlet
The JCR nodes service servlet to walk though and modify the entire hierarchy.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
NodeServlet.AbstractQueryOperation
protected class
NodeServlet.CopyOperation
The 'create' via POST (multipart form) implementation expects: the 'path' parameter with the path of the new nodes parent the 'name' parameter with the name of the new node the 'file' part (form element / parameter) with the binary content (optional)protected class
NodeServlet.CreateOperation
The 'create' via POST (multipart form) implementation expects: the 'path' parameter with the path of the new nodes parent the 'name' parameter with the name of the new node the 'file' part (form element / parameter) with the binary content (optional)protected class
NodeServlet.DeleteOperation
static class
NodeServlet.Disposition
protected class
NodeServlet.DownloadBinaryOperation
protected class
NodeServlet.ExportQueryOperation
static class
NodeServlet.Extension
protected class
NodeServlet.GetMixinsOperation
protected class
NodeServlet.HtmlQueryOperation
protected class
NodeServlet.JsonQueryOperation
protected class
NodeServlet.ListFiltersAsHtml
protected class
NodeServlet.ListFiltersAsJson
protected class
NodeServlet.LoadBinaryOperation
protected class
NodeServlet.MapGetOperation
protected class
NodeServlet.MapPostOperation
protected class
NodeServlet.MapPutOperation
protected class
NodeServlet.MoveOperation
static class
NodeServlet.Operation
protected class
NodeServlet.PutCopyOperation
protected class
NodeServlet.PutCreateOperation
protected class
NodeServlet.PutMoveOperation
protected class
NodeServlet.QuerySuggestOperation
protected class
NodeServlet.ReferenceOperation
similar to the 'tree' operation creates this operation a JSON object for the requested node; but this node is requested by its id (UUID) in the suffix or as parameter; this operation provides data for reference retrieval (get the node of a reference) suffix: the reference of the node in a 'path notation' selectors / parameters: - 'label': 'name' or 'title' - selects the value to use for the nodes 'text' attribute ' 'id': a parameter with the reference used instead of the id from the suffix URL examples: - http://host/bin/cpm/nodes/node.reference.json/node-id - http://host/bin/cpm/nodes/node.reference.title.json/node-id - http://host/bin/cpm/nodes/node.reference.json?id=node-idprotected class
NodeServlet.ResolveOperation
protected class
NodeServlet.ToggleLockOperation
protected class
NodeServlet.TypeaheadOperation
protected class
NodeServlet.UpdateFileOperation
The 'fileUpdate' via POST (multipart form) implementation expects: the 'path' parameter with the path of the new nodes parent the 'file' part (form element / parameter) with the binary content (optional)-
Nested classes/interfaces inherited from class com.composum.sling.core.servlet.NodeTreeServlet
com.composum.sling.core.servlet.NodeTreeServlet.DefaultTreeNodeStrategy, com.composum.sling.core.servlet.NodeTreeServlet.LabelType, com.composum.sling.core.servlet.NodeTreeServlet.NodeParameters, com.composum.sling.core.servlet.NodeTreeServlet.TreeNodeStrategy, com.composum.sling.core.servlet.NodeTreeServlet.TreeOperation
-
-
Field Summary
Fields Modifier and Type Field Description protected com.composum.sling.core.CoreConfiguration
coreConfig
static String
FILE_CONTENT_TYPE
static String
FILE_NAME_EXT
protected List<com.composum.sling.core.config.FilterConfiguration>
filterConfigurations
injection of the filter configurations provided by the OSGi configurationstatic String
ILLEGAL_NAME_CHARS
static String
KEY_DEFAULT
the names of the default filters configured staticallystatic String
KEY_PAGE
static String
KEY_REFERENCEABLE
static String
KEY_UNFILTERD
static Pattern
MAP_DEPTH_SELECTOR
static Pattern
MAP_INDENT_SELECTOR
static Pattern
NODE_NAME_PATTERN
static Pattern
NODE_PATH_PATTERN
protected Map<String,com.composum.sling.core.filter.ResourceFilter>
nodeFilters
protected NodesConfiguration
nodesConfig
protected com.composum.sling.core.servlet.ServletOperationSet<NodeServlet.Extension,NodeServlet.Operation>
operations
static String
SCRIPT_STATUS_HEADER
static String
SERVICE_KEY
static String
SERVLET_PATH
static Pattern
SQL2_QUERY
the pattern to check for a XPATH query and their simplified variationstatic String
WORDS
the 'some words' query input pattern stringstatic Pattern
XPATH_QUERY
the pattern to check for a XPATH query and their simplified variation-
Fields inherited from class com.composum.sling.core.servlet.AbstractServiceServlet
DATE_FORMAT, PARAM_BEFORE, PARAM_CMD, PARAM_FILE, PARAM_FILTER, PARAM_ID, PARAM_INDEX, PARAM_JCR_CONTENT, PARAM_LABEL, PARAM_MIME_TYPE, PARAM_NAME, PARAM_PATH, PARAM_QUERY, PARAM_RESOURCE_TYPE, PARAM_TITLE, PARAM_TYPE, PARAM_URL, PARAM_VALUE, PARAM_VERSION
-
-
Constructor Summary
Constructors Constructor Description NodeServlet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
activate()
protected void
bindFilterConfiguration(com.composum.sling.core.config.FilterConfiguration config)
for each configured filter in the OSGi configuration a tree filter is added to the filter setprotected com.composum.sling.core.filter.ResourceFilter
buildTreeFilter(com.composum.sling.core.filter.ResourceFilter configuredFilter)
Creates a 'tree filter' as combination with the configured filter and the rules for the 'intermediate' nodes (folders) to traverse up to the target nodes.protected boolean
checkNodeName(@Nullable String name)
protected boolean
checkNodePath(@Nullable String path)
protected void
deactivate()
static int
getJsonSelectorIndent(org.apache.sling.api.SlingHttpServletRequest request)
static com.composum.sling.core.mapping.MappingRules
getJsonSelectorRules(org.apache.sling.api.SlingHttpServletRequest request)
protected com.composum.sling.core.filter.ResourceFilter
getNodeFilter(org.apache.sling.api.SlingHttpServletRequest request)
Determines the filter to use for node retrieval; scans the request for filter parameter or selector.protected @NotNull com.composum.sling.core.servlet.ServletOperationSet<NodeServlet.Extension,NodeServlet.Operation>
getOperations()
void
init()
setup of the servlet operation set for this servlet instanceprotected List<org.apache.sling.api.resource.Resource>
prepareTreeItems(com.composum.sling.core.ResourceHandle resource, List<org.apache.sling.api.resource.Resource> items)
sort children of orderable nodesprotected void
unbindFilterConfiguration(com.composum.sling.core.config.FilterConfiguration config)
removing of a configuration which is not longer available; removes the corresponding tree filter also-
Methods inherited from class com.composum.sling.core.servlet.NodeTreeServlet
addVirtualContent, getContentTypeKey, getFileTypeKey, getFormParameters, getMimeTypeKey, getMimeTypeKey, getNodeLabel, getPrimaryTypeKey, getResourceTypeKey, getSortName, writeJsonNode, writeJsonNodeData, writeNodeIdentifiers, writeNodeJcrState, writeNodeTreeType
-
Methods inherited from class com.composum.sling.core.servlet.AbstractServiceServlet
doDelete, doGet, doPost, doPut, getJsonObject, getJsonObject, getJsonObject, getPath, getResource, getRestrictions, getServiceKey, isEnabled, jsonAnswerItemExists, jsonValue, methodDeletePermission, methodGetPermission, methodPostPermission, methodPutPermission, setNoCacheHeaders, tryToUseRawSuffix
-
Methods inherited from class org.apache.sling.api.servlets.SlingAllMethodsServlet
getAllowedRequestMethods, isMethodValid, mayService
-
Methods inherited from class org.apache.sling.api.servlets.SlingSafeMethodsServlet
doGeneric, doHead, doOptions, doTrace, getServletInfo, handleMethodNotImplemented, service, service
-
-
-
-
Field Detail
-
SERVICE_KEY
public static final String SERVICE_KEY
- See Also:
- Constant Field Values
-
SERVLET_PATH
public static final String SERVLET_PATH
- See Also:
- Constant Field Values
-
SCRIPT_STATUS_HEADER
public static final String SCRIPT_STATUS_HEADER
- See Also:
- Constant Field Values
-
FILE_CONTENT_TYPE
public static final String FILE_CONTENT_TYPE
- See Also:
- Constant Field Values
-
FILE_NAME_EXT
public static final String FILE_NAME_EXT
- See Also:
- Constant Field Values
-
KEY_DEFAULT
public static final String KEY_DEFAULT
the names of the default filters configured statically- See Also:
- Constant Field Values
-
KEY_PAGE
public static final String KEY_PAGE
- See Also:
- Constant Field Values
-
KEY_REFERENCEABLE
public static final String KEY_REFERENCEABLE
- See Also:
- Constant Field Values
-
KEY_UNFILTERD
public static final String KEY_UNFILTERD
- See Also:
- Constant Field Values
-
ILLEGAL_NAME_CHARS
public static final String ILLEGAL_NAME_CHARS
- See Also:
- Constant Field Values
-
NODE_NAME_PATTERN
public static final Pattern NODE_NAME_PATTERN
-
NODE_PATH_PATTERN
public static final Pattern NODE_PATH_PATTERN
-
coreConfig
protected com.composum.sling.core.CoreConfiguration coreConfig
-
nodesConfig
protected NodesConfiguration nodesConfig
-
filterConfigurations
protected final List<com.composum.sling.core.config.FilterConfiguration> filterConfigurations
injection of the filter configurations provided by the OSGi configuration
-
operations
protected com.composum.sling.core.servlet.ServletOperationSet<NodeServlet.Extension,NodeServlet.Operation> operations
-
WORDS
public static final String WORDS
the 'some words' query input pattern string- See Also:
- Constant Field Values
-
XPATH_QUERY
public static final Pattern XPATH_QUERY
the pattern to check for a XPATH query and their simplified variation
-
SQL2_QUERY
public static final Pattern SQL2_QUERY
the pattern to check for a XPATH query and their simplified variation
-
MAP_DEPTH_SELECTOR
public static final Pattern MAP_DEPTH_SELECTOR
-
MAP_INDENT_SELECTOR
public static final Pattern MAP_INDENT_SELECTOR
-
-
Method Detail
-
bindFilterConfiguration
protected void bindFilterConfiguration(com.composum.sling.core.config.FilterConfiguration config)
for each configured filter in the OSGi configuration a tree filter is added to the filter set- Parameters:
config
- the OSGi filter configuration object
-
unbindFilterConfiguration
protected void unbindFilterConfiguration(com.composum.sling.core.config.FilterConfiguration config)
removing of a configuration which is not longer available; removes the corresponding tree filter also- Parameters:
config
- the OSGi filter configuration object to remove
-
activate
protected void activate()
-
deactivate
protected void deactivate()
- Overrides:
deactivate
in classcom.composum.sling.core.servlet.AbstractServiceServlet
-
buildTreeFilter
protected com.composum.sling.core.filter.ResourceFilter buildTreeFilter(com.composum.sling.core.filter.ResourceFilter configuredFilter)
Creates a 'tree filter' as combination with the configured filter and the rules for the 'intermediate' nodes (folders) to traverse up to the target nodes.- Parameters:
configuredFilter
- the filter for the target nodes
-
getNodeFilter
protected com.composum.sling.core.filter.ResourceFilter getNodeFilter(org.apache.sling.api.SlingHttpServletRequest request)
Determines the filter to use for node retrieval; scans the request for filter parameter or selector.- Specified by:
getNodeFilter
in classcom.composum.sling.core.servlet.NodeTreeServlet
-
checkNodeName
protected boolean checkNodeName(@Nullable @Nullable String name)
-
checkNodePath
protected boolean checkNodePath(@Nullable @Nullable String path)
-
getOperations
@NotNull protected @NotNull com.composum.sling.core.servlet.ServletOperationSet<NodeServlet.Extension,NodeServlet.Operation> getOperations()
- Specified by:
getOperations
in classcom.composum.sling.core.servlet.AbstractServiceServlet
-
init
public void init() throws javax.servlet.ServletException
setup of the servlet operation set for this servlet instance- Overrides:
init
in classjavax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
-
prepareTreeItems
protected List<org.apache.sling.api.resource.Resource> prepareTreeItems(com.composum.sling.core.ResourceHandle resource, List<org.apache.sling.api.resource.Resource> items)
sort children of orderable nodes- Overrides:
prepareTreeItems
in classcom.composum.sling.core.servlet.NodeTreeServlet
-
getJsonSelectorRules
public static com.composum.sling.core.mapping.MappingRules getJsonSelectorRules(org.apache.sling.api.SlingHttpServletRequest request)
-
getJsonSelectorIndent
public static int getJsonSelectorIndent(org.apache.sling.api.SlingHttpServletRequest request)
-
-