struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ed Griebel <edgrie...@gmail.com>
Subject Re: quick simple question
Date Wed, 29 Jun 2005 13:06:35 GMT
What about using a custom RequestProcessor? It would be a huge hack,
but you could map *everything* to struts action (map "/*" to struts
action) and then check inside the request processor if it's a valid
struts action, and if not, forward appropriately. Although the
"appropriately" part is a bit of a hand-wave, as you need to forward
the request back to the web server.

-ed

On 6/29/05, Laurie Harper <laurie@holoweb.net> wrote:
> ori wrote:
> > currently i map all *.do requests to the action servlet.
> >
> > i have an action at myHost/action.do.
> >
> > i also want myHost/action to map to that same struts action.
> >
> > how can i do this?
> >
> > thanks a lot.
> 
> You only have two options for URL mapping: prefix or extension. In other
> words, you can say 'map any URL beginning ... to this servlet', or 'map any
> URL ending ... to this servlet'. Also, according to the docs, Struts will
> break if you have more than one URL mapping to the same action servlet.
> 
> So, possibility one: create two servlet definitions in web.xml, named
> differently, and map one as usual to '*.do' and the other to '*action'. I'm
> not sure that'll work, though, and probably isn't as general as you want.
> 
> Possibility two: you can't do this from within standard Struts and will
> have to use something like mod_rewrite.
> 
> Possibility three: use prefix mapping instead, so your URL would be
> http://.../do/action and you don't have to worry about '.do' on the end of
> the URL.
> 
> Bottom line: there's no way to have a general rule which says 'map .../X
> and .../X.do to the same thing' for arbitrary X. Maybe if you explain why
> you want to, the list can suggest alternative approaches.
> 
> L.
> --
> Laurie, Open Source advocate, Java geek and novice blogger:
> http://www.holoweb.net/~laurie/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message