1.Tomcat startup, start a socket
<listener>
<listener-class>com..socket.SocketServerListener</listener-class>
</listener>
extends ServletContextListener
call SocketThread.start()
2. do {
appCallID = new Random().nextInt(10000);
manager = MessageManager.getInstance();
if (manager.isContext(String.valueOf(appCallID))) {
} else {
break;
}
} while (true);
3.LinkedBlockingQueue<Object> standQueue
ConcurrentHashMap<String, Object> sendQueue
ScheduledExecutorService executor = Executors.newScheduledThreadPool(2)
executor.execute(new MsgSender())
executor.scheduleAtFixedRate(new MsgChecker(), 0, 1000/1000, TimeUnit.SECONDS)
4.document.open(url or requstPath,'newWin','toolbar=0,location=0,direct=0,menubar=0,scrollbars=1, width=300px,height=150px,top=270px,left=350px');
window.opener.location.reload();
if(window.opener && !window.opener.closed)
window.opener.location.href=window.opener.location.href; window.close();
requstPath="<%=basePath%>businessManage.do?method=addUser&parentId="
+encodeURIComponent(parentNode.id);
5. <form name=loginForm action="" method=post>
<div><span id=usernamediv>UserName</span>
<input id=username style="width:110px" name=username></div>
6. init spring while tomcat start
SpringUtil.getInstance().setContext(
WebApplicationContextUtils.getWebApplicationContext(arg0.getServletContext()));
<bean id="config"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:config.properties" />
</bean>