diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2018-04-04 18:47:49 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-05-15 20:20:51 +0200 |
commit | 3bab57a379b1173cfdf9dc24913adf5d9f4fdcae (patch) | |
tree | 8aeebeaea123fc2661e58cdd0ec3d223656b139b /server | |
parent | b3ad74d2e5e4a35d0a20d91a7e84c6775eb510a8 (diff) | |
download | sonarqube-3bab57a379b1173cfdf9dc24913adf5d9f4fdcae.tar.gz sonarqube-3bab57a379b1173cfdf9dc24913adf5d9f4fdcae.zip |
add Request#getHeaders and #getParams()
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/ws/ServletRequest.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/ws/ServletRequest.java b/server/sonar-server/src/main/java/org/sonar/server/ws/ServletRequest.java index 4393dcc0e65..a5ca06d166b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ws/ServletRequest.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ws/ServletRequest.java @@ -25,6 +25,7 @@ import com.google.common.net.HttpHeaders; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; +import java.util.Enumeration; import java.util.List; import java.util.Map; import java.util.Optional; @@ -152,4 +153,20 @@ public class ServletRequest extends ValidatingRequest { public Optional<String> header(String name) { return Optional.ofNullable(source.getHeader(name)); } + + @Override + public Map<String, String> getHeaders() { + ImmutableMap.Builder<String, String> mapBuilder = ImmutableMap.builder(); + Enumeration<String> headerNames = source.getHeaderNames(); + while (headerNames.hasMoreElements()) { + String headerName = headerNames.nextElement(); + mapBuilder.put(headerName, source.getHeader(headerName)); + } + return mapBuilder.build(); + } + + @Override + public Map<String, String[]> getParams() { + return source.getParameterMap(); + } } |