Hi Jaime, > Since the "Restlet vs Servlet" topic was touched, please let me > include a related concern that I'm sure n00bs like me will share > > Jerome, in that FAQ you mention (this one I assume > http://www.restlet.org/about/faq), in question #3 it says: > > "Finally, the Restlet API is I/O agnostic as its core Representation > interface can work equally well with BIO streams (java.io package) and > NIO channels (java.nio package)."
Yes, I wrote that :-) > Now, are you saying there that there is something conceptual that > prevents Servlets to use NIO? (apart from possible implementation > details in particular servers like Tomcat) > If that's true, then how should we interpret statements like "Jetty > can use NIO" or "Glassfish can use NIO" ? The Servlet API directly exposes the request inputstream and the response outputstream for consumption and writing by the Servlet developer. This means that it would be quite difficult for the API to cleanly allow the developer to have the choice to work with NIO channels instead, at least without breaking the backward compatibility. Now that doesn't mean that Servlet containers can't leverage NIO to improve their performance (scalability and throughput). They can indeed use the non-blocking IO at the socket level, request parsing and response formatting. This way, the number of concurrent connections can be decoupled from the number of processing threads. However, they can't leverage NIO from the socket to the Servlet as the Servlet API has no provision for NIO as explained above. This is where the Restlet API makes the difference, by introducing the Representation class based on the idea of contentlets suggested by Greg Wilkins (Jetty). BTW, you can read more context info in the introduction paper: http://www.restlet.org/about/introduction > Please notice that I don't intend to start a confrontation of the "I > say they say" kind, only looking for enlihgtment Thanks for keeping the discussion constructive. There is in fact no need for confrontation: we leverage the Servlet API in our adapter extension and Jetty as a standalone connector. Best regards, Jerome

