java - HttpServletRequest variable with slash vs %2f -


here controller:

@requestmapping(method = requestmethod.get, value="/test/**", headers="accept=*/*") public @responsebody responseentity<byte[]> getrequest(httpservletrequest request)  {         system.out.println((string) request.getattribute( handlermapping.path_within_handler_mapping_attribute )); } 

whenever want create getrequest looking this: localhost:8080/test/some/request/given/in system out write in console:

some/request/given/in

as want to. problem comes when have instead of slash - / symbol %2f or %2f. when have symbols in path request not handled controller @ all.

is there way fix this?

typically of application server not not treat %2f / if %2f found in url. specs declare %2f 1 of ways path delimiter can specified, handling scenario, tomcat provides system level property

for tomcat, if

org.apache.tomcat.util.buf. udecoder.allow_encoded_slash = true 

then %2f , %5c permitted path delimiters. refer documentation. can set java_opts in tomcat batch files follows

set java_opts=%java_opts% %logging_config%   -dorg.apache.tomcat.util.buf.udecoder.allow_encoded_slash=true 

this specifically tomcat. sure there similar arrangement other application servers well.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -