Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Wrapper for Jetty Client ?

Hi,

On Fri, Nov 9, 2012 at 2:34 AM, Jacques Poulin <jacques.poulin@xxxxxxxxx> wrote:
> Hello all,
>
> I have been using HttpClient 3.1 for a while now, and am looking for an
> alternative.
>
> I found a few options, Jetty Client is one of them.
>
> I think that it would fulfill my requirements : I basically want to be able
> to reproduce the behaviour of <insert browser name> while navigating through
> an authenticated session on any web site.  An example would be a class that
> would login on my bank's web site and download all transaction data.
>
> I would want the class(es) to be able to :
>
> - send GET requests
> - send POST requests
> - add POST parameters
> - add request headers (Referer, etc...)
> - manage cookies (keep received cookies, but also allow the caller to
> manually remove/add cookies)
> - manage GET and POST redirects automatically
> - manage compressed responses
> - handle multiple callers, for multiple web sites, at the same time
>
> The interface would probably expose one public method, with the following
> parameters :
>
> - target url
> - method type (GET or POST)
> - map of request headers
> - map of post parameters
>
> It would return the resulting HTML.
>
> I've coded such a library with HttpClient, it works for most purposes, but
> it's far from perfect.  I've spent a significant amount of time coding it,
> and want to avoid spending that much time on a new library using Jetty
> Client.
>
> Does anyone know of a project that does what I'm looking for ?
>
> Or, are there already wrapper classes in Jetty Client that provides this
> functionality ?
>
> Or, maybe there's some kind soul that has already coded this and is willing
> to share ?

You should look at Jetty 9's new HttpClient.

It has a totally rewritten API, it's way faster, non-blocking, with a
lot more features and fully configurable.

Documentation is coming soon, but you can look at this class for
examples of how to use it:
http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-client/src/test/java/org/eclipse/jetty/client/api/Usage.java

Oh, and it's JDK 8's lambda ready.

Simon
--
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
----
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless.   Victoria Livschitz


Back to the top