Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

webapp-context.xml

By: a guest on Apr 24th, 2012  |  syntax: XML  |  size: 3.32 KB  |  views: 86  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.     <?xml version="1.0" encoding="UTF-8"?>
  2.         <bean id="myRealm" class="com.bah.MyRealmImpl">
  3.         </bean>
  4.         <mvc:annotation-driven/>
  5.         <import resource="classpath*:applicationContext.xml"/>
  6.         <mvc:view-controller path="/" view-name="index"/>
  7.         <mvc:interceptors>
  8.             <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"/>
  9.         </mvc:interceptors>
  10.         <mvc:resources mapping="/resources/**" location="/static/"/>
  11.         <bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver"/>
  12.  
  13.         <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
  14.             <property name="securityManager" ref="securityManager"/>
  15.             <property name="loginUrl" value="/login"/>
  16.             <property name="successUrl" value="/home"/>
  17.             <property name="unauthorizedUrl" value="/unauthorized"/>
  18.             <property name="filterChainDefinitions">
  19.                 <value>
  20.                     # some example chain definitions:
  21.                     /login=authc
  22.                     /lists/**=authc,roles[admin]
  23.                 </value>
  24.             </property>
  25.         </bean>
  26.         <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
  27.          </bean>
  28.         <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
  29.  
  30.         <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
  31.             <property name="mediaTypes">
  32.                 <map>
  33.                     <entry key="html" value="text/html"/>
  34.                     <entry key="json" value="application/json"/>
  35.                 </map>
  36.             </property>
  37.  
  38.             <!--todo create resolvers for both html and json-->
  39.             <property name="viewResolvers">
  40.                 <list>
  41.  
  42.                     <bean class="org.springframework.web.servlet.view.UrlBasedViewResolver" id="tilesViewResolver">
  43.                         <property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/>
  44.                     </bean>
  45.  
  46.                     <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  47.                         <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
  48.                         <property name="prefix" value="/WEB-INF/views/"/>
  49.                         <property name="suffix" value=".jsp"/>
  50.                     </bean>
  51.                 </list>
  52.             </property>
  53.             <property name="defaultViews">
  54.                 <list>
  55.                     <bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView">
  56.                         <property name="prefixJson" value="true"/>
  57.                     </bean>
  58.                 </list>
  59.             </property>
  60.         </bean>
  61.         <bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer" id="tilesConfigurer">
  62.             <property name="definitions">
  63.                 <list>
  64.                     <value>/WEB-INF/layouts/layouts.xml</value>
  65.                     <!-- Scan views directory for Tiles configurations -->
  66.                     <value>/WEB-INF/views/**/views.xml</value>
  67.                 </list>
  68.             </property>
  69.         </bean>
  70.     </beans>