I’m trying to write a small webserver that accepts Http requests and returns Http responses in Java. I am using Apache HttpCore and specifically, I am looking at HttpServerConnection as the main interface to use in the flow of my webserver.
However, I couldn’t find a usage example online. I see that there’s a receiveRequestHeader method, but I’m not sure when I can use it (should I establish a connection first? Is a connection established during creation? Is this method blocking?).
Can you provide a short usage example for this class (the implementation I’m using is DefaultHttpServerConnection), or suggest a different methodology?
The HttpComponents site has two simple http servers among the examples. One blocking, one non-blocking.