• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stripes interceptor - what are you using them for?

 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On my continuing quest into Stripes, I've started to get into interceptors. The SecurityInterceptor mentioned in the documentation actually answers neatly the question I had of how to avoid checking for an existing session everywhere in my action beans.

While a few areas they can be applied to are obvious -e.g. for everything a regular web app would use servlet filters for- I'm wondering what other things they make possible, since one can get at the ActionBean and ActionBeanContext objects through them. Does anyone have some use cases they thought particularly fitting for interceptors?
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interceptors provide a nice plug-in like architecture for Stripes. As you know there are already a few built in interceptors that ship with stripes. A while back I blogged about writing Stripes interceptors and my example using @NoCache made it into Stripes 1.5 as @HttpCache. It's pretty typical that an interceptor uses annotation to drive its configuration.

There is another interceptor out there (need to find a link) that allows you to specify @Session on action bean properties and the interceptor automatically retrieves and injects properties into the session for you. So there is another possible use case.

Unfortunately I've had my head buried in PHP the last few days so I am not thinking straight. As I think of some use cases I'll post them here.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On a project I was working on a few months ago I used an Interceptor to ensure requests were made via SSL (https). I also wrote a white list interceptor that runs a regex on request params and cleans them (poor mans XSS prevention).
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah yes, there's also an XSS filter and the @Session interceptor you mention.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ulf Dittmer:
Ah yes, there's also an XSS filter and the @Session interceptor you mention.


I didn't actually use that XSS filter. The code on the wiki is incomplete. It is probably better than the one I wrote but I couldn't ever get that one to work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic