Hi Guys,
I have a link
it has been encoded with URLEncoder.encode(<str>, "UTF-8");HTML Code:http://localhost:8080/servlet/provider?p%3Dc880fb7c50c2e2de66d33882946a22fc%26u%3DemailUser%40example.com
And a corresponding controller code:
As you may have guessed, the method does not match (however if the URL part after '?' is not encoded, it works fine.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; }
I also have this in my tomcat server.xml:
And this in my servlet-context.xml at the very begining (ie first definition):Code:<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="utf-8" />
Does anyone have any ideas why would it *not* match on encoded GET params?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>
Any ideas are greatly appreciated.
Regards,
M.
P.S.
Theare really there because I was willing to try anything (it does not work with it nor without)Code:headers = {"content=text/html", "charset=UTF-8"}


Reply With Quote