#2237 1. use ByteArrayEntity 2. getDeclaredMethods
This commit is contained in:
parent
0ed8e6f812
commit
0d304c0b7d
@ -31,6 +31,7 @@ import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.methods.HttpPut;
|
||||
import org.apache.http.entity.ByteArrayEntity;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
@ -316,18 +317,16 @@ public class HttpClient {
|
||||
|
||||
public static HttpResult httpPutLarge(String url, Map<String, String> headers, byte[] content) {
|
||||
try {
|
||||
HttpClientBuilder builder = HttpClients.custom();
|
||||
builder.setUserAgent(UtilsAndCommons.SERVER_VERSION);
|
||||
builder.setConnectionTimeToLive(500, TimeUnit.MILLISECONDS);
|
||||
|
||||
HttpClientBuilder builder = HttpClients.custom()
|
||||
.setUserAgent(UtilsAndCommons.SERVER_VERSION)
|
||||
.setConnectionTimeToLive(500, TimeUnit.MILLISECONDS);
|
||||
CloseableHttpClient httpClient = builder.build();
|
||||
HttpPut httpPut = new HttpPut(url);
|
||||
|
||||
HttpPut httpPut = new HttpPut(url);
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
httpPut.setHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
httpPut.setEntity(new StringEntity(new String(content, StandardCharsets.UTF_8), ContentType.create("application/json", StandardCharsets.UTF_8)));
|
||||
httpPut.setEntity(new ByteArrayEntity(content, ContentType.APPLICATION_JSON));
|
||||
|
||||
HttpResponse response = httpClient.execute(httpPut);
|
||||
HttpEntity entity = response.getEntity();
|
||||
|
@ -58,7 +58,7 @@ public class FilterBase {
|
||||
private void initClassMethod(Class<?> clazz) {
|
||||
RequestMapping requestMapping = clazz.getAnnotation(RequestMapping.class);
|
||||
String classPath = requestMapping.value()[0];
|
||||
for (Method method : clazz.getMethods()) {
|
||||
for (Method method : clazz.getDeclaredMethods()) {
|
||||
if (!method.isAnnotationPresent(RequestMapping.class)) {
|
||||
parseSubAnnotations(method, classPath);
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user