This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes getRequestURI() returns query parameters for path= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "getRequestURI() returns query parameters for path="/submit.do?my=Update" in WebSphere 5.1" Watch "getRequestURI() returns query parameters for path="/submit.do?my=Update" in WebSphere 5.1" New topic
Author

getRequestURI() returns query parameters for path="/submit.do?my=Update" in WebSphere 5.1

Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
In WebSphere 5.1 test server for Struts 1.1 application, I noticed that request.getRequestURI() also returns the query string, if the forward happens to have query parameters like below:

<forward name="success" path="/submit.do?my=Update"/>

request.getRequestURI() call inside an Action class returns /MyProjWeb/submit.do?my=Update

According to specification, getRequestURI() should not return the query string my=Update. According to specification, getRequestURI() should only return /MyProjWeb/submit.do.

Is it correct behavior for Struts to return query string also path is appended with query string?

Please note that the same code returns /MyProjWeb/submit.do only, when I run it in WebSphere 6.1.

Let me point out that request.getRequestURI() correctly returns only the URI (excludes query string) for both WebSphere 5.1 and 6.1 for a non-Struts application. As such, both WebSphere 5.1 and 6.1 are correctly meeting Servlet specification - no surprise there.

Query string is also returned only when I use forward in Struts and append query string in the path of forward in struts-config.xml in WebSphere 5.1 (behaves correctly in WebSphere 6.1).

My question:
1. Is this the expected behavior in Struts 1.1 to also append the query string, when getRequestURI is called?
2. Or, is it WebSphere 5.1 specific bug that got rectified in WebSphere 6.1?
 
wood burning stoves
 
subject: getRequestURI() returns query parameters for path="/submit.do?my=Update" in WebSphere 5.1
 
Similar Threads
request.getURL() and request.getURI()
Can I find out the "path" information from the destination JSP ?
doubt in servlet specification
getRequestURI() returns parameters - WAS 5.1 running Struts 1.0 application
How to get the JSP page name