This example demonstrates how to register and run Jersey Netty connector with Expect:100-continue feature on. It also provides custom low-level Socket server to demonstrate how is request is captured and processed.
The server and client are operating on requests level, without exposing any Resources. Client only sends request in form
{"message":"Hello from java client"}
Server in turn shows output which demonstrates Expect:100-continue presence and handling
==== DUMPING HEADERS ==== expect, 100-continue transfer-encoding, chunked host, 127.0.0.1:3000 content-type, application/json accept, application/json user-agent, jersey/2.47-snapshot (netty 4.1.112.final) ==== HEADERS DUMPED ===== ==== DUMPING RESPONSE ==== HTTP/1.1 100 Continue Connection: keep-alive ==== RESPONSE DUMPED ===== 24 {"message":"Hello from java client"} ==== DUMPING RESPONSE ==== HTTP/1.1 204 No Content Server: Socket Server v.0.0.1
Run the example using provided ServerSocket container as follows:
mvn clean compile exec:java
Run the example using client as follows:
mvn clean package exec:java -Pclient