Frage

I'm trying to build a Java web app that will let me browse a remote file system behind my NAT router. The client can talk outbound HTTP only.

I've got my Java client on the remote machine talking to my Tomcat server, which is then serving the data back up as web pages. Something like this:

File Server (java client) -> Web Server <- Browser

What I can't figure out is how to have the Tomcat server talk back to the remote Java client.

What I want to happen is:

  • User clicks on a folder in their browser.
  • Browser ajaxes to the server.
  • The Tomcat server contacts the remote java client.
  • The remote java client responds with the directory listing.
  • The Tomcat server sends back the new data formatted as HTML to the user.

I've looked at Comet and Tomcat 7's asynchronous stuff but I'm struggling!

War es hilfreich?

Lösung

If you need full-duplex communication over HTTP, than I strongly recommend using Atmosphere and Web Sockets. It simplifies server push a lot, and it's container agnostic (the framework).

You can use Async Http Client library for your remote java client in that case.

Andere Tipps

If you want to implement a PUSH behavior, then Commet is the way to go.

If there are few clients, perhaps you could solve your requirements by allowing the client to continuosly PULL changes from the server each few seconds.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top