JSOG has an HTTP client, built on Apache's HttpClient project. The JSOG HTTP client has two levels:
Both are thread safe and reusable.
HttpClient hc = new DefaultHttpClientImpl(); String result = hc.get("http://www.example.com/"); String result = hc.post("http://www.example.com/submit", JSOG.object("foo", "bar").toString());
When POSTing, the the client uses the "application/json" content type, with the "ISO-8859-1" encoding.
It supports HTTP and HTTPS (with all the fun of Java's SSL handling).
You can set the client's connection timeout, socket timeout, content type, charset (encoding), headers, and user agent all by calling the appropriate setter method.
The JsogClient automatically stringifies and parses JSON into JSOG objects.
Note that the DefaultJsogClientImpl extends DefaultHttpClientImpl.
JsogClient jc = new DefaultJsogClientImpl(); JSOG result = jc.get("http://www.example.com/"); JSOG result = jc.post("http://www.example.com/submit", JSOG.object("foo", "bar")); JSOG result = jc.post("http://www.example.com/submit", JSOG.object("foo", "bar").toString());
When POSTing, the the client uses the "application/json" content type, with the "ISO-8859-1" encoding.
It supports HTTP and HTTPS (with all the fun of Java's SSL handling).
You can set the client's connection timeout, socket timeout, content type, charset (encoding), headers, and user agent all by calling the appropriate setter method.