hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: Problem with a router servlet - end client cannot get response
Date Thu, 10 Aug 2006 16:37:55 GMT
Hello Xinjun,

I suggest you take a long, good, in-depth look at RFC 2616:
http://www.ietf.org/rfc/rfc2616.txt
There are PDF versions on the web if you prefer that.
In particular, you should study *everything* the RFC says
about proxies, because that's what your "router" is. And
there is a whole lot about proxies, including information
on which header fields must be passed through by a proxy
and which ones are strictly link-to-link and MUST NOT be
passed on to the next server. Once you've done that, fix
the following part of your code:

> Enumeration headerNames = request.getHeaderNames();
> while (headerNames.hasMoreElements()) {
>    String name = (String) headerNames.nextElement();
>    Enumeration values = request.getHeaders(name);
>    while(values.hasMoreElements()) {
>        String value = (String) values.nextElement();
>        log.debug(name + ":" + value + "\n");
>        method.addRequestHeader(name, value);
>    }
>}

and also this:

> Header[] headers = method.getResponseHeaders();
>    int headerSize = headers.length;
>    for (int i = 0; i < headerSize; i++) {
>        log.debug(headers[i].getName() + ":-" + headers[i].getValue());
>        response.addHeader(headers[i].getName(), headers[i].getValue());
>    }

The following part is questionable, since one of the headers
usually specifies which footers are to expect, and turning
footers into header could make the request invalid:

>    Header[] footers = method.getResponseFooters();
>    int footerSize = footers.length;
>    for (int i = 0; i < footerSize; i++) {
>        log.debug(footers[i].getName() + ":-" + footers[i].getValue());
>        response.setHeader(footers[i].getName(), footers[i].getValue());
>    }

On the other hand, it shouldn't matter. You're trying to access
the footers before receiving the message body, so they aren't
yet available anyway.

cheers,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message