Embedded HTTP server

Michael McMahon Michael.McMahon at Sun.COM
Fri Jun 20 04:30:11 PDT 2008


David M. Lloyd wrote:
> 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. :-)
>
True. However, the servlet API provides a lot of the same thing ...
> 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.
>
You mean a kind of two level handler setup - one for the server, and 
then others for the contexts? Can you elaborate
a bit on the benefits of that. Also, would you use the same HttpHandler 
type at both levels?

- Michael.



More information about the net-dev mailing list