struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <lukaszlen...@apache.org>
Subject Re: Action path prefix rules?
Date Fri, 14 Aug 2020 15:27:36 GMT
pt., 14 sie 2020 o 10:48 Heikki Hyyrö <heikki.hyyro@tuni.fi> napisał(a):
> I am a bit confused about the rules concerning mapping URL paths to
> actions. Let's say that I have a Struts application running at
> example.com with the app name "myApp". Then the usual path to access a
> Struts action named "foo" would presumably be
>
> example.com/myApp/foo.action
>
> Now, it seems to be also possible to access the foo-action even by
> adding a more or less arbitrary path prefix before the app name. E.g.
> also both
>
> example.com/abcde/myApp/foo.action
> example.com/some/bogus/prefix/myApp/foo.action
>
> seem to access foo. I am wondering where the rules that allow this are
> defined? What would be the relevant documentation to look into?
>
> As a specifid question, I wonder about links. If the foo-page contains
> e.g. a link created with the url-tag, such as
>
> <s:url action="bar" var="barUrl">
>    <s:param name="par" value="#something" />
> </s:url>
> <s:a href="%{viewCourseUrl}">
>    Link to bar-action
> </s:a>
>
> the link does not include any "extra" path prefix and always points to
> example.com/myApp/bar.action. I am wondering why this happens? And what
> if I actually would want the link to reflect the actual access URL,
> including any "extra" path prefix (e.g. the link might point to
> example.com/some/bogus/prefix/myApp/bar.action)? Is this possible?

I think here [1] is a piece of the code you are looking for, if an
action cannot be found in the provided namespace, fallback to the root
namespace is done (if available). I'm not sure if this is documented
or not, feel free to create a ticket in JIRA. Maybe we should also add
a logging statement there.

[1] https://github.com/apache/struts/blob/master/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java#L392-L395


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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


Mime
View raw message