Permalink
Browse files

restclient: another post method that allow specifying headers.

  • Loading branch information...
1 parent 85ee7b2 commit d4ee46967792355114d861bcff452e52a151921c @kgilmer kgilmer committed Oct 25, 2011
Showing with 18 additions and 1 deletion.
  1. +18 −1 org.touge.restclient/src/org/touge/restclient/ReSTClient.java
@@ -502,9 +502,11 @@ public ConnectionProvider getConnectionProvider() {
/**
* @param initializer
*/
- public void addConnectionInitializer(ConnectionInitializer initializer) {
+ public ConnectionInitializer addConnectionInitializer(ConnectionInitializer initializer) {
if (!connectionInitializers.contains(initializer))
connectionInitializers.add(initializer);
+
+ return initializer;
}
/**
@@ -867,6 +869,21 @@ public String callGet(Object url) throws IOException {
}
/**
+ * Send a POST to the server.
+ *
+ * @param <T> type to deserialize to
+ * @param url of server
+ * @param body of post
+ * @param headers additional headers for request
+ * @param deserializer deserializer
+ * @return response
+ * @throws IOException on I/O error
+ */
+ public <T> Response<T> callPost(URLBuilder url, InputStream body, Map<String, String> headers, ResponseDeserializer<T> deserializer) throws IOException {
+ return call(HttpMethod.POST, url.toString(), deserializer, body, headers);
+ }
+
+ /**
* Send a multipart POST to the server. Convenience method for post(url, createMultipartPostBody(content)).
*
* @param url url of server. If not String, toString() will be called.

0 comments on commit d4ee469

Please sign in to comment.