/** * Sends a request in JSON and expects a JSON response back. * * @param urlTail The end point to hit. Appended to {@link #base}. Shouldn't start with '/' * @param headers HTTP headers * @param params * Form parameters */ /*package*/ HttpReply formUrlEncoded(String urlTail, Map<String, String> headers, Map<String,List<String>> params) throws IOException { String urlString = absolutize(urlTail); trace("API call: " + urlString); PostMethod httpMethod = new PostMethod(urlString); httpMethod.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); for (Entry<String, List<String>> e : params.entrySet()) { for (String v : e.getValue()) { httpMethod.addParameter(e.getKey(),v); } } return executeRequest(httpMethod,headers); }
/** * Sends a request in JSON and expects a JSON response back. * * @param urlTail The end point to hit. Appended to {@link #base}. Shouldn't start with '/' * @param headers HTTP headers * @param params * Form parameters */ /*package*/ HttpReply formUrlEncoded(String urlTail, Map<String, String> headers, Map<String,List<String>> params) throws IOException { String urlString = absolutize(urlTail); trace("API call: " + urlString); PostMethod httpMethod = new PostMethod(urlString); httpMethod.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); for (Entry<String, List<String>> e : params.entrySet()) { for (String v : e.getValue()) { httpMethod.addParameter(e.getKey(),v); } } return executeRequest(httpMethod,headers); }
HttpMethodBase httpMethod; String urlString = absolutize(urlTail);
HttpMethodBase httpMethod; String urlString = absolutize(urlTail);