Websocket study notes
1. websocket tomcat build
a) eclipse tomcat8 puglin setup
(1) download elipse wtp toolsinstall package( now last version is 3.6) and unzip to eclipse_home ,thenreboot eclipse; if invalid, you canrestart eclipse add parameter is –clean for eclise reload puglins;
lol copy(hasimage to make sure)
(2) in my machine, when done setp 1, it can createtomcat8 server,but add tomcat 8 server runtime environment for eclipse projectis not success. So I modify tomcat config to do it. Frist copy tomcat 8 installnamed tomcat 8 to tomcat 7 directory. And then modify tomcat config in tomcat 8to tomcat 7 /lib/ catalina.jar . I user zip tools(Chinese tools named haozip ), replasce catalina.jar!/org/apache/catalina/util/ServerInfo.properties version 8 to 7 ; like this
And then save it. ThenAdd eclipse server runtime environment for this.
So we can add eclipse project server Runtime Lib withtomcat 8;
ref : http://stackoverflow.com/questions/17868232/how-to-use-tomcat-8-in-eclipse
wtp website : http://download.eclipse.org/webtools/downloads/
b) add tomcat example to websocket-tomcat8project
like this;
All java filecopy form tomcat8_home/webapp/examples/WEB0-INFO/classes;
Notices: now ifyou find your project has error, some class lose. You can include juli in yourpom file.
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>juli</artifactId>
<version>6.0.39</version>
</dependency>
c) Then create tomcat 8 server andadd preoject into it; start it;then open tomcat_home/ \webapps\examples\websocket/echo.xhtmluse chrome;
Now start yourtravel in websocket world.
Remark:
(1) Do not includejavax.websocke.api if you have tomcat included!
in your websocket project doesn’t includejavax.websocke.api jar. It’s maven dependency like this:
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.0</version>
</dependency>
Actually tomcat-websocket jar dependency it, soyou don’t include it;
(2) tomcat 8 websocket introductionin office website :
http://tomcat.apache.org/tomcat-8.0-doc/web-socket-howto.html
and other userful information list:
Tomcat 8 Examples: Missing Configuration Step
http://stackoverflow.com/questions/20723818/tomcat-8-examples-missing-configuration-step
Deploying WebSocket on tyrus server
https://tyrus.java.net/documentation/1.3.3/index/deployment.html