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

avoid large http header data copies in jaxrs #184

Open
alalag1 opened this issue May 5, 2022 · 0 comments
Open

avoid large http header data copies in jaxrs #184

alalag1 opened this issue May 5, 2022 · 0 comments
Assignees
Milestone

Comments

@alalag1
Copy link
Member

alalag1 commented May 5, 2022

Expected behavior

avoid large http header data copies in jaxrs

Actual behavior

http headers are copied and converted between restlight and jaxrs

public static MultivaluedMap<String, Object> convertToMap(HttpHeaders headers) {
MultivaluedMap<String, Object> dest = new MultivaluedHashMap<>();
if (headers == null) {
return dest;
}
for (String name : headers.names()) {
dest.addAll(name, new ArrayList<>(headers.getAll(name)));
}
return dest;
}
public static void convertThenAddToHeaders(MultivaluedMap<String, Object> values, HttpHeaders headers) {
if (values == null || values.isEmpty()) {
return;
}
headers.clear();
for (Map.Entry<String, List<Object>> entry : values.entrySet()) {
List<Object> value = entry.getValue();
if (value == null || value.isEmpty()) {
continue;
}
headers.add(entry.getKey(), value.stream().map(JaxrsUtils::toString)
.collect(Collectors.toList()));
}
}

Steps to reproduce

Env

  • Restlight version: 1.0.0-SNAPSHOT
  • JVM version:
  • OS:
@LCDZhao-Z LCDZhao-Z assigned LCDZhao-Z and unassigned LCDZhao-Z May 6, 2022
@LCDZhao-Z LCDZhao-Z added this to the v1.0.1 milestone May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants