If I wanted to go way overboard, I could figure out a way to hack <html:rewrite/> and struts-menu to spit out /action.html instead of /do/action. ;-) That would a great feature to make the site appear all .php! ;-)
Matt -----Original Message----- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED] Sent: Friday, September 19, 2003 2:25 PM To: Struts Users Mailing List Subject: RE: Is it possible to remove *.do or /do/* from the URL [solved] On Fri, 19 Sep 2003, Matt Raible wrote: > Date: Fri, 19 Sep 2003 14:00:46 -0500 > From: Matt Raible <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> > To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> > Subject: RE: Is it possible to remove *.do or /do/* from the URL [solved] > > Back to the original question... I found a solution and want to validate it: > > 1. I created a RequestFilter that maps to /* > 2. This filter checks to see if request.getServletPath() matches any of the > action paths in struts-config.xml. If so, it forwards to the action. > 3. As an added feature, I added a set of allowed extensions to this > filter's init parameters. So far I have .jsp,.html,.asp,.cfm (using .jsp > ensures no one links to them directly, MVC enforced!) - so marketing can > choose what technology they want to convey ;-) > > This seems to work great. For example, I have an "advancedSearch" action > defined as follows: > > <action path="/advancedSearch" > type="org.apache.struts.actions.ForwardAction" > parameter=".advancedSearch"/> > > (ForwardAction will eventually be replaces, if necessary, with a real > action). This allows all of the following URLs to work: > > http://site.com/do/advancedSearch (works with Struts by default) > http://site.com/advancedSearch > http://site.com/advancedSearch.html + all other extensions listed. > > Pretty slick IMO. Please let me know if I'm missing anything. > That's definitely slick. If you're targeting open source geeks, you might want to add ".php" to the list :-). > Thanks, > > Matt > Craig --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

