public class EmailForm
extends javax.servlet.http.HttpServlet
| Modifier and Type | Field and Description |
|---|---|
private static long |
serialVersionUID
The class' serialization version id.
|
| Constructor and Description |
|---|
EmailForm() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doForm(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Processes the form.
|
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 java.lang.String |
getString(java.lang.String type,
java.lang.String key)
Returns a
String value for the given properties key. |
protected java.lang.String[] |
getStringArray(java.lang.String type,
java.lang.String key,
java.lang.String delim)
Returns a
String array for the given properties key. |
protected void |
sendError(javax.servlet.http.HttpServletResponse response,
java.lang.String errcode)
Sends an error page to the user because the form cannot be processed.
|
protected boolean |
sendMail(java.lang.String type,
java.io.File template,
org.apache.velocity.VelocityContext data)
Creates and sends a form's data to the form type's configured recipient.
|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, serviceprivate static final long serialVersionUID
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.HttpServletrequest - (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.HttpServletrequest - (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 doForm(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.io.IOException,
javax.servlet.ServletException
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 boolean sendMail(java.lang.String type,
java.io.File template,
org.apache.velocity.VelocityContext data)
type - (String) The type of form being processed.template - (File) The email template to use for the email.data - (VelocityContext) The variable data to merge into the
template.true if the email is successfully sent,
otherwise false.protected void sendError(javax.servlet.http.HttpServletResponse response,
java.lang.String errcode)
throws java.io.IOException
response - (HttpServletResponse) The servlet's outgoing response.errcode - (String) The error code to show on the error page.java.io.IOException - - if an error occurs while processing the
request or response.protected java.lang.String getString(java.lang.String type,
java.lang.String key)
String value for the given properties key.type - (String) The form type for the desired property value.key - (String) The key for the desired property value.protected java.lang.String[] getStringArray(java.lang.String type,
java.lang.String key,
java.lang.String delim)
String array for the given properties key.type - (String) The form type for the desired property value.key - (String) The key for the desired property value.delim - (String) The delimiter to be used for the parsing.