Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect rest response header and demo double path error #13789

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public interface RestDemoService {
Boolean testBody2(Boolean b);

@POST
@Path("/testBody3")
@Path("/testBody4")
@Consumes({MediaType.TEXT_PLAIN})
TestPO testBody2(TestPO b);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,13 @@ default void addResponseHeaders(NettyHttpResponse response, MultivaluedMap<Strin
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());
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ public ResteasyNettyHttpResponse(NettyHttpResponse response) {
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);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@
/**
* 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/**
* body is string
*/
@Activate("string")
@Activate(value = "string", order = 200)
public class StringCodec implements HttpMessageCodec<byte[], OutputStream> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ public void addOutputHeaders(String name, String value) {
outputHeaders.put(name, values);
}

if (values.contains(value)) {
return;
}

values.add(value);
}

Expand Down
Loading