Java 6 has a web server inside

import com.sun.net.httpserver.*

class ExampleHandler implements HttpHandler {
        void handle(HttpExchange exchange) throws IOException {
                def response = "Hello, world!"

                exchange.sendResponseHeaders(200, response.length());
                def outout = exchange.responseBody
                outout.write(response.bytes);
                outout.close();
        }
}

public class ExampleAuthenticator extends BasicAuthenticator {
        static users = [ "john": "john123" ]
 
        public ExampleAuthenticator(String realm) {
                super(realm);
        }

        @Override
        public boolean checkCredentials(String username, String password) {
                return users[username] == password;
        }
}

def server = HttpServer.create(new InetSocketAddress(8000), 0);
def context = server.createContext("/example", new ExampleHandler());
context.authenticator = new ExampleAuthenticator("Example application")
server.executor = null
server.start();