Announcement Announcement Module
Collapse
No announcement yet.
Locale with secureHandlerMapping and defaultHandlerMapping Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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">
    <list>
    <ref local="localeChangeInterceptor"/>
    </list>
    </property>
    <property name="mappings">
    <props>
    <prop key="/index.do">/signon.do</prop>
    <prop key="/signon.do">/signon.do</prop>
    </props>
    </property>
    </bean>


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



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

    <bean id="secureHandlerMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="interceptors">
    <list>
    <ref bean="signonInterceptor"/>
    </list>
    </property>
    <property name="urlMap">
    <map>
    <entry key="/editAccount.do"><ref local="secure_editAccount"/></entry>
    <entry key="/index.do"><ref local="secure_index"/></entry>
    <entry key="/search_users.do"><ref local="secure_search_users"/></entry>
    <entry key="/addProgram.do"><ref local="add_program"/></entry>
    <entry key="/saveProgram.do"><ref local="save_Program"/></entry>
    <entry key="/searchProgram.do"><ref local="search_Program"/></entry>
    <entry key="/addProducers.do"><ref local="new_Author"/></entry>
    <entry key="/adminIndex.do"><ref local="admin_index"/></entry>
    <entry key="/userActivation.do"><ref local="activation"/></entry>
    <entry key="/sendEmail.do"><ref local="send_email"/></entry>
    <entry key="/printProgram.do"><ref local="print_program"/></entry>
    </map>
    </property>
    </bean>
Working...
X