/** 处理http deletemethod请求 */ public static String delete(String url, PostParameter[] params, String token) throws IOException { if (0 != params.length) { String encodedParams = PostParameter.encodeParameters(params); if (-1 == url.indexOf("?")) { url += "?" + encodedParams; } else { url += "&" + encodedParams; } } DeleteMethod deleteMethod = new DeleteMethod(url); return httpRequest(deleteMethod, token); }
/** * get * * @param url * @param params * @return * @throws ApiException */ public static String get(String url, PostParameter[] params, String token) throws IOException { if (null != params && params.length > 0) { String encodedParams = PostParameter.encodeParameters(params); if (-1 == url.indexOf("?")) { url += "?" + encodedParams; } else { url += "&" + encodedParams; } } GetMethod getmethod = new GetMethod(url); return httpRequest(getmethod, token); }