Hi,
after installing Tomcat, I had a look on the installed examples.
There was a websocket example, a simple chat.
I tried to implement it on my GWT project but I couldnt get it working.
Thats what I did:
1) I copied classes from the example into my gwt server directory:
ChatWebSocketServlet.java (extends WebSocketServlet)
HTMLfilter(does nothing special)
2) Include missing jars into my build path (tomcat-coyote.jar , catalina, tomcat-juli.jar, tomcat-util.jar)
3) Added the following to my web.xml:
<servlet>
<servlet-name>wsChat</servlet-name>
<servlet-class>de.mash.project.server.ChatWebSocketServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>wsChat</servlet-name>
<url-pattern>/Mash</url-pattern>
</servlet-mapping>
4) Implemented the JS-Code from here to my html page.
I changed the following to fit my needs:
Changed
Chat.connect('ws://' + window.location.host + '/examples/websocket/chat');
to
Chat.connect('ws://' + window.location.host + '/Mash');
in the JS Code.
The problem is, that the connect()-Method doesnt work, and I cant get a socket (I end up in the JS Chat.onerror()-Method).
Im still using the Build-In Jetty for debugging, so I dont got any meaningful error so far.
The one I get from Console is mentioned below. (But its jetty, so Iam not expecting it to work).
I Debuged as Webapp (on external Server):
Then I choose my projects war-folder in apache webapp folder: But didnt got any errormsg in my console log.
Is this the proper way to use tomcat for debugging?
So...
Iam not sure if there is a misstake in my web.xml, a bad connection string on the connect()-Method,
or if Iam totally wrong and its not that easy to get it running...
Any advice, help, suggestions are appreciated.
Regards,
Manuel
ERROR from Jetty: Iam not wondering about this one, since I want to use Tomcat Websockets...
[ERROR] 500 - GET /Mash (127.0.0.1) 1542 bytes
Request headers
Host: 127.0.0.1:8888
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Sec-WebSocket-Version: 13
Origin: http://127.0.0.1:8888
Sec-WebSocket-Key: ic3d8jm1KWVV8XUqReWg/w==
Connection: keep-alive, Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Response headers
Upgrade: websocket
Connection: upgrade
Sec-WebSocket-Accept: SqklYoNaQUziMNdrvFxooUEH9nA=
Content-Type: text/html; charset=iso-8859-1
Content-Length: 1542
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment