OSDN Git Service

CSRFインターセプターをマシに。
[rabbit-bts/RabbitBTS.git] / war / WEB-INF / rabbitBTS-servlet.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <beans xmlns="http://www.springframework.org/schema/beans"
3         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
4         xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop"
5
6         xsi:schemaLocation="http://www.springframework.org/schema/beans
7            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
8            http://www.springframework.org/schema/context
9            http://www.springframework.org/schema/context/spring-context-2.5.xsd
10            http://www.springframework.org/schema/aop
11            http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
12            ">
13         <!-- aspect -->
14         <!--
15                 <aop:aspectj-autoproxy /> <bean
16                 class="org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator"
17                 /> <bean class="jp.sourceforge.rabbitBTS.TestAspect" />
18         -->
19
20         <!-- validator -->
21         <bean id="configurationLoader"
22                 class="org.springmodules.validation.bean.conf.loader.annotation.AnnotationBeanValidationConfigurationLoader" />
23         <bean id="validator" class="org.springmodules.validation.bean.BeanValidator"
24                 p:configurationLoader-ref="configurationLoader" />
25         <!-- Load messages -->
26         <bean id="messageSource"
27                 class="org.springframework.context.support.ReloadableResourceBundleMessageSource"
28                 p:basenames="WEB-INF/messages">
29                 <property name="cacheSeconds" value="1"></property>
30         </bean>
31
32         <!-- Controller etc. -->
33         <bean class="jp.sourceforge.rabbitBTS.interceptors.TraceInterceptor"
34                 id="tracer" />
35         <bean class="jp.sourceforge.rabbitBTS.interceptors.AuthenticationInterceptor"
36                 id="authInterceptor" />
37         <bean class="jp.sourceforge.rabbitBTS.interceptors.CSRFInterceptor"
38                 id="csrf">
39                 <property name="expireInSecond" value="60" />
40         </bean>
41         <bean
42                 class="org.springframework.orm.jdo.support.OpenPersistenceManagerInViewInterceptor"
43                 id="openInView">
44                 <property name="persistenceManagerFactory" ref="pmf"></property>
45         </bean>
46
47         <bean
48                 class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
49                 <property name="interceptors">
50                         <list>
51                                 <ref bean="tracer" />
52                                 <ref bean="openInView" />
53                                 <ref bean="authInterceptor" />
54                                 <ref bean="csrf" />
55                         </list>
56                 </property>
57         </bean>
58         <bean id="annotationMethodHandlerAdapter"
59                 class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
60                 <!-- spring bugs -->
61                 <property name="webBindingInitializer">
62                         <bean class="jp.sourceforge.rabbitBTS.SomeBindingInitializer" />
63                 </property>
64         </bean>
65
66         <!-- view -->
67         <!--
68                 <bean
69                 class="org.springframework.web.servlet.view.InternalResourceViewResolver">
70                 <property name="viewClass"
71                 value="org.springframework.web.servlet.view.JstlView" /> <property
72                 name="prefix" value="/WEB-INF/views/" /> <property name="suffix"
73                 value=".jsp" /> </bean>
74         -->
75
76         <bean id="freemarkerConfig"
77                 class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
78                 <property name="templateLoaderPath" value="/WEB-INF/views/" />
79                 <property name="freemarkerSettings">
80                         <props>
81                                 <prop key="default_encoding">utf-8</prop>
82                                 <prop key="url_escaping_charset">utf-8</prop>
83                         </props>
84                 </property>
85
86         </bean>
87         <bean id="viewResolver"
88                 class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
89                 <property name="cache" value="false" />
90                 <property name="prefix" value="" />
91                 <property name="suffix" value=".ftl" />
92                 <property name="requestContextAttribute" value="rc" />
93                 <property name="exposeSpringMacroHelpers" value="true" />
94                 <property name="contentType">
95                         <value>text/html; charset=utf-8</value>
96                 </property>
97         </bean>
98         <bean
99                 class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
100                 <property name="interceptors">
101                         <list>
102                                 <ref bean="tracer" />
103                                 <ref bean="openInView" />
104                                 <ref bean="authInterceptor" />
105                                 <ref bean="csrf" />
106                         </list>
107                 </property>
108         </bean>
109
110         <!--  trace log -->
111         <!--
112                 <bean id="dInterceptor"
113                 class="org.springframework.aop.interceptor.DebugInterceptor" /> <bean
114                 id="advisor"
115                 class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
116                 <property name="advice"> <ref bean="dInterceptor" /> </property>
117                 <property name="mappedName"> <value>index</value> </property> </bean>
118         -->
119
120         <!-- DAO -->
121         <bean id="pmf"
122                 class="org.springframework.orm.jdo.LocalPersistenceManagerFactoryBean">
123                 <property name="persistenceManagerFactoryName" value="transactions-optional" />
124         </bean>
125
126         <bean id="abstractDao" abstract="true">
127                 <property name="persistenceManagerFactory" ref="pmf"></property>
128         </bean>
129
130         <bean id="accountDao" parent="abstractDao"
131                 class="jp.sourceforge.rabbitBTS.dao.jdo.AccountDaoImpl">
132         </bean>
133
134         <bean id="bbsDao" parent="abstractDao"
135                 class="jp.sourceforge.rabbitBTS.dao.jdo.BbsDaoImpl">
136         </bean>
137
138         <!-- サービス -->
139         <bean class="jp.sourceforge.rabbitBTS.services.BbsService">
140         </bean>
141         <bean class="jp.sourceforge.rabbitBTS.services.AccountService">
142                 <property name="firstSuperUser" value="test@example.com" />
143         </bean>
144
145         <!-- アノテーションベースの設定 -->
146         <context:component-scan base-package="jp.sourceforge.rabbitBTS"
147                 use-default-filters="true" />
148
149 </beans>