Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] Looking for Jetty HttpClient that downloads large zip files ...

Hi Simone, Yes any help would be appreciated ... See my comment in code below:  // ***
Thanks, -Alan

import org.eclipse.jetty.client.api.AuthenticationStore;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.Result;
import org.eclipse.jetty.client.util.BasicAuthentication;
import org.eclipse.jetty.client.util.BufferingResponseListener;

 * Testcode driver
final public class App {
    public static void main(String[] args) throws Exception {
        HttpClient httpClient = new HttpClient();

        String url = "" href="http://localhost:8080/">http://localhost:8080/";
        URI uri = new URI(url);

        String realm = "MyRealm";
        String u = "u1";
        String p = "p1";

        AuthenticationStore auth = httpClient.getAuthenticationStore();
        auth.addAuthentication(new BasicAuthentication(uri, realm, u, p));

                // Buffer response content up to 8 MiB
                .send(new BufferingResponseListener(8 * 1024 * 1024)
                    public void onComplete(Result result)
                        if (!result.isFailed())
                            byte[] responseContent = getContent();
                        } else {

         // *** Right after httpClient.newRequest it goes here!  

On Wed, Sep 14, 2016 at 11:58 AM, Simone Bordet <sbordet@xxxxxxxxxxx> wrote:

On Wed, Sep 14, 2016 at 6:52 PM, Alan Nexus <> wrote:
> Thank you Simone. I did look at this, but I couldn't get it to work with a
> large file (>1GB).  The lack of a complete example is often the critical
> piece especially when dealing with larger files (ideally a testcase).

What problems did you have ?
Can you share your code ?

Simone Bordet
Developer advice, training, services and support
from the Jetty & CometD experts.
jetty-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top