Class BlockingHttpHandlerSample

java.lang.Object
org.glassfish.grizzly.samples.httpserver.blockinghandler.BlockingHttpHandlerSample

public class BlockingHttpHandlerSample extends Object

This example demonstrates the use of a HttpHandler to echo HTTP POST data sent by the client, back to the client.

The is composed of two main parts (as nested classes of BlockingHttpHandlerSample)

  • Client: This is a simple HTTP based on the Grizzly HttpClientFilter. The client uses a custom Filter on top of the HttpClientFilter to send the POST and read, and ultimately display, the response from the server.
  • BlockingEchoHandler: This HttpHandler is installed to the HttpServer instance and associated with the path /echo. This HttpHandler is fairly simple. The handler uses the Reader returned by Request.getReader() in blocking mode. As data is received, the same data is then immediately written to the response.

  • Constructor Details

    • BlockingHttpHandlerSample

      public BlockingHttpHandlerSample()
  • Method Details

    • main

      public static void main(String[] args)