Community
Participate
Working Groups
When compiling org.eclipse.rap.rwt against javax.servlet 3.0 from Orbit [1], I get compile errors because RWT implements these interfaces that have been extended in 3.0: * HttpServletRequest * HttpServletResponse * ServletContext I will attach the full list of compile errors. [1] http://download.eclipse.org/tools/orbit/downloads/drops/R20110523182458/
Created attachment 197506 [details] List of compile errors
Created attachment 197834 [details] Draft patch Adds the missing methods to our implementations of HttpServletRequest, HttpServletResponse and ServletContext. As a consequence, we need to import package javax.servlet.descriptor, which does not exist in the 2.3 API (which is the current minimal version we require). If we don't find another solution we would need to increase the minimum required servlet API to 2.5 (IIRC in this version javax.servlet.descriptor was introduced)
Created attachment 197869 [details] Alternative solution The HttpServletRequest and HttpServletResponse objects in FakeContextUtil are created as JDK proxies. Only calls to HttpServletRequest#getSession(), #getSession(boolean) and #getLocale() are answered. All other methods throw UnsupportedOperationException. This approach allows us to stay with the current servlet 2.3 API as a minimum requirement and is future-proof. If new methods are added to these interfaces, they continue to compile and throw an UnsupportedOperationException at runtime.
Created attachment 198023 [details] Performance comparison Compares performance of first patch (extending the interface) and alternative patch (creating proxy from interface)
Created attachment 198523 [details] Performance comparison II The performance of proxies can be greatly improved. Instead of calling Proxy#newProxyInstance() each time, the proxy class can be created once with a call to Proxy#getProxyClass(). Instantiating the proxy is then a matter of calling constructor.newInstance(). The time to create 1000 proxy instances is now down to 0.009 s (instead of 0.105 s).
Implementing the interfaces from javax.servlet 3.0 implies that a javax.servlet 3.0 bundle is present in the target platform. As org.eclipse.equinox.http.jetty requires javax.servlet [2.5,2.6), we would have to ship two javax.servlet bundles (2.x and 3.0) To avoid potential conflicts and confusion that results from having two versions of the same bundle and with improved performance in creating proxies, we decided to take the proxy approach for now. With some luck, Equinox will adopt Jetty 8 (bug 309529 and bug 304152) within the 3.8 development cycle and the problem vanishes. I opened bug 350300 to reconsider this decision around 1.5 M5. Our test fixture also implements parts of the servlet API. Where necessary, the new methods were added to the existing implementations. This in turn means that running the tests requires the servlet API 3.0 to be present. Changes are in CVS HEAD
The presence of the 2 servlet bundle versions seems to break feature based launches. I cannot seem to get equinox to load the 2.5 and 3.0 versions at the same time using feature based launches. (In reply to comment #6) > Implementing the interfaces from javax.servlet 3.0 implies that a javax.servlet > 3.0 bundle is present in the target platform. As org.eclipse.equinox.http.jetty > requires javax.servlet [2.5,2.6), we would have to ship two javax.servlet > bundles (2.x and 3.0) > > To avoid potential conflicts and confusion that results from having two > versions of the same bundle and with improved performance in creating proxies, > we decided to take the proxy approach for now. With some luck, Equinox will > adopt Jetty 8 (bug 309529 and bug 304152) within the 3.8 development cycle and > the problem vanishes. I opened bug 350300 to reconsider this decision around > 1.5 M5. > > Our test fixture also implements parts of the servlet API. Where necessary, the > new methods were added to the existing implementations. This in turn means that > running the tests requires the servlet API 3.0 to be present. > > Changes are in CVS HEAD
If I add additional bundles to the launch config and specify the older api, it works. Sorry, for the false alarm. (In reply to comment #7) > The presence of the 2 servlet bundle versions seems to break feature based > launches. I cannot seem to get equinox to load the 2.5 and 3.0 versions at the > same time using feature based launches.