Fix incorrect rest response header and demo double path error (#13789)
* fix dubbo demo xml double path error * fix restEasy response headers formate * fix content-type judge * remove unused code
This commit is contained in:
parent
6dbac54b39
commit
69dd801db2
|
|
@ -65,7 +65,7 @@ public interface RestDemoService {
|
||||||
Boolean testBody2(Boolean b);
|
Boolean testBody2(Boolean b);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/testBody3")
|
@Path("/testBody4")
|
||||||
@Consumes({MediaType.TEXT_PLAIN})
|
@Consumes({MediaType.TEXT_PLAIN})
|
||||||
TestPO testBody2(TestPO b);
|
TestPO testBody2(TestPO b);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,10 +169,13 @@ public interface ResteasyContext {
|
||||||
for (Map.Entry<String, List<Object>> entry : headers.entrySet()) {
|
for (Map.Entry<String, List<Object>> entry : headers.entrySet()) {
|
||||||
|
|
||||||
String key = entry.getKey();
|
String key = entry.getKey();
|
||||||
if (entry.getValue() == null) {
|
List<Object> value = entry.getValue();
|
||||||
|
if (value == null || value.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
response.addOutputHeaders(key, entry.getValue().toString());
|
for (Object tmp : value) {
|
||||||
|
response.addOutputHeaders(key, tmp.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,14 @@ public class ResteasyNettyHttpResponse implements HttpResponse {
|
||||||
for (Map.Entry<String, List<String>> headers : outputHeaders.entrySet()) {
|
for (Map.Entry<String, List<String>> headers : outputHeaders.entrySet()) {
|
||||||
String key = headers.getKey();
|
String key = headers.getKey();
|
||||||
List<String> value = headers.getValue();
|
List<String> value = headers.getValue();
|
||||||
multivaluedMap.add(key, value);
|
|
||||||
|
if (value == null || value.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String val : value) {
|
||||||
|
multivaluedMap.add(key, val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,13 +33,12 @@ import java.util.Set;
|
||||||
/**
|
/**
|
||||||
* body is json
|
* body is json
|
||||||
*/
|
*/
|
||||||
@Activate("json")
|
@Activate(value = "json", order = 100)
|
||||||
public class JsonCodec implements HttpMessageCodec<byte[], OutputStream> {
|
public class JsonCodec implements HttpMessageCodec<byte[], OutputStream> {
|
||||||
private static final Set<Class> unSupportClasses = new HashSet<>();
|
private static final Set<Class> unSupportClasses = new HashSet<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
unSupportClasses.add(byte[].class);
|
unSupportClasses.add(byte[].class);
|
||||||
unSupportClasses.add(String.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addUnSupportClass(Class<?> unSupportClass) {
|
public static void addUnSupportClass(Class<?> unSupportClass) {
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ import java.nio.charset.StandardCharsets;
|
||||||
/**
|
/**
|
||||||
* body is string
|
* body is string
|
||||||
*/
|
*/
|
||||||
@Activate("string")
|
@Activate(value = "string", order = 200)
|
||||||
public class StringCodec implements HttpMessageCodec<byte[], OutputStream> {
|
public class StringCodec implements HttpMessageCodec<byte[], OutputStream> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,10 @@ public class NettyHttpResponse implements HttpResponse {
|
||||||
outputHeaders.put(name, values);
|
outputHeaders.put(name, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (values.contains(value)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
values.add(value);
|
values.add(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue