Ricardo identified a serious bug in ClickServlet where we check if Context should be cleared from the ThreadLocal.
Currently we check that if the forwarded request is of type ClickRequestWrapper, we do not clear the ThreadLocal, otherwise we do.
I wrongly concluded that the forwarded request will always be the request passed into #requestDispatcher.forward(..).
However the spec RequestDispatcher#forward states:
"The request and response parameters must be either the same objects as were passed to the calling servlet's service method or be subclasses of the
ServletRequestWrapper or ServletResponseWrapper classes that wrap them."
meaning the request we pass to #forward might be wrapped by a subclass of ServletRequestWrapper. Jetty 5.12 does this by wrapping ClickRequestWrapper in a class called "DispatcherRequest".
We can fix the problem by unwinding the request and look for an instance of ClickRequestWrapper.
Unfortunately the above fix is not enough. After patching ClickServlet with the above fix, Jetty would not forward to the correct page. Instead it kept forwarding back to the original requests path.
I think the problem is that ClickRequestWrapper references the original request instead of "DispatcherRequest". Will investigate further.
|Project Import||Fri Mar 20 14:11:32 PDT 2009 [ 1237583492744 ]|
|Status||Resolved [ 5 ]||Closed [ 6 ]|
|Fix Version/s||1.4 [ 10011 ]|
|Status||In Progress [ 3 ]||Resolved [ 5 ]|
|Resolution||Fixed [ 1 ]|
|Assignee||Malcolm Edgar [ medgar ]||Bob Schellink [ sabob ]|
|Attachment||StackContextsPatch2.zip [ 10351 ]|
|Assignee||Bob Schellink [ sabob ]||Malcolm Edgar [ medgar ]|
|Attachment||ThreadLocalContextIssue.zip [ 10350 ]|
|Field||Original Value||New Value|
|Status||Open [ 1 ]||In Progress [ 3 ]|