Package com.composum.sling.core.servlet
Class ServletOperationSet<E extends Enum<?>,O extends Enum<?>>
- java.lang.Object
-
- com.composum.sling.core.servlet.ServletOperationSet<E,O>
-
- Direct Known Subclasses:
PackageServlet.PackageOperationSet
public class ServletOperationSet<E extends Enum<?>,O extends Enum<?>> extends Object
A set of operation for the implementation of one servlet based on different operations. This set manages the operation for the servlet and is a delegate for the servlet interface methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classServletOperationSet.Method
-
Field Summary
Fields Modifier and Type Field Description protected EdefaultExtensionprotected Map<ServletOperationSet.Method,Map<E,O>>operationDefaultsthe default operation keys for each provided extensionprotected Map<ServletOperationSet.Method,Map<E,Map<O,ServletOperation>>>operationMapthe operations map set up during servlet initialization
-
Constructor Summary
Constructors Constructor Description ServletOperationSet(E defaultExtension)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoDelete(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)protected voiddoGet(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)protected voiddoPost(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)protected voiddoPut(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)OgetDefaultOperation(ServletOperationSet.Method method, E extension)ServletOperationgetOperation(org.apache.sling.api.SlingHttpServletRequest request, ServletOperationSet.Method method)Retrieves the servlet operation requested for the used HTTP method.protected ResourceHandlegetResource(org.apache.sling.api.SlingHttpServletRequest request)the extension hook if the resource is not simply build by the suffixvoidsendInvalidOperation(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, ServletOperationSet.Method method)voidsetDefaultOperation(ServletOperationSet.Method method, E extension, O operation)voidsetOperation(ServletOperationSet.Method method, E extension, O operation, ServletOperation implementation)voidsetOperation(ServletOperationSet.Method method, E extension, O operation, ServletOperation implementation, boolean isDefault)
-
-
-
Field Detail
-
operationDefaults
protected Map<ServletOperationSet.Method,Map<E extends Enum<?>,O extends Enum<?>>> operationDefaults
the default operation keys for each provided extension
-
operationMap
protected Map<ServletOperationSet.Method,Map<E extends Enum<?>,Map<O extends Enum<?>,ServletOperation>>> operationMap
the operations map set up during servlet initialization
-
-
Constructor Detail
-
ServletOperationSet
public ServletOperationSet(E defaultExtension)
-
-
Method Detail
-
getOperation
public ServletOperation getOperation(org.apache.sling.api.SlingHttpServletRequest request, ServletOperationSet.Method method)
Retrieves the servlet operation requested for the used HTTP method. Looks in the selectors for a operation and gives their implementation in the extensions context.- Parameters:
request- the servlet requestmethod- the requested HTTP method- Returns:
- the operation or 'null', if the requested combination of selector and extension has no implementation for the given HTTP method
-
setOperation
public void setOperation(ServletOperationSet.Method method, E extension, O operation, ServletOperation implementation)
-
setOperation
public void setOperation(ServletOperationSet.Method method, E extension, O operation, ServletOperation implementation, boolean isDefault)
-
getDefaultOperation
public O getDefaultOperation(ServletOperationSet.Method method, E extension)
-
setDefaultOperation
public void setDefaultOperation(ServletOperationSet.Method method, E extension, O operation)
-
getResource
protected ResourceHandle getResource(org.apache.sling.api.SlingHttpServletRequest request)
the extension hook if the resource is not simply build by the suffix
-
doGet
protected void doGet(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws javax.servlet.ServletException, IOException- Throws:
javax.servlet.ServletExceptionIOException
-
doPost
protected void doPost(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws javax.servlet.ServletException, IOException- Throws:
javax.servlet.ServletExceptionIOException
-
doPut
protected void doPut(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws javax.servlet.ServletException, IOException- Throws:
javax.servlet.ServletExceptionIOException
-
doDelete
protected void doDelete(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws javax.servlet.ServletException, IOException- Throws:
javax.servlet.ServletExceptionIOException
-
sendInvalidOperation
public void sendInvalidOperation(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, ServletOperationSet.Method method) throws IOException- Throws:
IOException
-
-