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:
suncairong163 2024-02-28 10:44:29 +08:00 committed by GitHub
parent 6dbac54b39
commit 69dd801db2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 20 additions and 7 deletions

View File

@ -65,7 +65,7 @@ public interface RestDemoService {
Boolean testBody2(Boolean b);
@POST
@Path("/testBody3")
@Path("/testBody4")
@Consumes({MediaType.TEXT_PLAIN})
TestPO testBody2(TestPO b);

View File

@ -169,10 +169,13 @@ public interface ResteasyContext {
for (Map.Entry<String, List<Object>> entry : headers.entrySet()) {
String key = entry.getKey();
if (entry.getValue() == null) {
List<Object> value = entry.getValue();
if (value == null || value.isEmpty()) {
continue;
}
response.addOutputHeaders(key, entry.getValue().toString());
for (Object tmp : value) {
response.addOutputHeaders(key, tmp.toString());
}
}
}

View File

@ -42,7 +42,14 @@ public class ResteasyNettyHttpResponse implements HttpResponse {
for (Map.Entry<String, List<String>> headers : outputHeaders.entrySet()) {
String key = headers.getKey();
List<String> value = headers.getValue();
multivaluedMap.add(key, value);
if (value == null || value.isEmpty()) {
continue;
}
for (String val : value) {
multivaluedMap.add(key, val);
}
}
}

View File

@ -33,13 +33,12 @@ import java.util.Set;
/**
* body is json
*/
@Activate("json")
@Activate(value = "json", order = 100)
public class JsonCodec implements HttpMessageCodec<byte[], OutputStream> {
private static final Set<Class> unSupportClasses = new HashSet<>();
static {
unSupportClasses.add(byte[].class);
unSupportClasses.add(String.class);
}
public static void addUnSupportClass(Class<?> unSupportClass) {

View File

@ -28,7 +28,7 @@ import java.nio.charset.StandardCharsets;
/**
* body is string
*/
@Activate("string")
@Activate(value = "string", order = 200)
public class StringCodec implements HttpMessageCodec<byte[], OutputStream> {
@Override

View File

@ -190,6 +190,10 @@ public class NettyHttpResponse implements HttpResponse {
outputHeaders.put(name, values);
}
if (values.contains(value)) {
return;
}
values.add(value);
}