protected void copyRequestHeaders(HttpServletRequest servletRequest,HttpRequest proxyRequest){
  Enumeration enumerationOfHeaderNames=servletRequest.getHeaderNames();
  while (enumerationOfHeaderNames.hasMoreElements()) {
    String headerName=(String)enumerationOfHeaderNames.nextElement();
    if (headerName.equalsIgnoreCase(HttpHeaders.CONTENT_LENGTH))     continue;
    if (hopByHopHeaders.containsHeader(headerName))     continue;
    Enumeration headers=servletRequest.getHeaders(headerName);
    while (headers.hasMoreElements()) {
      String headerValue=(String)headers.nextElement();
      if (headerName.equalsIgnoreCase(HttpHeaders.HOST)) {
        HttpHost host=getTargetHost(servletRequest);
        headerValue=host.getHostName();
        if (host.getPort() != -1)         headerValue+=":" + host.getPort();
      }
 else       if (headerName.equalsIgnoreCase(org.apache.http.cookie.SM.COOKIE)) {
        headerValue=getRealCookie(headerValue);
      }
      proxyRequest.addHeader(headerName,headerValue);
    }
  }
}

protected void copyRequestHeaders ( HttpServletRequest servletRequest , HttpRequest proxyRequest ) { Enumeration enumerationOfHeaderNames = servletRequest . getHeaderNames ( ) ; while ( enumerationOfHeaderNames . hasMoreElements ( ) ) { String headerName = ( String ) enumerationOfHeaderNames . nextElement ( ) ; if ( headerName . equalsIgnoreCase ( HttpHeaders . CONTENT_LENGTH ) ) continue ; if ( hopByHopHeaders . containsHeader ( headerName ) ) continue ; Enumeration headers = servletRequest . getHeaders ( headerName ) ; while ( headers . hasMoreElements ( ) ) { String headerValue = ( String ) headers . nextElement ( ) ; if ( headerName . equalsIgnoreCase ( HttpHeaders . HOST ) ) { HttpHost host = getTargetHost ( servletRequest ) ; headerValue = host . getHostName ( ) ; if ( host . getPort ( ) != - 1 ) headerValue += ":" + host . getPort ( ) ; } else if ( headerName . equalsIgnoreCase ( org . apache . http . cookie . SM . COOKIE ) ) { headerValue = getRealCookie ( headerValue ) ; } proxyRequest . addHeader ( headerName , headerValue ) ; } } }
copy request headers from the servlet client to the proxy request .
