protected String rewriteUrlFromResponse(HttpServletRequest servletRequest, String theUrl)
   {
      /*
       * TODO document example paths
       */
      if (theUrl.startsWith(targetUri))
      {
         String curUrl = servletRequest.getRequestURL().toString();// no query
         String pathInfo = servletRequest.getPathInfo();
         if (pathInfo != null)
         {
            assert curUrl.endsWith(pathInfo);
            curUrl = curUrl.substring(0, curUrl.length() - pathInfo.length());// take pathInfo off
         }
         theUrl = curUrl + theUrl.substring(targetUri.length());
      }
      return theUrl;
   }
protected String rewriteUrlFromResponse(HttpServletRequest servletRequest, String theUrl)
   {
      
      if (theUrl.startsWith(targetUri))
      {
         String curUrl = servletRequest.getRequestURL().toString();
         String pathInfo = servletRequest.getPathInfo();
         if (pathInfo != null)
         {
            assert curUrl.endsWith(pathInfo);
            curUrl = curUrl.substring(0, curUrl.length() - pathInfo.length());
         }
         theUrl = curUrl + theUrl.substring(targetUri.length());
      }
      return theUrl;
   }
protected String rewriteUrlFromResponse ( HttpServletRequest servletRequest , String theUrl ) { /*
       * TODO document example paths
       */ if ( theUrl . startsWith ( targetUri ) ) { String curUrl = servletRequest . getRequestURL ( ) . toString ( ) ; // no query String pathInfo = servletRequest . getPathInfo ( ) ; if ( pathInfo != null ) { assert curUrl . endsWith ( pathInfo ) ; curUrl = curUrl . substring ( 0 , curUrl . length ( ) - pathInfo . length ( ) ) ; // take pathInfo off } theUrl = curUrl + theUrl . substring ( targetUri . length ( ) ) ; } return theUrl ; }
For a redirect response from the target server, this translates {@code theUrl} to redirect to and translates it to
one the original client can use.
For a redirect response from the target server this translates {