about jetty dependencies - #5
mathieucarbou wants to merge 58 commits into
Conversation
…hich can be used either as a logging system or as a wrapper for another logging system. This is the best way to decouple a library which uses logging. See http://blog.mycila.com/2011/01/jdk-logging-per-webapp.html for using JDK logging per webapp.
…ixe dependency scope for jetty - as the jetty http client is required for JRE extension whereas the core module does not need it
- introduced transport adapter - renamed XHRTransport to JettyXHRTransport - renamed WebcoketTransport to JettyWebscketTransport - extracted utility method extractSessionId(request) to utility class
…nt logging NPEs in warning in the catch clause
|
I've deployed cometd (which uses jetty continuations) into Tomcat 6.0.27. Because Tomcat 6 doesn't support Servlet 3.0 ContinuationsSupport returns an instance of the FauxContinuation which isn't asynchronous. I don't remember which jetty jars I had to include to make it work. Now that I've had a chance to take a brief look at Atmosphere, I'm wondering if it wouldn't make more sense to just add Socket.IO support to Atmosphere instead of rolling our own multi-container support. Is there something about Atmosphere that would preclude it from use? |
|
Hi, I was wondering how you deploy your webapp. I think we do not deploy them as you do. In our war file, we only have socket-io-java: we do not have any jetty jar. By reading you, i understand that you have in your war file socket-io-java + jetty-websocket + jetty-continuations + some other libraries ? Is it true ? Thanks, Mathieu. |
|
Regarding deployment of Socket.IO-Java, in a jetty container only the socketio-java jar is needed in the war. In a non-jetty servlet 3.0 container, some jetty jars are needed in the war file. Continuations can also be used in a non-jetty, non-servlet 3.0 container, but it will consume one thread poer request (clearly non-optimal). The only live deployment of Socket.IO-Java I have experience with is in the Wave in a Box project where jetty is embedded in the application, so deployment is programatic. However, CometD also uses jetty continuations and I have deployed that into Tomcat 6.0.27. If you want to support Socket.IO in many servlet containers then the question that needs to be answered is: Do you want to support non-jetty, non-servlet 3.0 containers. If you do, then taking advantage of the work already done in Atmosphere seems logical. I see no reason to re-invent the wheel. If Atmosphere doesn't allow use of just the core async/websocket API overlay piece, then perhaps a patch to that project would be better. |
|
Hi, |
|
Ah, I'd forgotten about that class. The only reason I created that class was because I didn't like the idea of setting maxidletime to 0 for the SelectChannelConnector. You can see the details of the problem here: http://code.google.com/p/socketio-java/issues/detail?id=1 The xhr-multipart and htmlfile transports are not jetty specific, but they do currently use the ConnectionTimeoutPreventer. The best thing to do would be to modify that class so that in the case of a non-embedded deployment, it returns a fake/dummy IdleCheck instance. |
|
Ok. So you can take the new implementation i've made: it uses reflection to reduce the number of exclusions to add to the jetty context file. Only the HttpConnection class is needed. Just another question: we've seen today that on android 2.1 and 2.2 socket-io switches to xhr-polling. I was wondering why it does not use instead xhr-multipart. Also, when you say that xhr-multipart and htmlfile are not jetty specific, it is also the case for the others, except for websocket, isn't it ? |
… frameworks or IOC frameworks are rewriting URLs when we issue a request.getPathInfo() so <transport>//<id> is transformed in <transport>/<id> and the prsing to get the session id fails
|
Tad, As I see it, there are four major implementations forks now. 1) code.google project 2) your github repo 3) mathieu's fork 4) scalatra fork (scalatra is a rapidly growing new web framework). I am looking at creating a grails plugin for socket.io. I was hoping to include the socketio-java project as a dependency. Right now, I have the following concerns:
At this point i'm likely going to base my new project off of meathieu's fork, as it seems to be maintained unlike yours. |
|
Hi, Socket.IO Java from Tad is initially a Java port used in Apache Wave I think, but it is stuck to an old version of the Socket.IO javascript library and they used to deploy it in an application starting an embedded Jetty. So they do not had separate classloaders. I tried to refactor this so that it can work better in a standard jetty container, plus also being able to support much more servers and also I wanted to upgrade the Javascript library. But we stopped the efforts on Socket.IO because of several issues we had:
We first chose it because it supported WebSocket, but from now, CometD, which is a far more reliable solution, also supports WebSockets since version 2 (release at the beginning of this year). So we moved our efforts and we contribute much more to the CometD library which meets our requirements: reverse-ajax on desktop and mobile on all browsers. Also CometD supports less transports (mainly http long polling and websockets) because the other ones have some flaws. I.e. HTTP Streaming is subject to buffering issues which can cause some high latency. |
|
I created this project initially as a quick and dirty way to get Wave to work in browsers that didn't have native support of WebSockets. I had initially considered using CometD but chose to to create this instead because it would result in the smallest modification to the Wave code. I now regret that decision. I recommend that you look at the CometD and Atmosphere projects instead. They have broader support and usage (much more int he case of CometD). |
UTF8 fix in XHR transport
tiny fix of constant assigment
I began to remove the jetty dependencies. Jetty by default uses this include/excludes:
so in the case of socketio-core, it should only use continuations and websocket classes.
I removed dependencies to jetty Log class (see the commit message) plus dependencies to jetty utilities (IO, JSON, ...).
IMPORTANT:
In the next commits, I will refactor to extract the jetty-related transports in extension module and add to the socket io servlet the ability to load transports dynamically. This way, the socket IO core will be able to work in any container.
Currently socketio-core is binded to jetty transport but after we will be able to add in the webapp classpath:
socketio-core.jar
socketio-jetty-websocket.jar
socketio-jetty-continuation.jar
socketio-grizzly.jar
[...]
The socketio servlet will be able to discover available transports and load them as necessary regarding the container we are into.
If you know Atmosphere from J-F Arcand, it will be able to do what Atmosphere currently does.
Mat'