I am currently using Struts 2.0 using guice for dependency injection.
I have a goal to have a minimum amount of xml in my project.
I want to handle all login in 1 place. So if a user isn't
authenticated, he will be sent to the login page.
I first tried this with a base action class that I extended, in the
base class I defined @Result for Action.LOGIN, while the subclasses
would define @Result for Action.SUCCESS. This didn't seem to work as
only the @Result annotation on the subclass was found by struts.
Then I tried to create an interceptor, but it seems that the only
thing I can do here is to change the result String, not actually
affect which page the user gets sent to.
Currently it seems to me that I have to define both Action.LOGIN and
Action.SUCCESS @Result annotations for all Actions I define. This is
clearly not according to the DRY principles, and not what I want.
I also now have to set @Package on all my actions, so they are in the
package I have defined my interceptor.
What I really want, is to not have anything in my Actions that
indicate that they require authentication (all of the do), or just a
marker interface/annotation to enable authentication.
How can I achieve this? Is Action chaining something I should look at?
I don't really know anything about it except that it exists. And is it
something that can be configured from my guice module loading, or does
it require definitions in struts.xml?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)