hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pieter Coucke" <pieter.cou...@onthoo.com>
Subject Re: NhttpClient and proxy
Date Mon, 24 Nov 2008 16:13:12 GMT
Thanks for the clarification.  I was wondering already why there was so few
documentation about a non-blocking httpclient.  This clarifies the reason
;-)
I'm sorry but my knowledge of http protocols is too limited to help you
here.


Anyway, I found how to use a proxy by reading some documentation about the
required headers on the web.  In case anyone is interested, I've made these
changes:

// Connect to the proxy instead of to the target host
ioReactor.connect(new InetSocketAddress(proxyHost,
proxyPort),null,holder,callback);

// Use a full url in the HttpRequest
public HttpRequest submitRequest(final HttpContext context) {
...
BasicHttpRequest request;
  if (this.proxy != null) {
     // A proxy expects to use the full url instead of just the file
     request = new BasicHttpRequest("GET", holder.url.toString());
  } else {
    request = new BasicHttpRequest("GET", holder.url.getFile());
  }
}


On Mon, Nov 24, 2008 at 1:53 PM, Oleg Kalnichevski <olegk@apache.org> wrote:

> On Mon, 2008-11-24 at 12:05 +0100, Pieter Coucke wrote:
> > Hi,
> >
> > I would like to use a proxy (Squid) with the example code from
> >
> http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
> .
> >
> > I tried to set the params with
> > params.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
> >
> > and also in the HttpRequestExecutionHandler#initializeContext() I tried
> it with
> > context.setAttribute(ExecutionContext.HTTP_PROXY_HOST, proxy);
> >
> > However, both without success.  Can someone maybe point me to what I'm
> > missing here?
> >
> > Thanks a lot!
> >
> > Pieter
> >
>
> Pieter,
>
> HttpCore provides components for the basic HTTP transport functionality,
> both server and client side. It is intended to transmit HTTP messages
> from one endpoint to another, and that is it. HTTP state management,
> authentication, connection management and support for request proxying
> is out of scope for HttpCore. Those aspects are meant to be implemented
> on top of HttpCore by specialized modules such as HttpClient. Currently
> we have a version of HttpClient based on classic (blocking) I/O model, a
> successor to Commons HttpClient 3.1. There are also plans to develop an
> asynchronous version of HttpClient based on HttpCore NIO but no work has
> started yet. I am very reluctant to open a new major construction site
> _unless_ there is at least a few people committed to contributing to
> such an effort and maintaining the code mid / long term.
>
> Oleg
>
>
>
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message