|
Betty v1.1.0 | |||||||||
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
christophedelory.servlet.AbstractHttpServlet
public abstract class AbstractHttpServlet
The base implementation of an HTTP servlet in our project.
Constructor Summary | |
---|---|
AbstractHttpServlet()
|
Method Summary | |
---|---|
protected void |
doGet(HttpServletRequest req,
HttpServletResponse resp)
|
protected void |
doPost(HttpServletRequest req,
HttpServletResponse resp)
|
protected void |
doPut(HttpServletRequest req,
HttpServletResponse resp)
|
protected Object |
getEnvEntry(String jndiName,
Object defaultValue)
Returns the servlet environment entry specified through its JNDI name. |
protected String[] |
getLocales(HttpServletRequest request)
Returns the preferred locales that the client will accept content in, based first on the "locale" parameter, then on the Accept-Language header. |
protected String |
getParameter(HttpServletRequest request,
String name)
Returns the value of a request parameter as a String , or null if the parameter does not exist or is empty. |
protected void |
sendError(HttpServletResponse resp,
int sc,
String msg)
Sends an error response to the client using the specified status. |
protected void |
sendError(HttpServletResponse resp,
int sc,
Throwable error)
Sends an error response to the client using the specified exception. |
protected void |
sendResponse(HttpServletResponse resp,
Object xml,
String packageName)
Sends an XML response to the client. |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doHead, doOptions, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractHttpServlet()
Method Detail |
---|
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException
doPost
in class HttpServlet
IOException
ServletException
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException
doGet
in class HttpServlet
IOException
ServletException
protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException
doPut
in class HttpServlet
IOException
ServletException
protected void sendError(HttpServletResponse resp, int sc, String msg) throws IOException
resp
- an HttpServletResponse
object that contains the response the servlet sends to the client. Shall not be null
.sc
- the error status code.msg
- the descriptive message. Shall not be null
.
IOException
- if an input or output exception occurs.
IllegalStateException
- if the response was committed.
NullPointerException
- if resp
is null
.
NullPointerException
- if msg
is null
.HttpServletResponse.sendError(int,String)
,
sendError(HttpServletResponse,int,Throwable)
protected void sendError(HttpServletResponse resp, int sc, Throwable error) throws IOException
resp
- an HttpServletResponse
object that contains the response the servlet sends to the client. Shall not be null
.sc
- the error status code.error
- an exception. Shall not be null
.
IOException
- if an input or output exception occurs.
IllegalStateException
- if the response was committed.
NullPointerException
- if resp
is null
.
NullPointerException
- if error
is null
.HttpServletResponse.sendError(int,String)
,
sendError(HttpServletResponse,int,String)
protected void sendResponse(HttpServletResponse resp, Object xml, String packageName) throws IOException
resp
- an HttpServletResponse
object that contains the response the servlet sends to the client. Shall not be null
.xml
- the object to serialize. Shall not be null
.packageName
- the package name. May be null
.
NullPointerException
- if resp
is null
.
NullPointerException
- if xml
is null
.
IOException
- if an input or output exception occurs.
IllegalStateException
- if the response was committed.
UnsupportedEncodingException
- if the character encoding returned by ServletResponse.getCharacterEncoding()
cannot be used.
IllegalStateException
- if the ServletResponse.getOutputStream()
method has already been called for this response object.XmlSerializer.getMapping(String)
,
XmlSerializer.marshal(Object,java.io.Writer,boolean)
protected String getParameter(HttpServletRequest request, String name)
String
, or null
if the parameter does not exist or is empty.
Request parameters are extra information sent with the request.
For HTTP servlets, parameters are contained in the query string or posted form data.
ServletRequest.getParameterValues(String)
.
getParameterValues
.
ServletRequest.getInputStream()
or ServletRequest.getReader()
can interfere with the execution of this method.
request
- an HttpServletRequest
object that contains the request the client has made of the servlet. Shall not be null
.name
- a String
specifying the name of the parameter.
String
representing the single value of the parameter.
NullPointerException
- if request
is null
.protected Object getEnvEntry(String jndiName, Object defaultValue) throws NamingException
jndiName
- the JNDI name to search for. Should not be null.defaultValue
- a default value. May be null
.
null
if missing.
NullPointerException
- if jndiName
is null
.
NamingException
- if a naming exception is encountered.protected String[] getLocales(HttpServletRequest request)
request
- an HttpServletRequest
object that contains the request the client has made of the servlet. Shall not be null
.
null
nor empty.
NullPointerException
- if request
is null
.ServletRequest.getLocales()
|
© 2008-2009 Christophe Delory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |