wood burning stoves 2.0*
The moose likes Other Application Frameworks and the fly likes Stripes interceptor - what are you using them for? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Stripes interceptor - what are you using them for?" Watch "Stripes interceptor - what are you using them for?" New topic
Author

Stripes interceptor - what are you using them for?

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41015
    
  43
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?


Ping & DNS - my free Android networking tools app
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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.


GenRocket - Experts at Building Test Data
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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
Marshal

Joined: Mar 22, 2005
Posts: 41015
    
  43
Ah yes, there's also an XSS filter and the @Session interceptor you mention.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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.
 
 
subject: Stripes interceptor - what are you using them for?
 
Similar Threads
Few questions on Stripes
When not to use Stripes
What makes Stripes unique?
Frameworks? Do I need one? want one?
What web development technology should I use?