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:
RestrictedService
,Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
public class NodeServlet extends 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
NodeTreeServlet.DefaultTreeNodeStrategy, NodeTreeServlet.LabelType, NodeTreeServlet.NodeParameters, NodeTreeServlet.TreeNodeStrategy, NodeTreeServlet.TreeOperation
-
-
Field Summary
Fields Modifier and Type Field Description protected CoreConfiguration
coreConfig
static String
FILE_CONTENT_TYPE
static String
FILE_NAME_EXT
protected List<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,ResourceFilter>
nodeFilters
protected NodesConfiguration
nodesConfig
protected 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(FilterConfiguration config)
for each configured filter in the OSGi configuration a tree filter is added to the filter setprotected ResourceFilter
buildTreeFilter(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 MappingRules
getJsonSelectorRules(org.apache.sling.api.SlingHttpServletRequest request)
protected 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 ServletOperationSet<NodeServlet.Extension,NodeServlet.Operation>
getOperations()
Each servlet implementation must provide access to its operation set for request delegation.void
init()
setup of the servlet operation set for this servlet instanceprotected List<org.apache.sling.api.resource.Resource>
prepareTreeItems(ResourceHandle resource, List<org.apache.sling.api.resource.Resource> items)
sort children of orderable nodesprotected void
unbindFilterConfiguration(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 CoreConfiguration coreConfig
-
nodesConfig
protected NodesConfiguration nodesConfig
-
nodeFilters
protected final Map<String,ResourceFilter> nodeFilters
-
filterConfigurations
protected final List<FilterConfiguration> filterConfigurations
injection of the filter configurations provided by the OSGi configuration
-
operations
protected 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(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(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 classAbstractServiceServlet
-
buildTreeFilter
protected ResourceFilter buildTreeFilter(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 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 classNodeTreeServlet
-
checkNodeName
protected boolean checkNodeName(@Nullable @Nullable String name)
-
checkNodePath
protected boolean checkNodePath(@Nullable @Nullable String path)
-
getOperations
@NotNull protected @NotNull ServletOperationSet<NodeServlet.Extension,NodeServlet.Operation> getOperations()
Description copied from class:AbstractServiceServlet
Each servlet implementation must provide access to its operation set for request delegation.- Specified by:
getOperations
in classAbstractServiceServlet
-
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(ResourceHandle resource, List<org.apache.sling.api.resource.Resource> items)
sort children of orderable nodes- Overrides:
prepareTreeItems
in classNodeTreeServlet
-
getJsonSelectorRules
public static MappingRules getJsonSelectorRules(org.apache.sling.api.SlingHttpServletRequest request)
-
getJsonSelectorIndent
public static int getJsonSelectorIndent(org.apache.sling.api.SlingHttpServletRequest request)
-
-