I have created a new issue in JIRA (http://jira.opensymphony.com/secure/ViewIssue.jspa?key=WW-326) and submitted a new servlet that extends ServletDispatcher and provides such a functionality. I also provided a way to shorten even more the URL by assuming that if the first parameter name is not specified then it is supposed to be the name of the action.
This allows to replace the following URL http://myhost.com/article/article/123 with this URL http://myhost.com/article/123. Any code review welcomed! :-p Jérôme. Robert Douglass <[EMAIL PROTECTED]>: > I think this is the relevant code, from > org.apache.turbine.util.parser.DefaultParameterParser. As I understand it, > Turbine folks avoid URLs like foo/bar?id=1812 in favor of foo/bar/id/1812. > I've never used this, and I can't remember right off exactly how the servlet > container knows which part is the path info, but essentially, they assume > that the path info follows the pattern name_1/value_1/...name_n/value_n. The > advantage is supposed to be search-engine friendly URLs from completely > dynamic applications. This gets touted by the Turbine community as a great > feature (and it may be). I'd love to have this available, but as you can see > below, it is easy enough to implement that anyone can do it as soon as they > want it. I don't really need it at the moment, so I'll let someone else do > it. > > -Robert > > // Also cache any pathinfo variables that are passed around as > // if they are query string data. > try > { > StringTokenizer st = > new StringTokenizer(request.getPathInfo(), "/"); > boolean isNameTok = true; > String pathPart = null; > while (st.hasMoreTokens()) > { > if (isNameTok) > { > tmp = java.net.URLDecoder.decode(st.nextToken()); > isNameTok = false; > } > else > { > pathPart = java.net.URLDecoder.decode(st.nextToken()); > if (tmp.length() > 0) > { > add(convert(tmp), pathPart); //R.D. this add the > params to their internal param implementation, see below* > } > isNameTok = true; > } > } > } > catch (Exception e) > { > // If anything goes wrong above, don't worry about it. > // Chances are that the path info was wrong anyways and > // things that depend on it being right will fail later > // and should be caught later. > } > > > * from super-class BaseValueParser > /** > * Random access storage for parameter data. The keys must always be > * Strings. The values will be arrays of Strings. > */ > private Map parameters = new HashMap(); > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of > Jerome BERNARD > Sent: Sunday, September 28, 2003 9:51 PM > To: [EMAIL PROTECTED] > Subject: Re: [OS-webwork] Advanced URL mapping? > > > Could you give some insights about the way Turbine handle URLs? > Any pointers? > > Jérôme. > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Opensymphony-webwork mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork