servlet.xml 5.44 KB
Newer Older
Matija Obreza's avatar
Matija Obreza committed
1
2
<?xml version="1.0" encoding="UTF-8"?>
<!--
Matija Obreza's avatar
Matija Obreza committed
3
  Copyright 2014 Global Crop Diversity Trust
Matija Obreza's avatar
Matija Obreza committed
4
5
6
7
8
9
10
11
12
13
14
15
16
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
    http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
Matija Obreza's avatar
Matija Obreza committed
17

Matija Obreza's avatar
Matija Obreza committed
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:security="http://www.springframework.org/schema/security"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context-3.1.xsd
       http://www.springframework.org/schema/mvc
       http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
       http://www.springframework.org/schema/security
       http://www.springframework.org/schema/security/spring-security-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">

Matija Obreza's avatar
Matija Obreza committed
33
34
	<context:property-placeholder ignore-resource-not-found="true" location="classpath:/application.properties,classpath:/spring/spring.properties,classpath:/genesys.properties" />

Matija Obreza's avatar
Matija Obreza committed
35
36
37
38
    <mvc:annotation-driven validator="validator">
        <mvc:argument-resolvers>
            <bean class="org.springframework.data.web.PageableArgumentResolver"/>
        </mvc:argument-resolvers>
Matija Obreza's avatar
Matija Obreza committed
39
      <!--   <mvc:message-converters>
Matija Obreza's avatar
Matija Obreza committed
40
41
42
            <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
                <property name="objectMapper" ref="objectMapper"/>
            </bean>
Matija Obreza's avatar
Matija Obreza committed
43
        </mvc:message-converters> -->
Matija Obreza's avatar
Matija Obreza committed
44
45
46
47
48
    </mvc:annotation-driven>

    <mvc:default-servlet-handler/>

    <!--Controllers-->
49
    <context:component-scan base-package="org.genesys2.server.servlet.filter,org.genesys2.server.servlet.controller" />
Matija Obreza's avatar
Matija Obreza committed
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

    <aop:aspectj-autoproxy/>

    <!--Support @Secured and @PreAuthorize AOP interceptors in @Controller beans-->
    <!--<security:global-method-security pre-post-annotations="enabled"/>-->

    <!--Do not filter static resources-->
    <mvc:resources mapping="/html/**" location="/html/"/>

    <!--Default resolver-->
    <bean name="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/jsp"/>
        <property name="suffix" value=".jsp"/>
        <property name="exposeContextBeansAsAttributes" value="true"/>
        <property name="exposedContextBeanNames">
            <list>
                <value>props</value>
Matija Obreza's avatar
Matija Obreza committed
67
                <value>jspHelper</value>
Matija Obreza's avatar
Matija Obreza committed
68
69
            </list>
        </property>
70
        <property name="redirectHttp10Compatible" value="false" />
71
		<property name="requestContextAttribute" value="requestContext"/>
Matija Obreza's avatar
Matija Obreza committed
72
73
74
75
    </bean>

    <!--Handle common exceptions-->
    <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
Matija Obreza's avatar
Styling    
Matija Obreza committed
76
77
        <!-- <property name="defaultErrorView" value="/500"/>
         --><property name="exceptionMappings">
Matija Obreza's avatar
Matija Obreza committed
78
79
80
81
82
83
84
85
86
            <value>
                javax.servlet.UnavailableException=/404
            </value>
        </property>
    </bean>

    <bean name="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        <property name="basename" value="classpath:content/language"/>
        <property name="defaultEncoding" value="UTF-8"/>
Matija Obreza's avatar
Matija Obreza committed
87
88
        <!-- Ease development -->
        <property name="useCodeAsDefaultMessage" value="true" />
Matija Obreza's avatar
Matija Obreza committed
89
90
91
92
93
94
95
96
    </bean>

    <!--Interceptors-->
    <mvc:interceptors>
        <!--locale interceptor-->
        <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
            <property name="paramName" value="lang"/>
        </bean>
Matija Obreza's avatar
Stuff    
Matija Obreza committed
97
        <!-- Stick user to view -->
98
        <bean class="org.genesys2.spring.AddStuffInterceptor" />
99
100
        <!-- theme interceptor -->
        <ref bean="themeChangeInterceptor" />
Matija Obreza's avatar
Matija Obreza committed
101
102
103
    </mvc:interceptors>

    <!--Locale resolver-->
104
    <bean name="localeResolver" class="org.genesys2.spring.BetterSessionLocaleResolver">
Matija Obreza's avatar
Matija Obreza committed
105
        <property name="defaultLocale" value="en"/>
106
107
108
        <property name="supportedLocales">
        	<set>
        		<value>en</value>
Matija Obreza's avatar
Matija Obreza committed
109
110
        		<value>ar</value>
        		<value>de</value>
111
112
        		<value>es</value>
        		<value>fa</value>
Matija Obreza's avatar
Matija Obreza committed
113
114
115
        		<value>fr</value>
        		<value>pt</value>
        		<value>ru</value>
Matija Obreza's avatar
i18n zh    
Matija Obreza committed
116
        		<value>zh</value>
117
118
119
        		<!-- <value>sl</value> -->
        	</set>
        </property>
Matija Obreza's avatar
Matija Obreza committed
120
121
    </bean>

122
123
124
125
126
127
128
129
130
	<!-- Theme Change Interceptor and Resolver definition -->
	<bean id="themeChangeInterceptor"
		class="org.springframework.web.servlet.theme.ThemeChangeInterceptor">
		<property name="paramName" value="theme" />
	</bean>
	<bean id="themeResolver"
		class="org.springframework.web.servlet.theme.CookieThemeResolver">
		<property name="defaultThemeName" value="${theme.defaultThemeName}" />
	</bean>
Matija Obreza's avatar
Matija Obreza committed
131
</beans>