servlet-context.xml

아래 코드는 내가 이해하기 쉽게 위치를 분할하고 수정해서 붙여 놓은 것임.

※ <interceptor></interceptor>들은

     <interceptors></interceptors> 안에 위치해야함. 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
    <!-- 인터셉터 설정 / 동작 경로 -->
    
    <!-- 로그인처리 인터셉터 (로그인유지) -->
    <beans:bean id="loginInterceptor" 
    class="kr.xxx.yyyy.interceptor.LoginInterceptor"></beans:bean>
 
        <interceptor>
            <mapping path="/member/signin"/>            
            <beans:ref bean="loginInterceptor"/>
        </interceptor>
 
    
 
    <!-- 자동 로그인 처리 인터셉터 (자동로그인유지) -->
    <beans:bean id="autoLoginInterceptor" 
    class="kr.xxx.yyyy.interceptor.AutoLoginInterceptor"></beans:bean>
 
        <interceptor>
            <mapping path="/**/"/>
            <beans:ref bean="autoLoginInterceptor"/>
        </interceptor>
 
 
    
    <!-- 비회원만 접근할 수 있게 하는 인터셉터 -->
    <beans:bean id="guestInterceptor" 
    class="kr.xxx.yyyy.interceptor.GuestInterceptor"></beans:bean>
 
        <interceptor>
            <mapping path="/member/signup"/>
            <mapping path="/member/signin"/>        
            <beans:ref bean="guestInterceptor"/>
        </interceptor>
 
 
    
    <!-- 회원만 접근할 수 있게 하는 인터셉터 -->
    <beans:bean id="userInterceptor" 
    class="kr.xxx.yyyy.interceptor.UserInterceptor"></beans:bean>
 
        <interceptor>
            <mapping path="/abcd/*"/>
            <mapping path="/board/register"/>
            <mapping path="/board/modify"/>
            <mapping path="/board/detail"/>
            <mapping path="/board/delete"/>
            <beans:ref bean="userInterceptor"/> 
        </interceptor>
 
 
    
    <!-- 관리자만 접근할 수 있게 하는 인터셉터 -->
    <beans:bean id="adminInterceptor" 
    class="kr.xxx.yyyy.interceptor.AdminInterceptor"></beans:bean>
 
        <interceptor>
            <mapping path="/admin/**/"/>
            <beans:ref bean="adminInterceptor"/>
        </interceptor>
 
 
cs