2012/6/23 <[email protected]>: > No, my application has context path "/" so application should handle > everything at root and it does as expected but only one character breaks > something. I know that the character "\" is not path separator but for some > reason it treated specially. > > The problem is that I can handle any request except requests with character > "\". But I what to handle ALL. I just wondered why it looks impossible. > > Konstantin Kolinko писал 2012-06-23 09:28: >> >> 2012/6/22 <[email protected]>: >>> >>> Hello all >>> >>> I have problem with URL mappings with embedded tomcat 7 >>> >>> I whant to handle all requests to my applications. I added filter with >>> mapping /* for my application with context path "/" >>> >>> FilterMap errorFilter = new FilterMap(); >>> errorFilter.setFilterName("errors-filter"); >>> errorFilter.addURLPattern("/*"); >>> ctx.addFilterMap(errorFilter); >>> >>> >>> This works fine in most cases except the cases when "\" character is in >>> the >>> request URL. >>> >>> For examle >>> >>> localhost:9999/test/path handled correctly, but >>> localhost:9999/test\path is not handled and server just returns blank >>> page >>> >>> Any ideas? >>> >> >> What is the name of your web application? If it is "test" then the >> "test\path" page is handled by the ROOT webapp. The "\" is not a >> separator. It is just a character. >> >> If you do not have ROOT webapp, then an attempt to access it will >> return a zero-length response, but with correct HTTP response code and >> reason phrase. >>
Trying with current 7.0.x and Firefox, access log shows: 127.0.0.1 - - [23/Jun/2012:11:56:52 +0400] "GET /test%5Cpath HTTP/1.1" 400 - So Tomcat rejects this request as invalid (400) at an early stage of processing. If I configure Tomcat with the following system property, org.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=true then request is processed (results in 404, obviously) 127.0.0.1 - - [23/Jun/2012:12:01:45 +0400] "GET /test%5Cpath HTTP/1.1" 404 996 BTW, the correct context path for the ROOT application is "", not "/". Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
