ServletRequestListener在weblogic8 jdk1.4 下不执行
public class SessionListener implements ServletRequestListener, HttpSessionListener {
private HttpServletRequest request;
public void requestInitialized(ServletRequestEvent event) {
// TODO Auto-generated method stub
request=(HttpServletRequest)event.getServletRequest();
}
public void sessionCreated(HttpSessionEvent event) {
// TODO Auto-generated method stub
//HttpServletRequest request=event
Map session_map=new HashMap();
HttpSession session_new=event.getSession();
String ipadr=(String)request.getRemoteAddr();
if(ipadr!=null&&ipadr.length()!=0){
System.out.println("ipadr====="+ipadr);
HttpSession session_old=(HttpSession)session_map.get(ipadr);
if(session_old!=null){
System.out.println(session_old.getId()+"----");
session_old.invalidate();
}
session_map.put(ipadr, session_new);
}
}
public void sessionDestroyed(HttpSessionEvent arg0) {
// TODO Auto-generated method stub
}
public void requestDestroyed(ServletRequestEvent arg0) {
// TODO Auto-generated method stub
}
}
web.xml中已经配置好了
sessionCreated方法可以取到session,执行无误
但是requestInitialized方法 不执行 --------------------编程问答-------------------- 打个 log,看看在 tomcat 下执行不
补充:Java , Web 开发