package example.bulk1;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.bentofw.bulkemail.*;
import com.bentofw.sql.*;
import com.bentofw.util.*;
/**
* @author Jun Inamori
*/
public class Queue extends HttpServlet{
private static PooledPS ps;
private static BulkEmailSender sender;
public void init()
throws ServletException{
try{
ps=PooledPS.getInstance();
sender=BulkEmailSender.getInstance();
sender.prepare();
}
catch(Exception ex){
ex.printStackTrace();
throw new ServletException(ex);
}
}
public void destroy(){
try{
sender.stopBgThread();
}
catch(Exception ex){
ex.printStackTrace();
}
// Do this at the very last!
// Required only if you use PooledStatement
PooledPS.closeIfOpen();
}
private static final String DONE="done.html";
private static final String MISSING="missing.html";
private static final String LONG="long.html";
private static final String NOT_STARTED="not_started.html";
private static final String GOING_TO_STOP="going_to_stop.html";
private static final String SAVE_NOT_STARTED="save_not_started.html";
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException,IOException{
String subject=req.getParameter("subject").trim();
String from_ad=req.getParameter("from_ad").trim();
String from_na=req.getParameter("from_na").trim();
String cset4email=req.getParameter("cset4email").trim();
String message=req.getParameter("message").trim();
// If any of the parameters is empty ...
if((subject.length() * from_ad.length() *
from_na.length() * cset4email.length() *
message.length())==0){
(req.getRequestDispatcher(MISSING)).forward(req,res);
return;
}
if(message.length()>1000){
(req.getRequestDispatcher(LONG)).forward(req,res);
return;
}
PreparedStatement st=null;
ResultSet set=null;
List
|
Copyright © 1997-2007 OOP-Research CorporationTM, All Rights Reserved.