A GWT port of the DUI.Stream library
Java
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.settings
src/main/java/teropa/mxhr
war
.classpath
.gitignore
.project
LICENSE
README.md
pom.xml

README.md

gwt-mxhr

Gwt-mxhr is a GWT port of the DUI.Stream library.

It leverages a technique called Multipart XMLHttpRequest (described in a blog post by the Digg guys) which is useful in situations where a large amount of dynamic resources (images, CSS, JavaScript, ect.) needs to be fetched from the server. It eliminates the HTTP overhead by streaming the resources back in a single HTTP response.

Installation

There are no releases yet, so you'll have to build the thing yourself.

  1. Clone the git repo
  2. mvn package in the project directory
  3. Copy target/mxhr-0.0.1-SNAPSHOT.jar to your project libraries
  4. Add the following to your GWT XML descriptor:

    <inherits name='teropa.mxhr.GwtMxhr'/>
    

Usage

See Demo.java

MXHR request = new MXHR();

request.addContentReceivedHandler(new ContentReceivedHandler() {
  public void onContentReceived(ContentReceivedEvent evt) {
    // do stuff with evt.mimeType and evt.payload
  }
});

request.addContentCompleteHandler(new ContentCompleteHandler() {
  public void onContentComplete(ContentCompleteEvent evt) {
    // everything received!
  }
});

request.load("/some/url");

Server-side

The server must have a service that is capable of sending back multipart responses. The DUI.Stream repo has examples in Java, Perl, Python, and Ruby.

Hacking

Just clone the Git repo and import it to your Eclipse workspace. You should have Google Plugin for Eclipse installed.

License

Copyright (c) 2010 Tero Parviainen

Logic based on DUI.Stream, Copyright (c) 2009, Digg, Inc.

MIT license (see LICENSE).