Community
Participate
Working Groups
Created attachment 201040 [details] Minimal test case. I'm using Jetty embedded for running JUnit tests against a servlet. I was trying to upgrade from 7.1.2 to 7.4.5, but something broke (or at least changed) between 7.1.3 and 7.1.4. For performance of running many tests rounds, I was programatically stopping the ServletContextHandler (a WebAppContext), calling .setServletHandler() on it with a new ServletHolder, then restarting the ServletContextHandler. This was working great with older versions since at least the early 6.x series, but after upgrading to 7.1.4 or above, Jetty only responds with a HTTP 404 for what should be valid requests. There is very little documentation that I can find around use of this class. However, after finding an example at http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty that passed ServletContextHandler.SESSIONS to the ServletContextHandler constructor, I did the same - and it worked. I reviewed the change log for 7.1.4, and could not see anything to explain this. I also reviewed the source code for ServletContextHandler between 7.1.3 and 7.1.4, and while there is one difference, I can't see how it would be relevant - so the change affecting this must be elsewhere in the code. I've attached a minimal test case. On versions of Jetty 7.1.3 and below, it will output "200" for HTTP OK. On versions 7.1.4 and above, it will output "404" for HTTP Not Found. After uncommenting the ServletContextHandler.SESSIONS flag, it will again output "200" for versions 7.1.4 and above - but this test should not require any HTTP session support. Even running with all logging enabled, there are no errors, warnings, or anything else present to help indicate what is happening here. I will attach the log file that was generated from the same minimal test case.
Created attachment 201041 [details] Log file from test case.
The change that made it impossible to replace ServletHandler, SessionHandler, and SecurityHandler in certain circumstances was intended to allow setting additional HandlerWrapper(s) on a ServletContextHandler object. This can be used for example to allow configuring a context specific request log file. The fix for this issue along with a test harness has been pushed to master for final Jetty 7.5.0 release.