New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Concept of Interceptors to Routes.groovy #74

Open
codeconsole opened this Issue Aug 17, 2011 · 1 comment

Comments

Projects
None yet
2 participants
@codeconsole
Contributor

codeconsole commented Aug 17, 2011

I have several situations where I need to do common tasks across several pages.

For instance, I need to place general site stats in the request, but only on 80% of the pages.

I would like to be able to do something like this:

all "/**", intercept: "/pageStats.groovy"

This would run the Groovy Script pageStats.groovy before accessing any page.

You could probably accomplish the same thing with validate, but validate does not give you access to all bound variables.
#61 and does not allow me to access another script.

I could prob do this now
all "/**", validate {
request.stats = // stats retrieved from memcache/datastore
false
}

Most frameworks have a concept of interceptors, I figured it might be a nice feature for Gaelyk to have.

@glaforge

This comment has been minimized.

Show comment
Hide comment
@glaforge

glaforge Aug 31, 2011

Contributor

I'm curious if you could reuse the before{} action from a plugin to implement your interceptors?
I haven't really had too much for interceptors myself, for my few apps, so I haven't put much thought in that topic yet.
I'm wondering what would be the best approach for implementation, and how to wire that in with regards to routing.

Contributor

glaforge commented Aug 31, 2011

I'm curious if you could reuse the before{} action from a plugin to implement your interceptors?
I haven't really had too much for interceptors myself, for my few apps, so I haven't put much thought in that topic yet.
I'm wondering what would be the best approach for implementation, and how to wire that in with regards to routing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment