public class ServletUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ServletUtils.DebugLevels
The DebugLevel sets the verbosity of the logger, which is by default stored in catalina.out.
|
Constructor and Description |
---|
ServletUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isDataModeDb() |
static boolean |
isDataModeEmail() |
static boolean |
isDataModeLog() |
static void |
log(java.lang.String o,
ServletUtils.DebugLevels level)
Convenience method for printing statements.
|
protected static boolean |
mailReady()
Simple check to make sure mail is ready to be sent.
|
static void |
sendMail(java.lang.String to,
java.lang.String subject,
java.lang.String body)
Allows an email to be sent using the preset authentication patterns.
|
static void |
setCredentials(java.lang.String user,
java.lang.String pass,
java.lang.String sender,
java.lang.String smtpAuth,
java.lang.String smtpHost,
java.lang.String smtpPort)
Sets the mail credentials for this servlet, which allows it to send email notifications.
|
static void |
setDataModeDb(boolean dataMode_db) |
static void |
setDataModeEmail(boolean dataMode_email) |
static void |
setDataModeLog(boolean dataMode_log) |
static void |
setDebug(ServletUtils.DebugLevels debug)
Sets DebugLevel
|
public static boolean isDataModeDb()
public static void setDataModeDb(boolean dataMode_db)
dataMode_db
- the dataMode_db to setpublic static boolean isDataModeEmail()
public static void setDataModeEmail(boolean dataMode_email)
dataMode_email
- the dataMode_email to setpublic static boolean isDataModeLog()
public static void setDataModeLog(boolean dataMode_log)
dataMode_log
- the dataMode_log to setpublic static void setCredentials(java.lang.String user, java.lang.String pass, java.lang.String sender, java.lang.String smtpAuth, java.lang.String smtpHost, java.lang.String smtpPort)
user
- the user name, e.g., iagopass
- the password, e.g., myPassword99sender
- the sender, required for some email systems, e.g., iago@website.comsmtpAuth
- if the mail server uses smtp authentication (usually true, occasionally false)smtpHost
- the smtp host, e.g., exchange.website.comsmtpPort
- the smtp port, e.g., 25public static void sendMail(java.lang.String to, java.lang.String subject, java.lang.String body) throws java.io.IOException, java.lang.Exception
to
- subject
- body
- java.io.IOException
AddressException
java.lang.Exception
public static void log(java.lang.String o, ServletUtils.DebugLevels level)
o
- public static void setDebug(ServletUtils.DebugLevels debug)
debug
- ERROR, WARN, SILENCED, DEBUGprotected static boolean mailReady()