Paul
Paul

Reputation: 316

Doing an embedded HTTP server with Comet

I love the idea of Grizzly, but I can't find any good examples to work with. Well, any good tutorial... I want to have an embedded HTTP server that I can talk to from Dojo. I don't want a J2EE server and I want to use Java. What do you folks think?

Upvotes: 2

Views: 647

Answers (3)

Supertux
Supertux

Reputation: 8318

StreamHub Push Server is a Comet server written in Java. you can use it as a JAR to embed it in your stack. It also works as a simple HTTP server. It's not integrated with dojo.io but there are plenty of good examples using a simple javascript library.

var hub = new StreamHub();
hub.connect("http://localhost:7979/");
hub.subscribe("MyTopic", function(topic, json) {
    alert("got update on topic: " + topic + " MyField=" + json['MyField']);
});
// ...

Oh, and for a good tutorial try Getting Started with StreamHub and Comet.

Upvotes: 3

skaffman
skaffman

Reputation: 403581

Jetty has support for asynch servlet continuations and comet-style programming. See the documentation index. It can also be easily run embedded within another java application

Upvotes: 2

Billy Bob Bain
Billy Bob Bain

Reputation: 2895

Java6 has a simple embedded http server.

http://java.sun.com/javase/6/docs/jre/api/net/httpserver/spec/index.html

Upvotes: 2

Related Questions