Java Reading Undecoded URL from Servlet

前端 未结 5 982
误落风尘
误落风尘 2021-02-10 02:32

Let\'s presume that I have string like \'=&?/;#+%\' to be a part of my URL, let\'s say like this:

example.com/servletPath/someOtherPath/myString/something.ht         


        
5条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-10 02:42

    According to the Javadoc, getRequestURI should not decode the string. On the other hand, getServletPath return a decoded string. I tested this locally using Jetty and it behaves as described in the doc.

    So there might be something else at play in your situation since the behavior you're describing doesn't match the Sun documentation.

提交回复
热议问题