Return-Path: Delivered-To: apmail-jakarta-httpclient-user-archive@www.apache.org Received: (qmail 16778 invoked from network); 11 Aug 2006 06:48:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Aug 2006 06:48:19 -0000 Received: (qmail 41524 invoked by uid 500); 11 Aug 2006 06:48:19 -0000 Delivered-To: apmail-jakarta-httpclient-user-archive@jakarta.apache.org Received: (qmail 41388 invoked by uid 500); 11 Aug 2006 06:48:18 -0000 Mailing-List: contact httpclient-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: "HttpClient User Discussion" Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-user@jakarta.apache.org Received: (qmail 41377 invoked by uid 99); 11 Aug 2006 06:48:18 -0000 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of xjchen001@gmail.com designates 64.233.182.188 as permitted sender) Received: from [64.233.182.188] (HELO nf-out-0910.google.com) (64.233.182.188) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Aug 2006 23:48:18 -0700 Received: by nf-out-0910.google.com with SMTP id y25so784136nfb for ; Thu, 10 Aug 2006 23:46:57 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=SyzkLgG0McjW00Ah9xD1VM/KPj7iq0yoOrVZ9cm3P4vF0HPmL6B12t/C6aD3GD56UjWnMY29q9KLteI3aIR6vR6sBJIFDvhHei/4lixzTUNp5ZhYrCxLNu7Ydl1V+yYkCJz6zgQLrDPe/6Jy4/+WerUi4t02zHPxaqKzccgBj7M= Received: by 10.49.91.6 with SMTP id t6mr3693332nfl; Thu, 10 Aug 2006 23:46:57 -0700 (PDT) Received: by 10.48.206.18 with HTTP; Thu, 10 Aug 2006 23:46:57 -0700 (PDT) Message-ID: <84f31d220608102346g500b9062u6be162afd69c6f2a@mail.gmail.com> Date: Fri, 11 Aug 2006 14:46:57 +0800 From: "Xinjun Chen" To: "HttpClient User Discussion" Subject: Re: Problem with a router servlet - end client cannot get response In-Reply-To: <44DB60E3.50700@dubioso.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <84f31d220608100921r6092968u5b1c4466e5b8d1f3@mail.gmail.com> <44DB60E3.50700@dubioso.net> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi Roland, Thank you very much for your suggestion. I really have not yet read through the RFC2616. I knows about HTTP from books talking about J2EE. I have started reading RFC2616. I have inspected the log messages, and find that no footers are involved. And another finding is that the target service is actually executed! But the router servlet cannot successfully send the response to the end client. The other query is why the router servlet works fine for some web services. I hope I can find the answer soon. Regards, Xinjun On 8/11/06, Roland Weber wrote: > 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 > > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-user-help@jakarta.apache.org