I wrote the reference implementation of the
com.sun.net.httpserver.HttpServer
It seems to be a memory leak in JVM or do i leave some resources
open.

Thankful if you have some suggestions!



mport java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;

import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;

class Server implements HttpHandler
{
public void handle( HttpExchange httpExchange ) throws IOException
{
httpExchange.getResponseHeaders().add( "Content-type", "text/
html" );
String response = "test ";
httpExchange.sendResponseHeaders( 200, response.length() );

OutputStream os = httpExchange.getResponseBody();
os.write( response.getBytes() );
os.close(); //
}
public static void main(String[] args) {
HttpServer server = null;
try {
server = HttpServer.create( new InetSocketAddress( 80 ), 0 );
} catch(IOException e) {

}
server.createContext( "/", new Server() );
server.start();

}
}