|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.servlet.GenericServlet
org.apache.sling.api.servlets.SlingSafeMethodsServlet
org.apache.sling.api.servlets.SlingAllMethodsServlet
com.day.cq.commons.servlets.AbstractPredicateServlet
com.day.cq.commons.servlets.AbstractCommandServlet
public abstract class AbstractCommandServlet
Abstract servlet to use for the client/server command interface.
Note: due to a problem in SCR plugin, this class cannot extend from the
AbstractPredicateServlet because the predicate provider
reference would be double defined.
| Field Summary | |
|---|---|
static String |
ACTION_PARAM
default action parameter name |
static String |
PATH_PARAM
default path parameter name |
| Fields inherited from class com.day.cq.commons.servlets.AbstractPredicateServlet |
|---|
FILTER_PARAM, PREDICATE_PARAM |
| Constructor Summary | |
|---|---|
AbstractCommandServlet()
|
|
| Method Summary | |
|---|---|
protected void |
doGet(SlingHttpServletRequest request,
SlingHttpServletResponse response)
Called by the SlingSafeMethodsServlet.mayService(SlingHttpServletRequest, SlingHttpServletResponse) method to
handle an HTTP GET request. |
protected void |
doPost(SlingHttpServletRequest request,
SlingHttpServletResponse response)
Called by the SlingAllMethodsServlet.mayService(SlingHttpServletRequest, SlingHttpServletResponse) method to
handle an HTTP POST request. |
protected boolean |
hasCommand(SlingHttpServletRequest request)
Checks if the command in the request is supported. |
protected abstract void |
performCommand(SlingHttpServletRequest request,
SlingHttpServletResponse response)
Perform the command of the current request. |
protected String |
requireParameter(SlingHttpServletRequest request,
String name)
Get value of specified parameter, trim and verify that it's provided |
| Methods inherited from class com.day.cq.commons.servlets.AbstractPredicateServlet |
|---|
doGet, getPredicate, selectorPredicateStart |
| 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, doHead, doOptions, doTrace, getServletInfo, handleMethodNotImplemented, service, service |
| Methods inherited from class javax.servlet.GenericServlet |
|---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, init, init, log, log |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String PATH_PARAM
public static final String ACTION_PARAM
| Constructor Detail |
|---|
public AbstractCommandServlet()
| Method Detail |
|---|
protected void doPost(SlingHttpServletRequest request,
SlingHttpServletResponse response)
throws ServletException,
IOException
SlingAllMethodsServletSlingAllMethodsServlet.mayService(SlingHttpServletRequest, SlingHttpServletResponse) method to
handle an HTTP POST request.
This default implementation reports back to the client that the method is not supported.
Implementations of this class should overwrite this method with their implementation for the HTTP POST method support.
doPost in class SlingAllMethodsServletrequest - The HTTP requestresponse - The HTTP response
ServletException - Not thrown by this implementation.
IOException - If the error status cannot be reported back to the
client.
protected void doGet(SlingHttpServletRequest request,
SlingHttpServletResponse response)
throws ServletException,
IOException
AbstractPredicateServletSlingSafeMethodsServlet.mayService(SlingHttpServletRequest, SlingHttpServletResponse) method to
handle an HTTP GET request.
This default implementation reports back to the client that the method is not supported.
Implementations of this class should overwrite this method with their
implementation for the HTTP GET method support.
Calls AbstractPredicateServlet.doGet(SlingHttpServletRequest, SlingHttpServletResponse, Predicate).
doGet in class AbstractPredicateServletrequest - The HTTP requestresponse - The HTTP response
ServletException - Not thrown by this implementation.
IOException - If the error status cannot be reported back to the
client.
protected boolean hasCommand(SlingHttpServletRequest request)
throws ServletException
false by default.
request - servlet request
true if the command is supported.
ServletException - if a servlet error occurs
protected abstract void performCommand(SlingHttpServletRequest request,
SlingHttpServletResponse response)
throws ServletException,
IOException
hasCommand(SlingHttpServletRequest) returns true
for a POST request.
request - servlet requestresponse - servlet response
ServletException - if an error occurs.
IOException - if an I/O error occurs.
protected String requireParameter(SlingHttpServletRequest request,
String name)
throws ServletException
request - the servlet requestname - the name of the parameter
ServletException - if the parameter is missing or empty.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||