public abstract class Servlet extends HttpServlet
ServletHelpers,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
class |
Servlet.ThisPage
This class is placed here so that the programmer can subclass either
Servlet.ThisPage or bradleyross.library.servlets.ThisPage.
|
| Constructor and Description |
|---|
Servlet()
Inserted for debugging;
|
| Modifier and Type | Method and Description |
|---|---|
protected Date |
buildDate(int year,
int month,
int day)
Construct an SQL date using the year, month, and day
|
protected Date |
buildDate(String yearValue,
String monthValue,
String dayValue)
Construct an SQL date using the year, month, and day
|
static String |
buildEscapeDate(Date date)
Generate an SQL escape date.
|
static String |
buildEscapeDate(int year,
int month,
int day)
Build a date in the java.sql.Date escape format.
|
static String |
buildEscapeDate(int year,
int month,
int day,
String defaultDate)
Build a date in the java.sql.Date escape format.
|
static String |
buildEscapeDate(String year,
String month,
String day)
Build a date in the java.sql.Date escape format.
|
static String |
buildEscapeDate(String year,
String month,
String day,
String defaultDate)
Build a date in the java.sql.Date escape format.
|
void |
ender(Servlet.ThisPage thisPage)
Processing after calling processor method.
|
ServletConfig |
getConfig()
Obtains servlet configuration information.
|
static String |
getString(ResultSet rs,
String name)
Returns the string for a non-breaking space if a string
column in a table is null or blank, otherwise returns an
escaped string.
|
static String |
getTextareaValue(ResultSet rs,
String name)
Obtains a value from a result set for use as the starting value of a
Textarea element.
|
static String |
getTextValue(ResultSet rs,
String name)
Obtains a value from a result set for use as the value attribute of a
input element of type text.
|
void |
init(ServletConfig configValue)
Called when initializing the object for handling HTTP
transactions.
|
protected static void |
innerTest(String value)
Internal debugging aid for checking parseEscapeDate.
|
protected void |
loadChar(PreparedStatement stmt,
int location,
String value)
Utility method for setting parameters in Prepared Statements.
|
protected void |
loadVarchar(PreparedStatement stmt,
int location,
String value)
Utility method for setting parameters in Prepared Statements.
|
static void |
main(String[] args)
This was inserted for testing of some of the internal static methods
and is only for debugging purposes.
|
static String |
matchValues(String value1,
String value2)
Utility to aid in creating option lists for pull-down
menus.
|
static String[] |
parseEscapeDate(String escapeDate)
Break a java.sql.Date escape format date into a set of
string objects for the year, month, and day portions.
|
protected abstract void |
processor(Servlet.ThisPage thisPage)
Class specific processing for this class.
|
void |
service(HttpServletRequest requestValue,
HttpServletResponse responseValue)
Carries out processing for a HTTP transaction.
|
protected void |
setDateRange(Servlet.ThisPage instance)
Obtain date range from HTTP request.
|
void |
starter(Servlet.ThisPage thisPage)
Processing before calling processor method.
|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, servicedestroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, logpublic Servlet()
public void init(ServletConfig configValue) throws ServletException
init in interface Servletinit in class GenericServletconfigValue - Servlet configuration objectServletException - when problems with servlet arisepublic ServletConfig getConfig()
public void service(HttpServletRequest requestValue, HttpServletResponse responseValue) throws IOException
service in class HttpServletrequestValue - Request objectresponseValue - Response objectIOException - for io problemsstarter(ThisPage),
processor(ThisPage),
ender(ThisPage)public void starter(Servlet.ThisPage thisPage) throws IOException
This method can be overridden in subclasses to provide a class that carries out the desired operation for a group of classes.
thisPage - Information on this HTTP transactionIOException - for io problemsprocessor(ThisPage)public void ender(Servlet.ThisPage thisPage) throws IOException
This method can be overridden in subclasses to provide a class that carries out the desired operation for a group of classes.
thisPage - Information on this HTTP transactionIOException - for io problemsprocessor(ThisPage)protected abstract void processor(Servlet.ThisPage thisPage) throws IOException
thisPage - Information on this HTTP transactionIOException - for io problemsprotected Date buildDate(String yearValue, String monthValue, String dayValue)
yearValue - Year (4 digit)monthValue - Number of Month (January = 1)dayValue - Day of monthprotected Date buildDate(int year, int month, int day)
year - Year (4 digit)month - Number of month (January = 1)day - Day of monthprotected void setDateRange(Servlet.ThisPage instance)
instance - Object containing information for this HTTP requestDatepublic static String buildEscapeDate(int year, int month, int day) throws IOException
year - Year as an integermonth - Month as an integer from 1 to 12day - Day of month as an integer from 1 to 31IOException - for io problemsIt appears that SQL Server is unable to handle dates before the
year 1900.
public static String buildEscapeDate(String year, String month, String day) throws IOException
year - String containing the year as an integermonth - String containing the month as an integer from 1 to 12day - String containing the day of month as an integer from 1 to 31IOException - for io problemsDate.toString()public static String buildEscapeDate(Date date)
date - SQL datepublic static String buildEscapeDate(int year, int month, int day, String defaultDate) throws IOException
year - Year as an integermonth - Month as an integer from 1 to 12day - Day of month as an integer from 1 to 31defaultDate - Date to use if error in processingIOException - for io problemsIt appears that SQL Server is unable to handle dates before the
year 1900.
public static String buildEscapeDate(String year, String month, String day, String defaultDate) throws IOException
year - String containing the year as an integermonth - String containing the month as an integer from 1 to 12day - String containing the day of month as an integer from 1 to 31defaultDate - Date to use if error in processingIOException - for io problemsDate.toString()public static String[] parseEscapeDate(String escapeDate)
escapeDate - Date to be parsedDate.toString()protected void loadChar(PreparedStatement stmt, int location, String value) throws SQLException
For CHAR data types.
stmt - PreparedStatement objectlocation - Number of parametervalue - Value to be loaded in parameterSQLException - if problems in SQL statementprotected void loadVarchar(PreparedStatement stmt, int location, String value) throws SQLException, IOException
For VARCHAR data types.
stmt - PreparedStatement objectlocation - Number of parametervalue - Value to be loaded in parameterSQLException - for SQL problemsIOException - for io problemspublic static String matchValues(String value1, String value2)
value1 - First string to be comparedvalue2 - Second string to be comparedpublic static String getTextValue(ResultSet rs, String name)
rs - Result setname - Name of column in result setpublic static String getTextareaValue(ResultSet rs, String name)
rs - Result setname - Name of column in result setStringHelpers.escapeHTML(String, String)public static String getString(ResultSet rs, String name)
rs - Result set containing valuename - Name of columnprotected static void innerTest(String value)
value - String to be parsedparseEscapeDate(String)Copyright © 2017. All rights reserved.