You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ch...@emc.com on 2012/07/19 18:17:32 UTC
convention plugin mapping question
I'm experiencing some slightly unexpected behavior with respect to the package of the actionless results in my convention plugin app.
Consider the following action classes and templates:
com/actions/Delta.class
And templates relative to WEB-INF/content/
alpha.ftl
delta.ftl
The following works as expected:
localhost:8080/delta --> hits the delta action
localhost:8080/alpha --> hits the alpha template, an actionless result ( I assume this is actually an empty action implementation )
And the following also works, since the delta action is in the "default" package I assume
localhost:8080/foo/delta --> hits the delta action even though there's the foo path element; this is because foo doesn't contain delta, but the fall back is to the default package
But this doesn't work:
localhost:8080/foo/alpha --> doesn't hit the alpha actionless result
Shouldn't it work like the delta action?
Re: How to resuse an Action class in different namespace contexts?
Posted by Łukasz Lenart <lu...@googlemail.com>.
One base abstract class and two concrete classes which contain the
prepare() methods as specified.
Regards
--
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/
2012/7/23 Mounir Benzid <mb...@meetingmasters.de>:
>
>
> I use two different namespaces to secure my web application ( with spring
> security)
>
> One is /pubilc the other is called.. well.. /private. Everything
> underneath /private is available only to logged-in users.
>
>
> Currently there is an action class living in the /public namespace named
> ShowPublicAgendaAction
> which is responsible for showing today's agenda items.
>
>
> A very similar action ShowPrivateAgendaAction exists in the secured /private
> namespace
> which does pretty much the same thing, the only difference is, that all
> available agenda itens are presented to the user
> (not only those of today)
>
>
> I'd like to consolidate both actions since they differ only in one single
> line of code
>
> Public: public void prepare() { List<AgendaItem> items=
> agendaManager.loadTodaysItems();.....}
>
> Private: public void prepare() { List<AgendaItem> items=
> agendaManager.loadItems();......}
>
>
> How do I go about serving requests from different namespaces in one Action
> class?
>
> Requests coming-in from /private should call items=
> agendaManager.loadItems();
> Everythng else should call items= agendaManager.loadTodaysItems();
>
>
>
> Thanks.
>
> Mounir
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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
How to resuse an Action class in different namespace contexts?
Posted by Mounir Benzid <mb...@meetingmasters.de>.
I use two different namespaces to secure my web application ( with
spring security)
One is /pubilc the other is called.. well.. /private. Everything
underneath /private is available only to logged-in users.
Currently there is an action class living in the /public namespace
named ShowPublicAgendaAction
which is responsible for showing today's agenda items.
A very similar action ShowPrivateAgendaAction exists in the secured
/private namespace
which does pretty much the same thing, the only difference is, that all
available agenda itens are presented to the user
(not only those of today)
I'd like to consolidate both actions since they differ only in one
single line of code
Public: public void prepare() { List<AgendaItem> items=
agendaManager.loadTodaysItems();.....}
Private: public void prepare() { List<AgendaItem> items=
agendaManager.loadItems();......}
How do I go about serving requests from different namespaces in one
Action class?
Requests coming-in from /private should call items=
agendaManager.loadItems();
Everythng else should call items= agendaManager.loadTodaysItems();
Thanks.
Mounir
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: convention plugin mapping question
Posted by Lukasz Lenart <lu...@apache.org>.
2012/7/19 <Ch...@emc.com>:
> I'm experiencing some slightly unexpected behavior with respect to the package of the actionless results in my convention plugin app.
>
> Consider the following action classes and templates:
>
> com/actions/Delta.class
>
>
> And templates relative to WEB-INF/content/
>
> alpha.ftl
> delta.ftl
>
>
> The following works as expected:
>
> localhost:8080/delta --> hits the delta action
> localhost:8080/alpha --> hits the alpha template, an actionless result ( I assume this is actually an empty action implementation )
>
> And the following also works, since the delta action is in the "default" package I assume
>
> localhost:8080/foo/delta --> hits the delta action even though there's the foo path element; this is because foo doesn't contain delta, but the fall back is to the default package
>
> But this doesn't work:
>
> localhost:8080/foo/alpha --> doesn't hit the alpha actionless result
>
> Shouldn't it work like the delta action?
I'm not sure but it should fall back to default package and try to
find the action there. Did you try to play with
struts.convention.action.mapAllMatches = true/false
?
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