Tony Landis home

Groovy Http POST/GET Class

I was working on a project in and needed to do POST as well as read the response headers.

I was unable to find a suitable class or method for this in either Groovy or Java, so I wrote this class.

It opens a socket to the requested host, and writes to the socket using getOutputStream() and PrintWriter().

It reads the response from the server using DataInputStream() and getInputStream().