public abstract class HiWishAction
extends org.apache.struts.actions.DispatchAction
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ID
CVS ID
|
protected static java.util.logging.Logger |
logger
Logger instance
|
Constructor and Description |
---|
HiWishAction() |
Modifier and Type | Method and Description |
---|---|
void |
closeConnection(java.sql.Connection conn)
Close a connection safely.
|
java.lang.String |
generateSecureToken(javax.servlet.http.HttpServletRequest req)
The generateToken method of the base Struts action class, as implemented
in 1.3.8, returns an MD5 on the current time.
|
java.sql.Connection |
getConnection(java.lang.String host)
Obtain a new database connection.
|
java.lang.String |
getContextURL(javax.servlet.http.HttpServletRequest req)
Get the URL for a request ending with the application context path.
|
java.lang.String |
getContextVariable(java.lang.String key,
java.lang.String host) |
javax.mail.Session |
getMailSession()
Obtain a Mail session
|
int |
getWishQuota()
Load the value of the wish quota from the configuration
|
void |
memorizeUser(java.lang.String digest,
User user)
Cache a user.
|
User |
rememberUser(java.lang.String digest)
Lookup a user using the digested password.
|
protected org.apache.struts.action.ActionMessages |
sendEmail(java.lang.String recipient,
java.lang.String subject,
java.lang.String content)
Send an email and handle errors by returning appropriate ActionMessages
|
java.lang.String |
sha1hex(java.lang.String... inputs)
Digests Strings and returns the SHA1 hash as hex.
|
cancelled, dispatchMethod, execute, getMethod, getMethodName, getParameter, unspecified
addErrors, addMessages, execute, generateToken, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
public static final java.lang.String ID
protected static java.util.logging.Logger logger
public User rememberUser(java.lang.String digest)
digest
- The digested passwordpublic void memorizeUser(java.lang.String digest, User user)
digest
- The digested password (key)user
- User object (value)public java.sql.Connection getConnection(java.lang.String host) throws java.sql.SQLException, javax.naming.NamingException
host
- server namejava.sql.SQLException
- Could not create new connectionjavax.naming.NamingException
- Could not locate JNDI referencepublic java.lang.String getContextVariable(java.lang.String key, java.lang.String host) throws javax.naming.NamingException
javax.naming.NamingException
public void closeConnection(java.sql.Connection conn)
conn
- JDBC connection (not necessarily open)public javax.mail.Session getMailSession() throws javax.naming.NamingException
javax.naming.NamingException
- Could not locate JNDI referencepublic java.lang.String sha1hex(java.lang.String... inputs) throws java.security.NoSuchAlgorithmException
inputs
- One or more Strings to digestjava.security.NoSuchAlgorithmException
- Could not find algorithmpublic java.lang.String generateSecureToken(javax.servlet.http.HttpServletRequest req) throws java.security.NoSuchAlgorithmException
req
- The requestjava.security.NoSuchAlgorithmException
- AlGore didn't invent it yetpublic java.lang.String getContextURL(javax.servlet.http.HttpServletRequest req)
req
- The requestpublic int getWishQuota()
protected org.apache.struts.action.ActionMessages sendEmail(java.lang.String recipient, java.lang.String subject, java.lang.String content) throws javax.naming.NamingException
recipient
- The email address to send the confirmation tosubject
- The subject of the email messagecontent
- The body of the email, which should include a confirmation linkjavax.naming.NamingException
Copyright \ (C) Arizona Board of Regents on behalf of the \ Planetary Image Research Laboratory, Lunar and \ Planetary Laboratory at the University of Arizona