|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.restafarian.core.servlets.RestServletBase
public abstract class RestServletBase
This is the base class for all of the REST servlets.
| Field Summary | |
|---|---|
protected javax.servlet.ServletContext |
context
|
protected org.apache.commons.logging.Log |
log
|
| Constructor Summary | |
|---|---|
RestServletBase()
|
|
| Method Summary | |
|---|---|
void |
destroy()
Servlet destroy method. |
abstract void |
doDelete(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
The Servlet "doDelete()" method. |
abstract void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
The Servlet "doGet()" method. |
abstract void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
The Servlet "doPost()" method. |
abstract void |
doPut(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
The Servlet "doPut()" method. |
protected static java.lang.String |
filter(java.lang.String value)
Filter the specified string for characters that are sensitive to HTML interpreters, returning the string with these characters replaced by the corresponding character entities. |
protected java.lang.String |
getIdFromUrl(javax.servlet.http.HttpServletRequest req,
java.lang.String servletPath)
Returns the id present in the URL, if any. |
protected java.lang.String |
getNameSpaceUrl(javax.servlet.http.HttpServletRequest req)
Returns the name space url. |
protected int |
getNumericIdFromUrl(javax.servlet.http.HttpServletRequest req,
java.lang.String servletPath)
Returns the id present in the URL, if any, as an int. |
void |
init(javax.servlet.ServletConfig config)
Servlet init method. |
protected void |
sendError(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
int errorCode,
java.lang.String errorMessage)
Sends the HTTP error code and message, and logs the code and message if enabled. |
protected void |
sendError(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
int errorCode,
java.lang.String errorMessage,
java.lang.Throwable throwable)
Sends the HTTP error code and message, and logs the code and message if enabled. |
void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
The Servlet "service" method. |
| Methods inherited from class javax.servlet.http.HttpServlet |
|---|
doHead, doOptions, doTrace, getLastModified, service |
| Methods inherited from class javax.servlet.GenericServlet |
|---|
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected javax.servlet.ServletContext context
protected org.apache.commons.logging.Log log
| Constructor Detail |
|---|
public RestServletBase()
| Method Detail |
|---|
public void service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
java.io.IOException
The Servlet "service" method.
service in class javax.servlet.http.HttpServletreq - the HttpServletRequest objectres - the HttpServletResponse object
javax.servlet.ServletException
java.io.IOException
public abstract void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
java.io.IOException
The Servlet "doGet()" method.
doGet in class javax.servlet.http.HttpServletreq - the HttpServletRequest objectres - the HttpServletResponse object
javax.servlet.ServletException
java.io.IOException
public abstract void doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
java.io.IOException
The Servlet "doPost()" method.
doPost in class javax.servlet.http.HttpServletreq - the HttpServletRequest objectres - the HttpServletResponse object
javax.servlet.ServletException
java.io.IOException
public abstract void doPut(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
java.io.IOException
The Servlet "doPut()" method.
doPut in class javax.servlet.http.HttpServletreq - the HttpServletRequest objectres - the HttpServletResponse object
javax.servlet.ServletException
java.io.IOException
public abstract void doDelete(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
java.io.IOException
The Servlet "doDelete()" method.
doDelete in class javax.servlet.http.HttpServletreq - the HttpServletRequest objectres - the HttpServletResponse object
javax.servlet.ServletException
java.io.IOException
protected int getNumericIdFromUrl(javax.servlet.http.HttpServletRequest req,
java.lang.String servletPath)
Returns the id present in the URL, if any, as an int.
req - the HttpServletRequest objectservletPath - the path to the servlet, including both the leading and trailing "/"
protected java.lang.String getIdFromUrl(javax.servlet.http.HttpServletRequest req,
java.lang.String servletPath)
Returns the id present in the URL, if any.
req - the HttpServletRequest objectservletPath - the path to the servlet, including both the leading and trailing "/"
protected java.lang.String getNameSpaceUrl(javax.servlet.http.HttpServletRequest req)
Returns the name space url.
req - the HttpServletRequest object
protected static java.lang.String filter(java.lang.String value)
value - The string to be filtered and returned
protected void sendError(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
int errorCode,
java.lang.String errorMessage)
throws java.io.IOException
Sends the HTTP error code and message, and logs the code and message if enabled.
req - the HttpServletRequest objectres - the HttpServletResponse objecterrorCode - the error code to senderrorMessage - the error message to send
java.io.IOException
protected void sendError(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
int errorCode,
java.lang.String errorMessage,
java.lang.Throwable throwable)
throws java.io.IOException
Sends the HTTP error code and message, and logs the code and message if enabled.
req - the HttpServletRequest objectres - the HttpServletResponse objecterrorCode - the error code to senderrorMessage - the error message to sendthrowable - an optional exception
java.io.IOExceptionpublic void init(javax.servlet.ServletConfig config)
Servlet init method.
init in interface javax.servlet.Servletinit in class javax.servlet.GenericServletconfig - the ServletConfig objectpublic void destroy()
Servlet destroy method.
destroy in interface javax.servlet.Servletdestroy in class javax.servlet.GenericServlet
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||