HttpServletRequestでURLの情報を取得

HttpServletRequestでURLの情報を取得

参考URL https://book.mynavi.jp/support/bookmook/tukurujava/

private void do(HttpServletRequest request , Hoge hoge)  {

   //http://localhost:8080/path/to/file.html?query=abc
   request.getRequestURL();

   //http
   request.getScheme();

   //localhost
   request.getServerName();

   //8080
   request.getServerPort();

   ///path/to/file.html
    request.getRequestURI();

   //query=abc
    request.getQueryString();
}