Announcement Announcement Module
Collapse
No announcement yet.
Just a quick one Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Just a quick one

    Hi Guys,

    I have a link

    HTML Code:
    http://localhost:8080/servlet/provider?p%3Dc880fb7c50c2e2de66d33882946a22fc%26u%3DemailUser%40example.com
    it has been encoded with URLEncoder.encode(<str>, "UTF-8");

    And a corresponding controller code:

    Code:
    @RequestMapping(method = RequestMethod.GET, params= {"p", "u"}, headers = {"content=text/html", "charset=UTF-8"})
    	public String activateRegistration(@RequestParam("p") String providerId, @RequestParam("u") String username) {
    		logger.debug("GET Request Param [p]: " + providerId);
    		logger.debug("GET Request Param [u]: " + username);
    		
    		return ControllerDefinitions.CHANGE_FIRST_PASSWORD_VIEW;
    	}
    As you may have guessed, the method does not match (however if the URL part after '?' is not encoded, it works fine.

    I also have this in my tomcat server.xml:
    Code:
    <Connector port="8080" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443" URIEncoding="utf-8" />
    And this in my servlet-context.xml at the very begining (ie first definition):

    HTML Code:
    <filter>
    		<filter-name>encodingFilter</filter-name>
    		<filter-class>
    			org.springframework.web.filter.CharacterEncodingFilter
    		</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-mapping>
    		<filter-name>encodingFilter</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    Does anyone have any ideas why would it *not* match on encoded GET params?


    Any ideas are greatly appreciated.

    Regards,

    M.

    P.S.
    The
    Code:
    headers = {"content=text/html", "charset=UTF-8"}
    are really there because I was willing to try anything (it does not work with it nor without)
Working...
X