Thank for your  fast answer

I would like to extend DefaultServlet to override doDirectoryRedirect but the method is private, private void doDirectoryRedirect(HttpServletRequest request, HttpServletResponse response)

May this method be protected in following versions ?

i can't change a header on the way out, after server started to answer, can i ?

Regard

Jeremie

PS : i added a custom valve just to put non-rewritten URI in a request attribute, so i can use it if present when doDirectoryRedirect occurs


Le 26/06/2017 à 12:01, Mark Thomas a écrit :
On 26/06/17 10:55, Jérémie Barthés wrote:
Hi,

I have an issue between org.apache.catalina.valves.rewrite.RewriteValve
and org.apache.catalina.servlets.DefaultServlets

If my request is forwarded by the RewriteValve and then pass into
doDirectoryRedirect in DefaultServlets to be redirected. The hidden
rewritten URI is displayed in the browser.

To test it, try the following example (any tomcat 8, 8.5 or 9)

add RewriteValve in conf/server.xml
<Valve className="org.apache.catalina.valves.rewrite.RewriteValve"/>

add rewriteRule in conf/Catalina/localhost/rewrite.config
RewriteRule ^/iWantThisVisible/(.*) $/examples/$1/

start tomcat

go to following URLs (any internet browser) :
http://localhost:8080/iWantThisVisible/servlets
http://localhost:8080/iWantThisVisible/servlets/
That behaviour is expected.

If you want to stick with the RewriteValve you'll need to write a custom
Valve or Filter to modify the HTTP headers on the way out.

You might be better off writing a custom Servlet that does a forward.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to