Class NonBlockingHttpHandlerSample
java.lang.Object
org.glassfish.grizzly.samples.httpserver.nonblockinghandler.NonBlockingHttpHandlerSample
This example demonstrates the use of a HttpHandler to echo
HTTP POST data sent by the client, back to the client using
non-blocking streams introduced in Grizzly 2.0.
The is composed of two main parts (as nested classes of BlockingHttpHandlerSample)
-
Client: This is a simple
HTTPbased on the GrizzlyHttpClientFilter. The client uses a customFilteron top of theHttpClientFilterto send thePOSTand read, and ultimately display, the response from the server. To better demonstrate the callbacks defined byReadHandler, the client will send each data chunk two seconds apart. -
NoneBlockingEchoHandler: This
HttpHandleris installed to theHttpServerinstance and associated with the path/echo. The handler uses theNIOReaderreturned byRequest.getReader(). As data is received asynchronously, theReadHandlercallbacks are invoked at this time data is then written to the response.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
NonBlockingHttpHandlerSample
public NonBlockingHttpHandlerSample()
-
-
Method Details
-
main
-