-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Michael,
On 6/19/14, 9:43 AM, Michael van Rooyen wrote: > We've been running Tomcat 6.0.36 without issues for many months. > Our pages have many components and are constructed using > getRequestDispacher("...").include(request, response) to pull the > components in. > > For the past few weeks, we've had a few instances where, in > constructing a page, the parameters in the query string passed to > getRequestDispatcher(), are not being passed through to the > components included. > > For example, if a browser submits the request /main.jsp?id=foo, > then from that page, we include /product.jsp?id=bar, the > product.jsp page should see the following parameters: > > id = [ bar, foo ] > > This happens almost all the time, but sporadically, we're getting > just: > > id = [ foo ] instead. > > If the entry page was /main.jsp?cat=foobar, for example, then on > including /product.jsp?id=bar, we should get: > > id = [ bar ], cat = [ foobar ] > > But instead, we sometimes get just: > > cat = [ foobar ] > > Here is an extract from our logs. The first is just before the > call the getRequestDispatcher().include(), and shows the URI. > > 19 Jun 2014 2:58:04 PM org.apache.catalina.core.ApplicationContext > log INFO: Trace @ 2014-06-19 14:58:04.808 [system: TP-Processor7] > /full/include/view/generic/smallfeature.jsp?id=25951215082928&cached=true > > web.Session$Site.include(Session.java:58) > > > And then the smallfeature.jsp logs the contents of the > parameterMap directly thereafter: > > 19 Jun 2014 2:58:04 PM org.apache.catalina.core.ApplicationContext > log INFO: Trace @ 2014-06-19 14:58:04.81 > [993BE7ADFD65B94F2A62E85B64B3B8A2/null: TP-Processor7] Parameters: > cat = lcu; page = browse; web.tags.Log.doStartTag(Log.java:48) > > > You can see the id and cached parameters are missing, and the > parameters that are available are actually those from the main > page. Has anyone experienced this before, or know what may cause > it? I think there is a hole in the spec, here, because Servlet Spec 3.0, section 9.1.1 states: " Parameters specified in the query string used to create the RequestDispatcher take precedence over other parameters of the same name passed to the included servlet. The parameters associated with a RequestDispatcher are scoped to apply only for the duration of the include or forward call. " The term "take precedence" could be interpreted as "overriding completely" (Tomcat's implementation) or "appending" (your expectation), and I think I would agree with the current implementation Tomcat appears to have: the "id" parameter in your included query string completely replaces the "id" parameter that came from the original request. Short of a clarification of the Servlet spec, you are going to have to do something else in order to fix this problem. Might I recommend the use of a request /attribute/ instead of a query string parameter to pass information from one resource to another for inclusion? - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJTovHDAAoJEBzwKT+lPKRYHvcQALJB3TIcPPbJMSmB//3vhFVP +MJw/4uNlhAYs4qOdI73Eihc2gp6ygeoDBCbMi+OMVT5TfHKVWhdZJBEhKj330au Z9nNdTGk1dmOs+totHeMv0EhAeEL432+sab7U+ub1j7cqK9j86NfTbmsUlTifiJm AY+afDT39Dzq3PxOaKzchLrELQB6eVLLeUNFvpkx2rPpp1HCgxIRiwN5zb1X59lH a4VikiR2SYEAm7bwWkTZOR1u6XTao3pAUIdWTY9kdfSvOWxijBEvY3Y8E3GihYEW w+LStaLHJ/fOZsVPKsJuxpDD9TIDck2NbReXxZJw1SYBk/6AtK3iHWYE4TAaFQm8 wxRTvrtBpfEWEnW/dvoz5PRqH4WKjnyXJoUxxkmEPDOWmlTDrCqGnqWRm/1nTkWr TU6ySbn3eoEfGmMBXilhauKmOJW+6QPI2kFtTDiY6e/ATgm4JLDdkkfZqKJdPwaN vYpS/wRHAR2w8d/dghxiKrKG1pm+0VXuxNJ/KknLml3sBTnK++M7tFLGApDTSO+o Gmp41VmGlXTv46SGots6DWg5BvPIj9t43OY9gJFD0loU3dwCf1PlaNq9h4PEjjiJ cNhzvK0jyt0uLTfXsMU9LJopk1zli17a9JZmZFGm//+pWlkYlYIgGS0+pp64fmJI J95/PRybwNQcLAS9tnCj =Ys8z -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org