I'm writing an application which needs to be able to handle HTTP requests from an external source (in this case, it's actually a script from Second Life). I started out by using HTTPComponents by Apache, which worked great as long as the Java server only had to respond to GET requests. Now it needs to be able to receive data from the body of POST requests, and I don't see any way to do so with HTTPComponents
. Is there a superior library to use for this?
I did find through some Googling that there is a basic HTTP server included in the Sun packages. For the purposes of this application, it could be required that it only run on an actual Sun/Oracle JVM implementation -- but that's still a code smell to me, and I'd probably only do so if the only option was to write my own HTTP server library from scratch, working up from sockets and such. Any suggestions for an alternative?
You can access the entity if the request is a HttpEntityEnclosingRequest
. There is a simple example demonstrating the use of this class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With