Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 package name in Interceptor

 
nazzy khan
Ranch Hand
Posts: 39
Android Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How do I get the name of package in intercetor.

Let's say I have interceptor applied on a package, I can get the name of the action using ActionInvocation class.


Is there any way to get the name of package as well.
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean namespace? You can get it by requestURI.
 
nazzy khan
Ranch Hand
Posts: 39
Android Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah the namespace..

I got it using below code...


Struts 2 ActionConfig class exposes the package name

Thanks
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your solution is struts2 style i like that.
 
nazzy khan
Ranch Hand
Posts: 39
Android Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mohana,

Yes I'm using struts 2. and basically I have two kind of users defined in my application: normal user and super-user

super-user actions are under admin package and normal user are under user package.

and both packages are protected by common Interceptor (AuthenticationInterceptor). There I need the package name to redirect admin users to a different login page.


Thanks
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to know why you are not using Roles Interceptor implemented solution is already there why you were doing it again.
 
nazzy khan
Ranch Hand
Posts: 39
Android Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh is it? I'll look ito that then..
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic