code: private void processRedirect(String stringStatusCode,
                                   HttpMethod httpMethodProxyRequest,
                                   HttpServletRequest httpServletRequest,
                                   HttpServletResponse httpServletResponse) throws Exception {
          // Check if the proxy response is a redirect
          // The following code is adapted from
          // org.tigris.noodle.filters.CheckForRedirect
          // Hooray for open source software
  
          String stringLocation = httpMethodProxyRequest.getResponseHeader(STRING_LOCATION_HEADER).getValue();
          if (stringLocation == null) {
              throw new ServletException("Received status code: "
                                             + stringStatusCode + " but no "
                                             + STRING_LOCATION_HEADER
                                             + " header was found in the response");
          }
          // Modify the redirect to go to this proxy servlet rather than the proxied host
          String stringMyHostName = httpServletRequest.getServerName();
          if (httpServletRequest.getServerPort() != 80) {
              stringMyHostName += ":" + httpServletRequest.getServerPort();
          }
          stringMyHostName += httpServletRequest.getContextPath();
          httpServletResponse.sendRedirect(stringLocation.replace(
              getProxyHostAndPort() + this.getProxyPath(),
              stringMyHostName));
      }
docs: Execute a redirected request
  
  @param stringStatusCode
  @param httpMethodProxyRequest
  @param httpServletRequest
  @param httpServletResponse
  @throws Exception