企业MediaApi新增批量上传成员、部门接口
This commit is contained in:
@@ -42,7 +42,7 @@ public abstract class BaseApi {
|
||||
protected abstract ResourceBundle getWeixinBundle();
|
||||
|
||||
protected String getRequestUri(String key) {
|
||||
String url = getWeixinBundle().getString(key);
|
||||
String url = getConfigValue(key);
|
||||
Pattern p = Pattern.compile("(\\{[^\\}]*\\})");
|
||||
Matcher m = p.matcher(url);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
@@ -55,4 +55,8 @@ public abstract class BaseApi {
|
||||
m.appendTail(sb);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
protected String getConfigValue(String key) {
|
||||
return getWeixinBundle().getString(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,32 +196,22 @@ public class HttpRequest {
|
||||
EntityUtils.consume(httpEntity);
|
||||
Header contentType = httpResponse
|
||||
.getFirstHeader(HttpHeaders.CONTENT_TYPE);
|
||||
Header disposition = httpResponse
|
||||
.getFirstHeader("Content-disposition");
|
||||
System.err.println(response.getAsString());
|
||||
// error with html
|
||||
// json
|
||||
if (contentType.getValue().contains(
|
||||
ContentType.TEXT_HTML.getMimeType())) {
|
||||
// response.setText(new String(data, "gbk"));
|
||||
try {
|
||||
checkJson(response);
|
||||
return response;
|
||||
} catch (JSONException e) {
|
||||
;
|
||||
}
|
||||
try {
|
||||
checkXml(response);
|
||||
return response;
|
||||
} catch (CannotResolveClassException ex) {
|
||||
;
|
||||
}
|
||||
throw new WeixinException(response.getAsString());
|
||||
} else if (contentType.getValue().contains(
|
||||
ContentType.APPLICATION_JSON.getMimeType())) {
|
||||
ContentType.APPLICATION_JSON.getMimeType())
|
||||
|| (disposition != null && disposition.getValue().indexOf(
|
||||
".json") > 0)) {
|
||||
checkJson(response);
|
||||
} else if (contentType.getValue().contains(
|
||||
ContentType.TEXT_XML.getMimeType())) {
|
||||
checkXml(response);
|
||||
} else if (contentType.getValue().contains(
|
||||
ContentType.TEXT_PLAIN.getMimeType())) {
|
||||
ContentType.TEXT_PLAIN.getMimeType())
|
||||
|| contentType.getValue().contains(
|
||||
ContentType.TEXT_HTML.getMimeType())) {
|
||||
try {
|
||||
checkJson(response);
|
||||
return response;
|
||||
|
||||
Reference in New Issue
Block a user