struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Lentz <ericle...@outfastsource.com>
Subject Action mapping - match on anything
Date Fri, 23 Mar 2012 18:15:01 GMT
Anyone know of a way, in Struts 2, to assign an action that matches on
anything in the URL, including slashes? This would be a catch-all, if no
other action specification is more specific.

I configured:
<constant name="struts.enable.SlashesInActionNames" value="true" />
<constant name="struts.mapper.alwaysSelectFullNamespace" value="false"/>
<constant name="struts.action.extension" value=""/>

If I have <action name="*" ...
then it will match on http://server/context/foo
but it will not match on http://server/context/foo/bar

I could do something like this <action name="*/*" ...
but then I'd need to do that for every combination, and I want to be able
to have n slashes; as is needed (which will vary).

I tried regex, but that requires that I have some kind of {foo} notation
for it to execute a regex. Maybe there's still a way to make that work, but
my imagination has run out on possibilities. OGNL does a bunch of
complaining if the string supplied in the URL doesn't match what's in the
parens in some way.

I see [1] talks about a "catch-all" mapping, as specified above, but again,
no joy on the slashes.

[1] http://struts.apache.org/2.0.11.1/docs/action-configuration.html

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message