

* Build a String to return to the web browser via an HTTP response.įinal StringBuilder response = new StringBuilder() ndResponseHeaders(HttpURLConnection.HTTP_OK, response.length()) įinal OutputStream os = httpExchange.getResponseBody() (see comments on this blog entry below). for pointing out the constant used below UPDATE (01 April 2008): Thanks to Christian Ullenboom Public void handle(final HttpExchange httpExchange) throws IOException * httpExchange Single-exchange HTTP request/response. * Implementation of only required method expected of an implementation of

Public class DustinHttpServerHandler implements HttpHandler * the Http Server built-in to Sun's Java SE 6 JVM. * Simple HTTP Server Handler example that demonstrates how easy it is to apply The code listing that follows is my own implementation of the HttpHandler interface and is adapted from the example provided in the Javadoc documentation for package.
#Grammar check for jedit how to
The Javadoc API description for contains an example of implementing the HttpHandler and includes an example of how to apply TLS/SSL. The main step a developer must perform to make use of the built-in HTTP server is to implement the HttpHandler interface. There is not much information regarding this online, but there are enough details to start using it for small HTTP service needs. Some colleagues have pointed out that Sun's implementation of Java SE 6 JRE includes a built-in Java HTTP Server.
