1) Sync to CVS 2.a) Refactor ServletDispatcher to be extensible 2.b) Add your ServletDispatcher subclass which extends refactored ServletDispatcher to do what you want\ 2.c) Add unit tests 3) Create Jira issue 5) Attach patch to Jira issue
It's impossible for us to know where you're going to need extensibility unless we're writing the code ourselves... Jason > -----Original Message----- > From: Jerome BERNARD [mailto:[EMAIL PROTECTED] > Sent: Sunday, September 28, 2003 1:09 PM > To: [EMAIL PROTECTED] > Subject: Re: [OS-webwork] Advanced URL mapping? > > > I just looked at the code and can't find anything really > helpful in the > ServletDispatcher class :-( > > Here is what I would like to do: > > public class RewriteServletDispatcher extends ServletDispatcher { > public void service(HttpServletRequest request, HttpServletResponse > response) throws ServletException { > // extract the article id to retreive > String pathInfo = request.getPathInfo(); > String articleID = pathInfo.substring(1, pathInfo.length()); > // alter the original request so that WW handles it > // the request could be now something like > "/showArticle.action?article=<articleID>" > ??? > } > } > > As show above, even though I am able to extract the relevant > information > (the article ID), I am not able to tell the ServletDispatcher that > instead of using the action built from the request path I > would like to > use my own path (that would be a "regular" WW action name with my > article id as a parameter). > > So ServletDispatcher does not seem to offer much compared to a custom > Servlet (I mean in the use case of course :-)). > If ServletDispatcher was "refactored" a little bit so that > the main work > would be done in a method independant of the ServletRequest > this would > probably help. I am thinking about something like this: > > public class ServletDispatcher extends HttpServlet { > public void service(HttpServletRequest request, HttpServletResponse > response) throws ServletException { > // extract the relevant information from the > HttpServletRequest object > handleRequest(extractPath, response); > } > protected void handleRequest(String requestPath, > HttpServletResponse > response) throws ServletException { > } > // other methods omitted for brief > } > > This would allow developers to extend ServletDispatcher and still be > able to implement any URL mapping policy they'd like to use. > > I would definitely prefer something better than my own servlet with a > "copy&paste" from ServletDispatcher's code. > > Any suggestion? > > BTW, I think this kind of servlet should be included in WW. > This would > allow pretty URL (this is in fact the main purpose I'm trying > to reach). > > Regards, > Jérôme. > > Jason Carreira wrote: > > >Yes, implementing your own ServletDispatcher is the best way to do > >this... > > > > > > > >>-----Original Message----- > >>From: Jerome BERNARD [mailto:[EMAIL PROTECTED] > >>Sent: Sunday, September 28, 2003 10:54 AM > >>To: [EMAIL PROTECTED] > >>Subject: [OS-webwork] Advanced URL mapping? > >> > >> > >>Hi, > >> > >>I would like to be able to map some URL to some actions > where part of > >>the URL is transformed as a parameter to the action. > >>For example, I would like the URL > >>"http://myhost.com/article/XYZ" to be > >>rendered as the view > >>of the action "showArticle" with the parameter > >>"articleID" set to "XYZ". > >> > >>I could possibly do such a thing using Apache (and especially > >>mod_rewrite) as a proxy to the web server, but I would like > >>to handle it > >>at the Servlet level. > >> > >>I am wondering what is the best way to do it... Should I extend WW > >>default ServletDispatcher? > >> > >>Thanks in advance, > >>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