Cool idea :)Sure. I thought about it, but it's quite painful: you have to override so many methods :-(
Though, for the implementaion, wouldn't you have been better to use the wrapper pattern, rather than dynamic proxies :)
I'll do it tomorrow and update the attachment in the JIRA issue.
Jérôme.
Cam
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jérôme BERNARD
Sent: Tuesday, 30 September 2003 1:30 AM
To: [EMAIL PROTECTED]
Subject: RE: [OS-webwork] Advanced URL mapping?
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 Iunderstand
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 rememberright off
exactly how the servlet container knows which part is thepath 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 dynamicapplications. 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 seebelow, 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 letsomeone else do
it.java.net.URLDecoder.decode(st.nextToken());
-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 =
isNameTok = false;java.net.URLDecoder.decode(st.nextToken());
}
else
{
pathPart =
if (tmp.length() > 0)this add
{
add(convert(tmp), pathPart); //R.D.
must always bethe 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
Behalf Of* Strings. The values will be arrays of Strings. */ private Map parameters = new HashMap();
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
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