public abstract class WebappServlet
extends HttpServlet
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ARGS |
static java.lang.String |
CONFIRM_NO |
static java.lang.String |
CONFIRM_POST_URL |
static java.lang.String |
CONFIRM_TYPE |
static java.lang.String |
CONFIRM_YES |
static java.lang.String |
EXTRA_HTML |
static java.lang.String |
MESSAGE_EXTRA_ATTR
The attribute name for the secondary message (optional)
This can be passed as an attribute to add secondary text to a message
default extra text can also be included in the message bundle
with a name based on the message type.
|
static java.lang.String |
MESSAGE_TYPE_ATTR
The attribute name for the message type.
|
static java.lang.String |
MESSAGES_JSP_URL |
static java.lang.String |
SCRIPTS_CONFIRM_JSP |
Constructor and Description |
---|
WebappServlet() |
Modifier and Type | Method and Description |
---|---|
void |
badInputCheck(AppContext conn)
Call this method when invalid data is passed to something that
should have been application generated and is therefore might be
indicative of somebody probing for vulnerabilities.
|
static void |
checkBadInput(SessionService sess) |
java.lang.Boolean |
confirm(HttpServletRequest req,
HttpServletResponse res,
AppContext conn,
java.lang.String type,
java.lang.Object[] args)
process a confirm page
It either returns a Boolean object if the answer is available or
redirects to the confirm page and returns null.
|
java.lang.Boolean |
confirm(HttpServletRequest req,
HttpServletResponse res,
AppContext conn,
java.lang.String type,
java.lang.Object[] args,
SimpleXMLBuilder extra) |
void |
doGet(HttpServletRequest req,
HttpServletResponse res) |
protected void |
doPost(HttpServletRequest req,
HttpServletResponse res) |
protected abstract void |
doPost(HttpServletRequest req,
HttpServletResponse res,
AppContext conn)
Method that does the actual work
|
protected void |
doPut(HttpServletRequest req,
HttpServletResponse res) |
protected void |
doPut(HttpServletRequest req,
HttpServletResponse res,
AppContext conn)
Method to handle put requests
|
static java.lang.String |
encodeCGI(java.lang.String input)
Translates a string into CGI format (used for encoding form values in
URLs)
|
Logger |
getLogger(AppContext c)
get a logger based on the class name
|
void |
handleFormResult(AppContext conn,
HttpServletRequest req,
HttpServletResponse res,
FormResult result) |
void |
message(AppContext context,
HttpServletRequest req,
HttpServletResponse res,
java.lang.String message_type)
Show a standard pre-formatted message page from the servlet.
|
void |
message(AppContext context,
HttpServletRequest req,
HttpServletResponse res,
java.lang.String message_type,
java.lang.Object... args)
Show a standard pre-formatted message page from the servlet.
|
static void |
messageWithArgs(AppContext context,
HttpServletRequest req,
HttpServletResponse res,
java.lang.String message_type,
java.lang.Object[] args) |
protected void |
sendMessageWithArgs(AppContext context,
HttpServletRequest req,
HttpServletResponse res,
java.lang.String message_type,
java.lang.Object[] args) |
public static final java.lang.String MESSAGES_JSP_URL
public static final java.lang.String MESSAGE_TYPE_ATTR
public static final java.lang.String MESSAGE_EXTRA_ATTR
public static final java.lang.String CONFIRM_NO
public static final java.lang.String CONFIRM_YES
public static final java.lang.String EXTRA_HTML
public static final java.lang.String ARGS
public static final java.lang.String SCRIPTS_CONFIRM_JSP
public static final java.lang.String CONFIRM_TYPE
public static final java.lang.String CONFIRM_POST_URL
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, java.io.IOException
ServletException
java.io.IOException
protected final void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, java.io.IOException
ServletException
java.io.IOException
protected final void doPut(HttpServletRequest req, HttpServletResponse res) throws ServletException, java.io.IOException
ServletException
java.io.IOException
protected abstract void doPost(HttpServletRequest req, HttpServletResponse res, AppContext conn) throws ServletException, java.io.IOException
req
- res
- conn
- ServletException
java.io.IOException
protected void doPut(HttpServletRequest req, HttpServletResponse res, AppContext conn) throws ServletException, java.io.IOException
req
- res
- conn
- ServletException
java.io.IOException
public Logger getLogger(AppContext c)
c
- public void badInputCheck(AppContext conn)
conn
- public static void checkBadInput(SessionService sess)
public void message(AppContext context, HttpServletRequest req, HttpServletResponse res, java.lang.String message_type) throws ServletException, java.io.IOException
AppContext.expandText(String)
before being showncontext
- req
- res
- message_type
- ServletException
java.io.IOException
MessageBundleService
public void message(AppContext context, HttpServletRequest req, HttpServletResponse res, java.lang.String message_type, java.lang.Object... args) throws ServletException, java.io.IOException
AppContext.expandText(String)
before being showncontext
- AppContextreq
- res
- message_type
- name of messageargs
- array of arguments.ServletException
java.io.IOException
MessageBundleService
protected void sendMessageWithArgs(AppContext context, HttpServletRequest req, HttpServletResponse res, java.lang.String message_type, java.lang.Object[] args) throws ServletException, java.io.IOException
ServletException
java.io.IOException
public static void messageWithArgs(AppContext context, HttpServletRequest req, HttpServletResponse res, java.lang.String message_type, java.lang.Object[] args) throws ServletException, java.io.IOException
ServletException
java.io.IOException
public java.lang.Boolean confirm(HttpServletRequest req, HttpServletResponse res, AppContext conn, java.lang.String type, java.lang.Object[] args) throws java.io.IOException, ServletException
req
- res
- conn
- type
- type of messageargs
- java.io.IOException
ServletException
public java.lang.Boolean confirm(HttpServletRequest req, HttpServletResponse res, AppContext conn, java.lang.String type, java.lang.Object[] args, SimpleXMLBuilder extra) throws java.io.IOException, ServletException
java.io.IOException
ServletException
public void handleFormResult(AppContext conn, HttpServletRequest req, HttpServletResponse res, FormResult result) throws java.lang.Exception
java.lang.Exception
public static java.lang.String encodeCGI(java.lang.String input)
input
- the String
to encode