Embedded HTTP server

David M. Lloyd david.lloyd at redhat.com
Thu Jun 19 10:06:37 PDT 2008


On 06/19/2008 05:11 AM, Michael McMahon wrote:
> David,
> 
> It was originally intended that the httpserver API would be part of the
>  platform (actually in the package suggested above) but some members of
> the umbrella JSR for jdk 6 didn't agree with including a http server API
> in Java SE. So, it was dropped from the platform. And that is why we put
> it in com.sun.

Makes sense I guess.

> Personally, I wouldn't have any problem with putting it back in the 
> platform, though presumably this question of whether it blurs the line
> between Java SE and EE would have to be addressed.

For those who care about such things, sure.  I don't see any technical 
reason why that should be an obstacle, since there is no such API in Java 
EE either. :-)

 From a technical perspective, I'd really only make one change.  Right now, 
server contexts are registered on the HttpServer directly.   It would be 
nice if, instead of registering contexts, you just register a HttpHandler 
directly on the HttpServer, which always handles all HTTP requests to that 
server.

Then to provide the context-discrimination function, a ContextHttpHandler 
could be implemented which implements HttpHandler, and which in turn allows 
you to register per-context HttpHandlers.  This would make it a lot easier 
to implement, say, virtual hosts.

Thoughts?

- DML



More information about the net-dev mailing list