| From | Sent On | Attachments |
|---|---|---|
| David Noll | Dec 4, 2000 3:11 pm | |
| Craig R. McClanahan | Dec 4, 2000 5:02 pm | |
| David Noll | Dec 4, 2000 7:20 pm |
| Subject: | RE: path info | |
|---|---|---|
| From: | David Noll (lis...@noll.org) | |
| Date: | Dec 4, 2000 7:20:34 pm | |
| List: | org.apache.struts.user | |
Thanks for the response. The path mapped servlets didn't work when I tried them; the same error was thrown, which I think makes sense. In a url like this:
/do/action/whatever
the path info starts at the second slash, and struts is setup to expect a leading slash in an action path. An eventual solution might be to allow regex matching in the action path attribute. Then a struts action class would only need to delete the "real" action path from the beginning of the path info to get path info relative to the action. If that sounds like a reasonable idea to the list, I'll put a feature request in bugrat.
BTW, the whole point of this exercise is to create a means of browsing a database that is friendly to search engines that don't recognize pages with query strings.
Cheers, David
-----Original Message----- From: Craig R. McClanahan [mailto:Crai...@eng.sun.com] Sent: Monday, December 04, 2000 8:02 PM To: stru...@jakarta.apache.org Subject: Re: path info
David Noll wrote:
Hello,
Hopefully this is a no-brainer. How can I configure struts to call an action, and include the path info? EG - my normal action is called at:
server/action.do
I would like to call this action like this:
server/action.do/some/extra/random/parameters/etc
and later on, in my action class access that extra info via javax.servlet.http.HttpServletRequest.getPathInfo(). With out of the box servlet init params and action.xml values, I get an error specifying that an invalid path was requested. I'm developing against struts .5, if it makes a difference.
Well, it's simple but not necessarily obvious ...
The servlet spec's definition of extension mapping is that it only looks for an extension after the last slash. In effect, that means you cannot use path info with extension mapped servlets. Alternatives:
* Use path-mapped servlets instead (maybe "/do/*").
* Pass the extra info as a query string rather than as extra path info.
Thanks, David
Craig McClanahan





