1. 빈설정
<!-- @RequestMapping어노테이션을 이용하여 요청을 처리할 컨트롤러사용 --> <bean id="annotationHandlerMapping" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"> <property name="order" value="1" /> <!-- <property name="alwaysUseFullPath" value="true" />--> <property name="interceptors"> <list> <ref bean="logHandlerInterceptor" /> <ref bean="noCacheHeaderInterceptor" /> <ref bean="loginCheckInterceptor" /> </list> </property> </bean> |
2. 인터셉터 bean : LoginCheckInterceptor.java
@Service 어노테이션을 반드시 해줘야함.
@Service public class LoginCheckInterceptor extends HandlerInterceptorAdapter { /** The Constant logger. */ private Logger logger = Logger.getLogger(this.getClass()); /** * <pre> * preHandle * * </pre> * @param request * @param response * @param handler * @return * @throws Exception */ @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { if (... ) { return false; } }
|
'OpenSource > Spring' 카테고리의 다른 글
Spring 업로드 구현 (0) | 2010.03.23 |
---|---|
Spring DataSource설정 (DB설정) (0) | 2010.02.17 |
Spring 컨트룰러 작업시 ControllerClassNameHandlerMapping을 사용할경우 주의사항! (0) | 2010.02.01 |
간단한 Spring MVC설정(ControllerClassNameHandlerMapping) (0) | 2009.11.18 |
스프링 컨트롤러에서 컨트롤러로 리다이렉트 (0) | 2009.09.07 |