config-proxy/src/main/java/org/ocpsoft/rewrite/servlet/config/proxy/ProxyServlet.java
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)
   {
      /*
       * 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 ) { /*
       * 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 {