Announcement Announcement Module
No announcement yet.
Locale with secureHandlerMapping and defaultHandlerMapping Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Locale with secureHandlerMapping and defaultHandlerMapping

    I can't get Locale changing work with defaultHandlerMapping.

    I'm was using as defaultHandlerMapping:

    <bean id="defaultHandlerMapping" class="org.springframework.web.servlet.handler.Bea nNameUrlHandlerMapping"/>

    but now if I want to provide to user a selection of different languages in the front page before logging in to system, I have understood that I must use SimpleUrlHandlerMapping.

    Later on in servlet-xml file I'm specifying secureHandlerMapping, because most of pages must be protected.

    Now when I changed BeanNameUrlHandlerMapping to SimpleUrlHandlerMapping, Locale works, but then navigation is messed up.

    My servlet.xml file is actually similar than jpetstores file.

    Can anybody provide example, how I could get Locale and navigation work together?

    servlet.xml is at the moment like:

    <bean id="defaultHandlerMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="interceptors">
    <ref local="localeChangeInterceptor"/>
    <property name="mappings">
    <prop key="/">/</prop>
    <prop key="/">/</prop>

    <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.Locale ChangeInterceptor">
    <property name="paramName"><value>siteLanguage</value></property>

    <!-- ========================= DEFINITIONS OF PROTECTED CONTROLLERS ========================= -->

    <bean id="secureHandlerMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="interceptors">
    <ref bean="signonInterceptor"/>
    <property name="urlMap">
    <entry key="/"><ref local="secure_editAccount"/></entry>
    <entry key="/"><ref local="secure_index"/></entry>
    <entry key="/"><ref local="secure_search_users"/></entry>
    <entry key="/"><ref local="add_program"/></entry>
    <entry key="/"><ref local="save_Program"/></entry>
    <entry key="/"><ref local="search_Program"/></entry>
    <entry key="/"><ref local="new_Author"/></entry>
    <entry key="/"><ref local="admin_index"/></entry>
    <entry key="/"><ref local="activation"/></entry>
    <entry key="/"><ref local="send_email"/></entry>
    <entry key="/"><ref local="print_program"/></entry>