0
AOP를 통해 컨트롤러 응답에 헤더를 추가하려고하는데 컨트롤러 또는 컨트롤러의 응답에 액세스하는 방법을 모르겠습니다.주석 기반 AOP로 컨트롤러 응답 수정하기?
어떻게하면됩니까?
이 내 현재의 주석입니다 :
@Retention(RetentionPolicy.RUNTIME)
@Target([ElementType.METHOD, ElementType.TYPE, ElementType.FIELD])
public @interface NoCaching {
}
그리고 여기에 현재의 내 측면이다 :
@Aspect
@Component("noCachingAspect")
class NoCachingAspect {
@Pointcut("@annotation(com.grailsrocks.cacheheaders.NoCaching)")
public void nameDoesntMatter() {
}
@Before("com.grailsrocks.cacheheaders.NoCachingAspect.nameDoesntMatter()")
public void beforeMethod(JoinPoint joinPoint) throws Throwable {
println 'hellowoeijf'
}
}
그리고 여기에 내가 주석 사용 방법은 다음과 같습니다
@NoCaching
def annotations(){
println 'bar'
}
는 어떻게 얻을 수 응답 객체를 수정하기 위해 주석에 의해 목표 된 컨트롤러에 대한 액세스? 다시,이 절대적으로 작동 http://burtbeckwith.com/blog/?p=80
볼 동안 –