-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Jérémie,
On 2/17/15 6:20 AM, Jérémie Barthés wrote: > I just installed tomcat 8 and used the RewriteValve to forward some > old URLs on my new tomcat8 webapp. I had an issue for URIs > targeting a folder: If there is no "/" at the end of the URI, the > rewritten URI is visible for the client browser (302 redirection). > Example : http://myhost.com/myFolder => > http://myhost.com/rewriteTrick/myFolder/ instead of > http://myhost.com/myFolder => http://myhost.com/myFolder/ > > I made a custom patch on RewriteValve to solve it. I would like to > know if it'll be corrected on next releases. (i tried on 8.0.18 but > there is still the issue) > > Regards, > > Jeremie Barthes Oodrive France > > > > Between lines 480 and 500 : > > boolean folderRedirect = false; try{ > request.getMappingData().recycle(); > > request.getConnector().getService().getMapper().map(request.getCoyoteRequest().serverName(), > > request.getCoyoteRequest().requestURI(), > null, request.getMappingData()); > > if(request.getMappingData().redirectPath.toString()!=null){ > folderRedirect = true; } } catch (Exception e){ //ignore } > > request.getMappingData().recycle(); // Reinvoke the whole request > recursively try { > > request.getConnector().getProtocolHandler().getAdapter().service > (request.getCoyoteRequest(), response.getCoyoteResponse()); > if(folderRedirect && response.getCoyoteResponse().getStatus() == > 302){ > > if(!request.getCoyoteRequest().requestURI().getByteChunk().toString().endsWith("/")){ > > String requestParam = request.getQueryString() == null ? "" : '?' > + request.getQueryString(); response.setHeader("Location", > request.getCoyoteRequest().requestURI().getByteChunk().toString() + > '/' + requestParam); } } } catch (Exception e) { // This doesn't > actually happen in the Catalina adapter implementation } The best practice would be to file an enhancement request in Bugzilla, write and attach a test case that demonstrates the problem (or describe it in very great detail... from the above, I don't know what you have changed and why), and attach your changes (as a patch, using "svn diff" or something similar) to the Bugzilla issue. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJU41FiAAoJEBzwKT+lPKRYJVwP/0txV+MSHwzl4FQjRWd2gaOS V+l0b7CIXI77lHr+xuC6A/OqqpJHNPZjYWIqtCaeDvq/eFc8eVXczV8C6CV1NWN5 b9dQdBTw4/+bC/JNg2XlWkwlbeW08eNqeX77F1zXhSoBEUuZrRcmy/sZXsa4g9x8 XusQqrjpjc5KvZOkUqJbazbKO86o7kRrOuVNVXR0MHtpmBMOkCI0WKht+RpsA3DN fH0Qd+eo0xtmU0YNSMURr6Z8y+yi3v/pNx4tBQ5ijEAHXB8f9SolfObt63OrcTh3 I347ZIEESfkeqxqBqImJkeRsqvlx2pv2ChF0fm638vgiYFXU+a4xYLP45ovR0wg6 c4P0GYK3mE2yieQjio3zAj/Z9Qc4DW39FJNIeU1zYY+73yzkn28CprW6nn9eaRvf cz+vaU2IamD/e4vJgHpiB5vewwaZSx1a81OkpDn8O7xWyO4azp4eViA2K5jwM2Cf LL7/fztfJoapob+polncNECb3Bi3aT/yKeI9tbunb7x8jCHqIBWtGrvKJ0U5q25U XzH1Wk6EZCtYhiYXQvyPoktKmXfDuayMiq+IexdMBic+I/Uqv5scQuFrjEZVlFj+ hSNd9OpPQwXKL7ScFAyznw6R4h5yzPZyW01KtO1jVek1oOOdIRI7PxLRgJReh6j0 78GINeUMF8NCRkYY4/sf =zX1T -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org