public abstract class BaseServlet
extends javax.servlet.http.HttpServlet
HttpServlet
that provides default
functionality for basic servlet processing and defines method signatures
for specific application and servlet requirements.Modifier and Type | Class and Description |
---|---|
protected class |
BaseServlet.Context
Inner class used to store servlet context information.
|
Modifier and Type | Field and Description |
---|---|
protected static int |
BROWSER_IE
The browser type value for Microsoft Internet Explorer compatible
web browsers.
|
protected static int |
BROWSER_NN
The browser type value for Netscape Navigator compatible web browsers.
|
protected static int |
BROWSER_XX
The browser type value for unknown browsers.
|
protected static int |
RESP_NULL
The response flag "null" value.
|
protected static int |
RESP_REDIRECTED
The response flag "page redirected" value.
|
protected static int |
RQST_AJAX
The request flag "AJAX call" value.
|
protected static int |
RQST_NULL
The request flag "null" value.
|
private static long |
serialVersionUID
The class' serialization version id.
|
private static java.lang.Boolean |
SERVER_TOMCAT
Indicates if the application is running in an Apache Tomcat server.
|
Constructor and Description |
---|
BaseServlet() |
Modifier and Type | Method and Description |
---|---|
protected int |
confirmSession(BaseServlet.Context ctx)
Determines if the servlet is being accessed within the context of a
valid session.
|
protected BaseServlet.Context |
createContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Creates the servlet context inner class.
|
protected void |
createNewSession(BaseServlet.Context ctx)
Creates a new session object and initializes the minimum required values
for a new session.
|
protected abstract void |
createNewSessionImpl(BaseServlet.Context ctx)
Provides additional application-specific functionality for creating a new
session.
|
protected void |
determineBrowser(BaseServlet.Context ctx)
Determines the type of browser being used (i.e.
|
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handles HTTP GET requests.
|
void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handles HTTP POST requests.
|
protected abstract boolean |
editFormFields(BaseServlet.Context ctx)
Edits the values from the html template's form fields.
|
protected java.lang.String |
getCookie(BaseServlet.Context ctx,
java.lang.String name)
Obtains the value of a cookie key from request object.
|
protected java.lang.String |
getInvokerName(BaseServlet.Context ctx)
Returns the name for the servlet that invoked this servlet.
|
protected java.lang.String |
getInvokerName(BaseServlet.Context ctx,
boolean inclSlash)
Returns the name for the servlet that invoked this servlet.
|
protected java.lang.String |
getInvokerParams(BaseServlet.Context ctx)
Returns the url parameters (query string) for the servlet that invoked
this servlet.
|
protected java.lang.String |
getInvokerParams(BaseServlet.Context ctx,
boolean inclQmark)
Returns the url parameters (query string) for the servlet that invoked
this servlet.
|
protected java.lang.String |
getInvokerPath(BaseServlet.Context ctx)
Returns the path for the servlet that invoked this servlet.
|
protected java.lang.String |
getInvokerPath(BaseServlet.Context ctx,
boolean inclSlash)
Returns the path for the servlet that invoked this servlet.
|
protected java.lang.String |
getInvokerURL(BaseServlet.Context ctx)
Returns the full url for the servlet that invoked this servlet.
|
protected abstract java.lang.String |
getNextURL(BaseServlet.Context ctx)
Returns the next URL (including parameters) to be processed when this
servlet's processing has been successfully completed (no edit errors, etc.).
|
protected java.lang.String |
getPageParams(BaseServlet.Context ctx)
Returns the URL parameters required to process the servlet when the
template's form is posted.
|
protected java.lang.String |
getPageTitle(BaseServlet.Context ctx)
Returns the title of the servlet page to be displayed to the user.
|
protected java.lang.String |
getRequestURL(BaseServlet.Context ctx)
Returns the current request's full url.
|
protected java.lang.String |
getServletName(BaseServlet.Context ctx)
Returns the name for the current servlet.
|
protected java.lang.String |
getServletName(BaseServlet.Context ctx,
boolean inclSlash)
Returns the name for the current servlet.
|
protected java.lang.String |
getServletParams(BaseServlet.Context ctx)
Returns the current servlet's url parameters (query string).
|
protected java.lang.String |
getServletParams(BaseServlet.Context ctx,
boolean inclQmark)
Returns the current servlet's url parameters (query string).
|
protected java.lang.String |
getServletPath(BaseServlet.Context ctx)
Returns the current servlet's path.
|
protected java.lang.String |
getServletPath(BaseServlet.Context ctx,
boolean inclSlash)
Returns the current servlet's path.
|
protected java.lang.String |
getServletURL(BaseServlet.Context ctx)
Returns the current servlet's url.
|
protected java.lang.String |
getServletURL(BaseServlet.Context ctx,
boolean inclSlash)
Returns the current servlet's url.
|
protected java.lang.String |
getTemplateMessage(java.lang.String msgidsfx)
Returns the message text for a given message id suffix.
|
protected java.lang.String |
getTemplateMessage(java.lang.String msgidsfx,
java.lang.String value)
Returns the message text for a given message id suffix with the given
substitution values inserted into the message text.
|
protected java.lang.String |
getTemplateMessage(java.lang.String msgidsfx,
java.lang.String value1,
java.lang.String value2)
Returns the message text for a given message id suffix with the given
substitution values inserted into the message text.
|
protected java.lang.String |
getTemplateMessage(java.lang.String msgidsfx,
java.lang.String value1,
java.lang.String value2,
java.lang.String value3)
Returns the message text for a given message id suffix with the given
substitution values inserted into the message text.
|
protected java.lang.String |
getTemplateMessage(java.lang.String msgidsfx,
java.lang.String value1,
java.lang.String value2,
java.lang.String value3,
java.lang.String value4)
Returns the message text for a given message id suffix with the given
substitution values inserted into the message text.
|
protected abstract java.lang.String |
getTemplateName(BaseServlet.Context ctx)
Returns the name of the html template file used by the servlet.
|
protected org.apache.velocity.VelocityContext |
initTemplateData(BaseServlet.Context ctx,
boolean cookies)
Creates, initializes and returns a new set of Velocity template data.
|
protected abstract void |
initTemplateDataImpl(BaseServlet.Context ctx,
org.apache.velocity.VelocityContext vc,
boolean cookies)
Provides additional application-specific functionality for initializing
a new set of Velocity template data.
|
protected boolean |
isPrintable(BaseServlet.Context ctx)
Answers if the servlet allows for a printable version to be displayed.
|
protected boolean |
isServerTomcat()
Answers if the application is running in an Apache Tomcat server.
|
private boolean |
isServletURL(java.lang.String url)
Answers if the given URL is for a servlet vs.
|
private boolean |
isURLSecure(java.lang.String servlet)
Answers whether a given servlet name is to use SSL.
|
protected void |
log(java.lang.Exception e)
Logs an exception to the log file.
|
protected java.lang.String |
qualifyURL(BaseServlet.Context ctx,
java.lang.String url)
Fully qualifies a static HTML URL or a servlet URL based on the current
request method (GET or POST).
|
private java.lang.String |
qualifyURL(BaseServlet.Context ctx,
java.lang.String url,
boolean post)
Fully qualifies a static HTML URL or a servlet URL based on the given post
parameter flag.
|
private java.lang.String |
qualifyURL2(BaseServlet.Context ctx,
java.lang.String fullURL)
Requalifies a static HTML URL or a servlet URL based on the current
protocol.
|
private java.lang.String |
qualifyURL3(BaseServlet.Context ctx,
java.lang.String htmlURL,
boolean post)
Requalifies a static HTML URL based on the given post parameter flag.
|
protected abstract void |
readParameters(BaseServlet.Context ctx,
boolean post)
Reads the parameters passed to the servlet via the http request object.
|
protected void |
redirectURL(BaseServlet.Context ctx,
java.lang.String url)
Handles redirection for static html URLs and for servlet URLs.
|
protected void |
requestComplete(BaseServlet.Context ctx,
boolean post)
Handles completion processing for a request, such as any housekeeping
tasks that might need to be performed after all other processing for a
request has been completed.
|
protected abstract boolean |
requiresLogon(BaseServlet.Context ctx)
Answers if the servlet requires a valid non-default user in order to
continue processing.
|
protected abstract void |
resetFormFields(BaseServlet.Context ctx)
Resets the values for the html template's form fields.
|
protected abstract void |
setCookieValues(BaseServlet.Context ctx)
Adds one or more values to the http session cookies.
|
static void |
setP3PCompactPolicy(javax.servlet.http.HttpServletResponse response)
Sets the response header P3P compact policy for the given HTTP response.
|
protected abstract void |
setSessionValues(BaseServlet.Context ctx)
Adds one or more values to the http session object.
|
protected abstract void |
setTemplateData(BaseServlet.Context ctx)
Sets the various data required by the html template.
|
protected boolean |
showSiteError(BaseServlet.Context ctx)
Redirects to the site error page.
|
protected boolean |
showSiteError(BaseServlet.Context ctx,
java.lang.Exception e)
Redirects to the site error page.
|
protected boolean |
showSiteError(BaseServlet.Context ctx,
java.lang.String msg)
Redirects to the site error page.
|
private boolean |
switchProtocol(BaseServlet.Context ctx)
Determines if the current request requires the protocol to be switched
from nonsecure to secure or from secure to nonsecure.
|
protected void |
useExistingSession(BaseServlet.Context ctx)
Reinitializes the minimum required values for an existing session.
|
protected abstract void |
useExistingSessionImpl(BaseServlet.Context ctx)
Provides additional application-specific functionality for using an
existing session.
|
protected void |
writeCookie(BaseServlet.Context ctx,
java.lang.String name,
java.lang.String value)
Adds a given cookie name and value to the response header and sets the
cookie to expire based on the value for "Site.Cookie.Expires" or to a
quasi-permanent default of one year.
|
protected void |
writeCookie(BaseServlet.Context ctx,
java.lang.String name,
java.lang.String value,
int age)
Adds a given cookie name and value to the response header and sets the
cookie to expire based on the given age.
|
private void |
writePage(BaseServlet.Context ctx)
Writes (sends) a page of html via the
TemplateProcessor class. |
protected abstract void |
writePageImpl(BaseServlet.Context ctx)
Provides additional application-specific functionality for writing a page.
|
protected void |
writeTempCookie(BaseServlet.Context ctx,
java.lang.String name,
java.lang.String value)
Adds a given cookie name and value to the response header and sets the
cookie as a temporary session cookie (expires when the user closes their
web browser).
|
private void |
writeURL(BaseServlet.Context ctx)
Writes (redirects to) a URL.
|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
private static final long serialVersionUID
protected static final int BROWSER_IE
protected static final int BROWSER_NN
protected static final int BROWSER_XX
protected static final int RQST_NULL
protected static final int RQST_AJAX
protected static final int RESP_NULL
protected static final int RESP_REDIRECTED
private static java.lang.Boolean SERVER_TOMCAT
public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
doGet
in class javax.servlet.http.HttpServlet
request
- (HttpServletRequest) The servlet's incoming request.response
- (HttpServletResponse) The servlet's outgoing response.java.io.IOException
- - if an error occurs while processing the
request or response.javax.servlet.ServletException
- - if an error occurs while
processing the request or response.public void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
doPost
in class javax.servlet.http.HttpServlet
request
- (HttpServletRequest) The servlet's incoming request.response
- (HttpServletResponse) The servlet's outgoing response.java.io.IOException
- - if an error occurs while processing the
request or response.javax.servlet.ServletException
- - if an error occurs while
processing the request or response.protected void createNewSession(BaseServlet.Context ctx)
confirmSession
method.ctx
- (Context) The current servlet context.protected abstract void createNewSessionImpl(BaseServlet.Context ctx)
createNewSession
method. Subclasses
should override this method to provide application-specific processing,
such as for initializing any additional session or context values.ctx
- (Context) The current servlet context.protected void useExistingSession(BaseServlet.Context ctx)
confirmSession
method.ctx
- (Context) The current servlet context.protected abstract void useExistingSessionImpl(BaseServlet.Context ctx)
useExistingSession
method.
Subclasses should override this method to provide application-specific
processing, such as for initializing any additional session or context
values.ctx
- (Context) The current servlet context.protected int confirmSession(BaseServlet.Context ctx) throws java.io.IOException
doGet
and doPost
methods.ctx
- (Context) The current servlet context.java.io.IOException
- - if an error occurs while confirming the
session.protected void determineBrowser(BaseServlet.Context ctx) throws java.io.IOException
ctx.requestBrowser
attribute accordingly.
Invoked by the confirmSession
method. Subclasses can use the
ctx.requestBrowser
attribute to accommodate a browser's special
requirements.ctx
- (Context) The current servlet context.java.io.IOException
- - if an error occurs while determining the
browser type.protected java.lang.String getCookie(BaseServlet.Context ctx, java.lang.String name)
ctx
- (Context) The current servlet context.name
- (String) The name of the cookie to retrieve.null
if
the cookie was not found.protected java.lang.String getInvokerName(BaseServlet.Context ctx)
ctx
- (Context) The current servlet context.protected java.lang.String getInvokerName(BaseServlet.Context ctx, boolean inclSlash)
ctx
- (Context) The current servlet context.inclSlash
- (boolean) true
to include the leading slash,
otherwise false
.protected java.lang.String getInvokerParams(BaseServlet.Context ctx)
ctx
- (Context) The current servlet context.protected java.lang.String getInvokerParams(BaseServlet.Context ctx, boolean inclQmark)
ctx
- (Context) The current servlet context.inclQmark
- (boolean) true
to include the leading question
mark (when parameters exist), otherwise false
.protected java.lang.String getInvokerPath(BaseServlet.Context ctx)
ctx
- (Context) The current servlet context.protected java.lang.String getInvokerPath(BaseServlet.Context ctx, boolean inclSlash)
ctx
- (Context) The current servlet context.inclSlash
- (boolean) true
to include the leading slash,
otherwise false
.protected java.lang.String getInvokerURL(BaseServlet.Context ctx)
ctx
- (Context) The current servlet context.protected java.lang.String getPageParams(BaseServlet.Context ctx)
writePage
method. The
default implementation returns the same parameters that were used to invoke
the servlet. Subclasses should override this method if different parameters
are required, so when the form is posted, the subclass can re-determine the
various values that were orginally used to display the template.
When parameters exist, this method prefixes the parameters with a question mark (?). Any override of this method should do the same.
ctx
- (Context) The current servlet context.protected java.lang.String getPageTitle(BaseServlet.Context ctx)
writePage
method. The default implementation
retrieves the title from properties. Subclasses should override this
method if a different title is required.ctx
- (Context) The current servlet context.protected java.lang.String getRequestURL(BaseServlet.Context ctx)
ctx
- (Context) The current servlet context.protected java.lang.String getServletParams(BaseServlet.Context ctx)
ctx
- (Context) The current servlet context.protected java.lang.String getServletParams(BaseServlet.Context ctx, boolean inclQmark)
ctx
- (Context) The current servlet context.inclQmark
- (boolean) true
to include the leading question
mark (when parameters exist), otherwise false
.protected java.lang.String getServletPath(BaseServlet.Context ctx)
ctx
- (Context) The current servlet context.protected java.lang.String getServletPath(BaseServlet.Context ctx, boolean inclSlash)
ctx
- (Context) The current servlet context.inclSlash
- (boolean) true
to include the leading slash,
otherwise false
.protected java.lang.String getServletName(BaseServlet.Context ctx)
ctx
- (Context) The current servlet context.protected java.lang.String getServletName(BaseServlet.Context ctx, boolean inclSlash)
ctx
- (Context) The current servlet context.inclSlash
- (boolean) true
to include the leading slash,
otherwise false
.protected java.lang.String getServletURL(BaseServlet.Context ctx)
ctx
- (Context) The current servlet context.protected java.lang.String getServletURL(BaseServlet.Context ctx, boolean inclSlash)
ctx
- (Context) The current servlet context.inclSlash
- (boolean) true
to include the leading slash,
otherwise false
.protected java.lang.String getTemplateMessage(java.lang.String msgidsfx)
msgidsfx
- (String) The resource key suffix for the message to
retrieve. The supplied value is automatically prefixed with
"MSG." plus the invoking servlet's class name.protected java.lang.String getTemplateMessage(java.lang.String msgidsfx, java.lang.String value)
msgidsfx
- (String) The resource key suffix for the message to
retrieve. The supplied value is automatically prefixed with
"MSG." plus the invoking servlet's class name.value
- (String) The value that is to be substituted into the
message text.protected java.lang.String getTemplateMessage(java.lang.String msgidsfx, java.lang.String value1, java.lang.String value2)
msgidsfx
- (String) The resource key suffix for the message to
retrieve. The supplied value is automatically prefixed with
"MSG." plus the invoking servlet's class name.value1
- (String) The 1st value that is to be substituted into
the message text.value2
- (String) The 2nd value that is to be substituted into
the message text.protected java.lang.String getTemplateMessage(java.lang.String msgidsfx, java.lang.String value1, java.lang.String value2, java.lang.String value3)
msgidsfx
- (String) The resource key suffix for the message to
retrieve. The supplied value is automatically prefixed with
"MSG." plus the invoking servlet's class name.value1
- (String) The 1st value that is to be substituted into
the message text.value2
- (String) The 2nd value that is to be substituted into
the message text.value3
- (String) The 3rd value that is to be substituted into
the message text.protected java.lang.String getTemplateMessage(java.lang.String msgidsfx, java.lang.String value1, java.lang.String value2, java.lang.String value3, java.lang.String value4)
msgidsfx
- (String) The resource key suffix for the message to
retrieve. The supplied value is automatically prefixed with
"MSG." plus the invoking servlet's class name.value1
- (String) The 1st value that is to be substituted into
the message text.value2
- (String) The 2nd value that is to be substituted into
the message text.value3
- (String) The 3rd value that is to be substituted into
the message text.value4
- (String) The 4th value that is to be substituted into
the message text.protected org.apache.velocity.VelocityContext initTemplateData(BaseServlet.Context ctx, boolean cookies) throws java.io.IOException
ctx
- (Context) The current servlet context.cookies
- (boolean) true
if any relevant cookies are
to be written, otherwise false
.java.io.IOException
- - if an error occurs while creating and
initializing the template data.protected abstract void initTemplateDataImpl(BaseServlet.Context ctx, org.apache.velocity.VelocityContext vc, boolean cookies)
initTemplateData
method. Subclasses should override
this method to provide application-specific processing, such as for adding
any additional values to the Velocity template data or for adding to the
HTTP response header cookies.ctx
- (Context) The current servlet context.vc
- (VelocityContext) The current set of Velocity template data.cookies
- (boolean) true
if any relevant cookies are to
be written, otherwise false
.protected boolean isPrintable(BaseServlet.Context ctx)
false
. This method should be overridden by a
subclass if the subclass allows a printable version, in which case the
template name and template data are retained in the session for use in
the generic Printable
servlet.ctx
- (Context) The current servlet context.true
if the servlet allows a printable
version to be displayed.protected boolean isServerTomcat()
true
if Apache Tomcat server,
otherwise false
.private boolean isServletURL(java.lang.String url)
url
- (String) The url to check.true
if the url is for a servlet, otherwise
false
.private boolean isURLSecure(java.lang.String servlet)
servlet
- (String) The name of the servlet.true
if servlet is configured to require
SSL.protected void log(java.lang.Exception e)
e
- (Exception) The exception that is to be logged.protected java.lang.String qualifyURL(BaseServlet.Context ctx, java.lang.String url)
ctx
- (Context) The current servlet context.url
- (String) The URL to qualify.private java.lang.String qualifyURL(BaseServlet.Context ctx, java.lang.String url, boolean post)
ctx
- (Context) The current servlet context.url
- (String) The URL to qualify.post
- (boolean) true
if the qualifying is to be based
on a POST request, otherwise false
if the qualifying is
to be based on a GET request.private java.lang.String qualifyURL2(BaseServlet.Context ctx, java.lang.String fullURL)
qualifyURL
or
qualifyURL3
.
The qualifying in this method is used during a POST request (vs. GET) to avoid the "you are about to be redirected to a connection that is not secure" message. The correct protocol for the request will be determined during the goGet() cycle and, if any redirection is needed due to protocol differences, the redirection will be done at that time.
ctx
- (Context) The current servlet context.fullURL
- (String) The URL to requalify. Must include protocol,
host, port and path.private java.lang.String qualifyURL3(BaseServlet.Context ctx, java.lang.String htmlURL, boolean post)
qualifyURL
.
The qualifying in this method is used during a POST request (vs. GET) to avoid the "you are about to be redirected to a connection that is not secure" message. The correct protocol for the request will be determined during the goGet() cycle and, if any redirection is needed due to protocol differences, the redirection will be done at that time.
ctx
- (Context) The current servlet context.htmlURL
- (String) The html URL to requalify.protected void redirectURL(BaseServlet.Context ctx, java.lang.String url) throws java.io.IOException
ctx
- (Context) The current servlet context.url
- (String) The URL to redirect.java.io.IOException
- - if an error occurs while processing the
URL redirection.protected void requestComplete(BaseServlet.Context ctx, boolean post)
doGet
and doPost
as the very last action to be performed for each and every request, even
if exceptions are thrown during the request's processing.
This implemention does nothing. Subclasses should override this method to provide any application-specific handling. The override code should catch and respond to any possible exceptions that might occur while the override code is being processed (i.e. write to log, etc.). Note that at this point in the processing, it is too late to redirect to an error page or other destination.
ctx
- (Context) The current servlet context.post
- (boolean) true
if the activity occurred during
a POST operation, otherwise false
.protected abstract boolean requiresLogon(BaseServlet.Context ctx)
ctx
- (Context) The current servlet context.true
if the servlet requires a non-default
user, otherwise false
.public static void setP3PCompactPolicy(javax.servlet.http.HttpServletResponse response)
response
- (HttpServletResponse) A servlet's outgoing response.protected boolean showSiteError(BaseServlet.Context ctx)
responseFlag
variable to RESP_REDIRECTED
.ctx
- (Context) The current servlet context.false
.protected boolean showSiteError(BaseServlet.Context ctx, java.lang.String msg)
responseFlag
variable to RESP_REDIRECTED
.ctx
- (Context) The current servlet context.msg
- (String) The message text to log.false
.protected boolean showSiteError(BaseServlet.Context ctx, java.lang.Exception e)
responseFlag
variable to RESP_REDIRECTED
.ctx
- (Context) The current servlet context.e
- (Exception) The exception to log.false
.private boolean switchProtocol(BaseServlet.Context ctx) throws java.io.IOException
doGet
method.ctx
- (Context) The current servlet context.true
if switching the protocol is necessary
and the user has been redirected, otherwise false
.java.io.IOException
- - if an error occurs while processing the
current request.protected void writeCookie(BaseServlet.Context ctx, java.lang.String name, java.lang.String value) throws java.io.IOException
setCookieValues
method.ctx
- (Context) The current servlet context.name
- (String) The name by which the cookies will be referred.value
- (String) The value associated with the cookie.java.io.IOException
- - if an error occurs when adding the
cookie to the response header.protected void writeCookie(BaseServlet.Context ctx, java.lang.String name, java.lang.String value, int age) throws java.io.IOException
ctx
- (Context) The current servlet context.name
- (String) The name by which the cookies will be referred.value
- (String) The value associated with the cookie.age
- (int) The number of seconds after which the cookie will
expire. A negative age indicates the cookie is a temporary
cookie (expires when the user closes their web browser). A
zero age indicates the cookie is to be deleted.java.io.IOException
- - if an error occurs when adding the
cookie to the response header.protected void writeTempCookie(BaseServlet.Context ctx, java.lang.String name, java.lang.String value) throws java.io.IOException
ctx
- (Context) The current servlet context.name
- (String) The name by which the cookies will be referred.value
- (String) Then value associated with the cookie.java.io.IOException
- - if an error occurs when adding the
cookie to the response header.private void writePage(BaseServlet.Context ctx) throws java.io.IOException
TemplateProcessor
class.
Invoked by the doGet
and doPost
methods.ctx
- (Context) The current servlet context.java.io.IOException
- - if an error occurs while processing the
html template.protected abstract void writePageImpl(BaseServlet.Context ctx)
writePage
method. Subclasses should override this
method to provide application-specific processing.ctx
- (Context) The current servlet context.private void writeURL(BaseServlet.Context ctx) throws java.io.IOException
doPost
method.ctx
- (Context) The current servlet context.java.io.IOException
- - if an error occurs while processing the
URL redirection.protected abstract boolean editFormFields(BaseServlet.Context ctx)
doPost
method. Subclasses must override this
method to provide support for the editing of specific form fields.ctx
- (Context) The current servlet context.true
if all the edits are successful,
otherwise false
.protected abstract java.lang.String getNextURL(BaseServlet.Context ctx)
writeURL
method. Subclasses must override this
method to provide a specific URL for processing.ctx
- (Context) The current servlet context.protected abstract java.lang.String getTemplateName(BaseServlet.Context ctx)
writePage
method. Subclasses must override this
method to provide the name of a specific html template to process.ctx
- (Context) The current servlet context.protected abstract void readParameters(BaseServlet.Context ctx, boolean post)
doGet
and doPost
method. Subclasses must
override this method to provide support for the retrieval of specific
request parameters.ctx
- (Context) The current servlet context.post
- (boolean) true
if the method is invoked from
doPost
, otherwise false
.protected abstract void resetFormFields(BaseServlet.Context ctx)
doGet
and doPost
methods. Subclasses must
override this method to provide support for specific form fields.ctx
- (Context) The current servlet context.protected abstract void setCookieValues(BaseServlet.Context ctx) throws java.io.IOException
writeURL
method. Subclasses must override this
method to provide support for writing specific cookie values. Calls
should be made to writeCookie
for each cookie that needs to be
set.ctx
- (Context) The current servlet context.java.io.IOException
- - if an error occurs when adding the
cookie to the response header.protected abstract void setSessionValues(BaseServlet.Context ctx)
writeURL
method. Subclasses must override this
method to provide support for specific session values.ctx
- (Context) The current servlet context.protected abstract void setTemplateData(BaseServlet.Context ctx)
writePage
method. Subclasses must override this
method to provide support for specific html template data.ctx
- (Context) The current servlet context.protected BaseServlet.Context createContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
doPost
and doGet
methods.request
- (HttpServletRequest) The servlet's incoming request.response
- (HttpServletResponse) The servlet's outgoing response.