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>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ServletOperationSet.Method
-
Field Summary
Fields Modifier and Type Field Description protected E
defaultExtension
protected Map<ServletOperationSet.Method,Map<E,O>>
operationDefaults
the default operation keys for each provided extensionprotected Map<ServletOperationSet.Method,Map<E,Map<O,ServletOperation>>>
operationMap
the 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 void
doDelete(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)
protected void
doGet(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)
protected void
doPost(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)
protected void
doPut(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)
O
getDefaultOperation(ServletOperationSet.Method method, E extension)
ServletOperation
getOperation(org.apache.sling.api.SlingHttpServletRequest request, ServletOperationSet.Method method)
Retrieves the servlet operation requested for the used HTTP method.protected ResourceHandle
getResource(org.apache.sling.api.SlingHttpServletRequest request)
the extension hook if the resource is not simply build by the suffixvoid
sendInvalidOperation(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, ServletOperationSet.Method method)
void
setDefaultOperation(ServletOperationSet.Method method, E extension, O operation)
void
setOperation(ServletOperationSet.Method method, E extension, O operation, ServletOperation implementation)
void
setOperation(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.ServletException
IOException
-
doPost
protected void doPost(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws javax.servlet.ServletException, IOException
- Throws:
javax.servlet.ServletException
IOException
-
doPut
protected void doPut(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws javax.servlet.ServletException, IOException
- Throws:
javax.servlet.ServletException
IOException
-
doDelete
protected void doDelete(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws javax.servlet.ServletException, IOException
- Throws:
javax.servlet.ServletException
IOException
-
sendInvalidOperation
public void sendInvalidOperation(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, ServletOperationSet.Method method) throws IOException
- Throws:
IOException
-
-