メソッドrequest.getRequestURI()は、コンテキストパスを持つURIを返します。例えばコンテキストパスなしでリクエストURIを取得するにはどうすればよいですか?
アプリケーションのベースURL(すなわちコンテキストパスがmyappのある)http://localhost:8080/myapp/
であり、Iは、http://localhost:8080/myapp/secure/users
ためrequest.getRequestURI()
を呼び出した場合、それは、/myapp/secure/users
を返します。
/secure/users
というこの部分のみを取得する方法はありますか?つまり、コンテキストパスのないURIはありますか?
の可能重複[HttpServletRequestの中getRequestURIとgetPathInfoメソッドの違いは何?] (http://stackoverflow.com/questions/4931323/whats-the-difference-between-getrequesturi-and-getpathinfo-methods-in-httpservl) – Leonel