Spring WebMVC: interceptor which has access to the method definition and the HttpServletRequest -


i'm trying intercept spring controller calls annotated, similar to:

@requestmapping("/my/page") @accessrestriction(module = module.audit, action = auditactions.log) public modelandview mypage() {    // pls type teh codez }  

at point want access both values of @accessrestriction method, httpservletrequest object check if values match restrictions , httpservletresponse object in order send redirect , if applicable. being able throw exception might suitable well.

i've looked interceptors don't offer access method, handler. options of achieving this?

my suggestion decouple 2 concerns, 1 check annotation , throw exception, catch exception , translate redirect.

the first concern done using auto-proxy facility, apply aop-style interceptor invocations on controller objects. check annotation, validate invocation, , throw custom runtimeexception conditions violated.

you have custom handlerinterceptor checked exception in aftercompletion method, sending redirect via response object if it's present.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -