Jason Carreira wrote:I did not want to be rude in the post. I am willing to contribute on this topic and before I start, I would like to know if some of you have already though about such a thing (a sort of mod_rewrite on a WW level) and if so what would be the best way to deal with it.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 issueIt's impossible for us to know where you're going to need extensibility unless we're writing the code ourselves... Should it be some sort servlet parameters for the ServletDispatcher indicating which regexp to apply, or something else? Regards, Jérôme. 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 actionswhere part ofthe 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 |
- RE: [OS-webwork] Advanced UR... Cameron Braid
- Re: [OS-webwork] Advanced UR... Mike Cannon-Brookes
- RE: [OS-webwork] Advanced UR... Cameron Braid
- Re: [OS-webwork] Advanced UR... Matt Ho
- RE: [OS-webwork] Advanced UR... Cameron Braid
- Re: [OS-webwork] Advanced UR... Matt Ho
- RE: [OS-webwork] Advanced UR... Cameron Braid
- Re: [OS-webwork] Advanced UR... Matt Ho
- Re: [OS-webwork] Advanced UR... Jérôme BERNARD
- RE: [OS-webwork] Advanced URL mapping? Jason Carreira
- RE: [OS-webwork] Advanced URL mapping? Jerome BERNARD
- RE: [OS-webwork] Advanced URL mapping? Jason Carreira
- [OS-webwork] Converters need to be unified Fred Lamuette
- RE: [OS-webwork] Advanced URL mapping? Jérôme BERNARD
- RE: [OS-webwork] Advanced URL mapping? Patrick Lightbody
- RE: [OS-webwork] Advanced URL mapping? Jason Carreira