Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Roo Encoding issue

  1. #11

    Default

    Just to note:
    This had been mentioned previously but it should be fixed actually!
    https://jira.springsource.org/browse/ROO-1684
    https://jira.springsource.org/browse/ROO-1731

    So, if you didn't "play" with the order of <filter-mapping> in web.xml you shouldn't stumble over this issue anymore. Does it still occur?

    Cheers
    Alex

  2. #12

    Default

    <filter-mapping> not <filter> order is relevant, according to one comment in JIRA. Can you try that?

  3. #13
    Join Date
    Nov 2010
    Posts
    4

    Default

    I reached a solution by rearranging the tags filter and filter-mapping in the web.xml file as shown below:


    <filter>
    <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
    <filter-class>org.springframework.orm.jpa.support.OpenEnti tyManagerInViewFilter</filter-class>
    </filter>
    <filter>
    <filter-name>CharacterEncodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEnco dingFilter</filter-class>
    <init-param>
    <param-name>encoding</param-name>
    <param-value>UTF-8</param-value>
    </init-param>
    <init-param>
    <param-name>forceEncoding</param-name>
    <param-value>true</param-value>
    </init-param>
    </filter>
    <filter>
    <filter-name>HttpMethodFilter</filter-name>
    <filter-class>org.springframework.web.filter.HiddenHttpMet hodFilter</filter-class>
    </filter>
    <filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFil terProxy</filter-class>
    </filter>


    <filter-mapping>
    <filter-name>CharacterEncodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>HttpMethodFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>


    And it's work fine. I'm really happy

    Astronaute prove with this changes to confirm the same solution.

    thanks clandestino_bgd and aheusingfeld for helping us reach a solution

  4. #14
    Join Date
    Sep 2009
    Posts
    14

    Default

    Glad to see it works, I'll check this ASAP, probably tomorrow and comment here

    Thank you all.

  5. #15

    Default

    Just a note as I ran into a problem with this last year:

    In case you want to use Spring Security with HTTP method in intercept-url like the following
    Code:
    	<!-- HTTP security configurations -->
        <http auto-config="true" use-expressions="true">
        	<form-login login-processing-url="/static/j_spring_security_check" login-page="/login" authentication-failure-url="/login?login_error=t"/>
            <logout logout-url="/static/j_spring_security_logout"/>
    
            <!-- Configure these elements to secure URIs in your application -->
            <intercept-url pattern="/**" method="DELETE" access="hasRole('ROLE_SYSADMIN')"/>
            <intercept-url pattern="/admin/**/form" access="hasRole('ROLE_ADMIN_EDITOR') or hasRole('ROLE_SYSADMIN')"/>
            <intercept-url pattern="/order/**" access="hasRole('ROLE_ORDER_VIEWER') or hasRole('ROLE_ORDER_EDITOR') or hasRole('ROLE_SYSADMIN')" />
            <intercept-url pattern="/resources/**" access="permitAll" />
            <intercept-url pattern="/static/**" access="permitAll" />
            <intercept-url pattern="/**" access="permitAll" />
            <session-management session-fixation-protection="newSession"/>
        </http>

    you have to switch the order of the last two filter mappings:
    Code:
    <filter-mapping>
        <filter-name>CharacterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>HttpMethodFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    The reason is that HTML forms do always send data via POST or GET. As a workaround Spring MVC uses a hidden formfield supplying the intended HTTP method which is parsed by HttpMethodFilter.

    Happy Hacking!

    Cheers
    Alex

  6. #16
    Join Date
    Mar 2011
    Posts
    1

    Default It really works

    OOO Thank you very much. I'm soooo happy.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •