日期:2014-05-17 浏览次数:20723 次
public class Ajax {
public ServletContext getServletContext(){
return getWebContext().getServletContext();
}
public HttpSession getSession(){
WebContext context = WebContextFactory.get();
return context.getSession();
}
public WebContext getWebContext(){
return WebContextFactory.get();
}
}
public class CTIListenerAjax extends Ajax{
private Log logMsg = LogFactory.getLogger(CTIListenerAjax.class);
public void ctiListener(){
String empCode =(String)this.getSession().getAttribute("EMPCODE");
ServerUserThread sut = new ServerUserThread();
sut.setSc(this.getServletContext());
sut.setEmpCode(empCode);
sut.setWc(this.getWebContext());
Thread thread = new Thread(sut);
thread.start();
}
}
public class ServerUserThread implements Runnable {
private ServletContext sc ;
private String empCode;
private WebContext wc ;
private boolean tStatus=true;
public ServletContext getSc() {
return sc;
}
public void setSc(ServletContext sc) {
this.sc = sc;
}
public String getEmpCode() {
return empCode;
}
public void setEmpCode(String empCode) {
this.empCode = empCode;
}
public WebContext getWc() {
return wc;
}
public void setWc(WebContext wc) {
this.wc = wc;
}
public void run() {
try {
while(tStatus){
CTIManager ctiM = new CTIManager(sc);
CTIUserInfo ctiUser = ctiM.getCTIUserInfo(empCode);
CTIClient ctiClient = new CTIClient();
ctiClient.setCtiUser(ctiUser);
String result = ctiClient.getCTIMsg(empCode);
如何返回信息
}
} catch (Exception e) {
e.printStackTrace();
}
}
public boolean isTStatus() {
return tStatus;
}
public void setTStatus(boolean status) {
tStatus = status;
}
}