|
Problem(Abstract) |
Changes were made to HttpServletRequest.getQueryString()
to be in compliance with the J2EE Servlet Specification, sections SRV.8.4
and SRV.8.4.1.
Previous to these changes, the original query string from a client passed
throughout the request even after it was forwarded. |
|
|
|
Cause |
The HttpServletRequest.getQueryString is one of
the path elements used to acquire a RequestDispatcher; therefore, this
value must be updated to reflect what was used to obtain the
RequestDispatcher when a forward keyword is used. If there is no query
string when obtaining the requestDispatcher, getQueryString()
returns null. |
|
|
Resolving the
problem |
According to Servlet Specification, sections SRV.8.4 and
SRV.8.4.1.
SRV.8.4.1 :Query String
The request dispatching mechanism is responsible for aggregating query
string parameters when forwarding or including requests.
So the aggregation happens only for parameters, and not for queryString.
'getQueryString()' will return only the queryString passed in the
forwarded URL
If customers would like to access a parameter which is passed in a
querystring to the parent servlet, "request.getParameter();" should be
used instead.
Reason for change:
Servlet Specification 2.3 is not clear on 'getQueryString()' behavior,
but was clarified in the latest version, hence these changes were
necessary to all versions of WebSphere, so customers would see the
consistent behavior going forward
Its our aim to strive towards 100% J2EE spec compliance. There have been
several instances where customers have strongly raised objections when
WebSphere has not adhered to specification. In all these instances it is
understood that the customers have coded their applications complying with
the specification.
Versions affected:
WebSphere V5.0.2.10 onwards
WebSphere V5.1.1.5 onwards
WebSphere V6.0.2 onwards
The following APAR's describe the recent changes to various versions of
WebSphere
PQ94676: INCLUDED REQUEST PARAMETERS DO NOT MEET THE JAVA SERVLET SPEC
[JAVAX.SERVLET.INCLUDE.QUERY_STRING <> GETQUERYSTRING()]
http://www.ibm.com/support/docview.wss?uid=swg24008006
"PQ97193: REQUEST.GETREQUESTURL DOES NOT RETURN THE CORRECT VALUE AFTER
BEING FORWARDED" WebSphere Application Server__APAR_/swg1PQ97193.html
PK05760: WEBSPHERE APPLICATION SERVER: DURING THE PROCESSING OF A
SERVLETREQUEST THE CONTENTLENGTHINPUTSTREAM RETURNS A -1 AFTER PQ97193
WebSphere Application Server__APAR_/swg1PK05760.html
Additional Information:
In Servlet Specification 2.4(WebSphere V6.0.x) some new parameters have
been added. The following method call will return the query string
request.getAttribute("javax.servlet.forward.query_string")
For more information on getQueryString behavior, Please refer to the
following link
http://www.caucho.com/resin-3.0/webapp/faq.xtp |
|
|
|
|
Cross Reference information |
Segment |
Product |
Component |
Platform |
Version |
Edition |
Application Servers |
Runtimes for Java Technology |
Java SDK |
|
|
|
|
|
|