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
)
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.
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 and Description |
---|
BlockingHttpHandlerSample() |
public static void main(String[] args)
Copyright © 2015 Oracle Corporation. All rights reserved.