Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt2013-08-01 17:50:01 +0000
committerJoakim Erdfelt2013-08-01 17:50:01 +0000
commit07041f6439e9fe9f355a7bbd11c60bc84a0ba955 (patch)
treefd62bf85a4ee9feb1dce8eb3fcfe37c695a65aa0 /jetty-websocket/websocket-api/src
parentcbaf68be203124219122281e39560c9cd69f0637 (diff)
downloadorg.eclipse.jetty.project-07041f6439e9fe9f355a7bbd11c60bc84a0ba955.tar.gz
org.eclipse.jetty.project-07041f6439e9fe9f355a7bbd11c60bc84a0ba955.tar.xz
org.eclipse.jetty.project-07041f6439e9fe9f355a7bbd11c60bc84a0ba955.zip
JSR-356 making HTTP Header map use TreeMap(String.CASE_INSENSITIVE_ORDER)
Diffstat (limited to 'jetty-websocket/websocket-api/src')
-rw-r--r--jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeRequest.java12
-rw-r--r--jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeResponse.java10
2 files changed, 11 insertions, 11 deletions
diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeRequest.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeRequest.java
index 99b532c9ec..826a808138 100644
--- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeRequest.java
+++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeRequest.java
@@ -25,8 +25,8 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
+import java.util.TreeMap;
import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig;
import org.eclipse.jetty.websocket.api.util.QuoteUtil;
@@ -37,7 +37,7 @@ public class UpgradeRequest
private List<String> subProtocols = new ArrayList<>();
private List<ExtensionConfig> extensions = new ArrayList<>();
private List<HttpCookie> cookies = new ArrayList<>();
- private Map<String, List<String>> headers = new HashMap<>();
+ private Map<String, List<String>> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
private Map<String, List<String>> parameters = new HashMap<>();
private Object session;
private String httpVersion;
@@ -94,7 +94,7 @@ public class UpgradeRequest
public String getHeader(String name)
{
- List<String> values = headers.get(name.toLowerCase(Locale.ENGLISH));
+ List<String> values = headers.get(name);
// no value list
if (values == null)
{
@@ -128,7 +128,7 @@ public class UpgradeRequest
public int getHeaderInt(String name)
{
- List<String> values = headers.get(name.toLowerCase(Locale.ENGLISH));
+ List<String> values = headers.get(name);
// no value list
if (values == null)
{
@@ -267,14 +267,14 @@ public class UpgradeRequest
public void setHeader(String name, List<String> values)
{
- headers.put(name.toLowerCase(Locale.ENGLISH),values);
+ headers.put(name,values);
}
public void setHeader(String name, String value)
{
List<String> values = new ArrayList<>();
values.add(value);
- setHeader(name.toLowerCase(Locale.ENGLISH),values);
+ setHeader(name,values);
}
public void setHeaders(Map<String, List<String>> headers)
diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeResponse.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeResponse.java
index 51a04c0049..a6cea8801f 100644
--- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeResponse.java
+++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeResponse.java
@@ -20,10 +20,10 @@ package org.eclipse.jetty.websocket.api;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig;
import org.eclipse.jetty.websocket.api.util.QuoteUtil;
@@ -33,13 +33,13 @@ public class UpgradeResponse
public static final String SEC_WEBSOCKET_PROTOCOL = "Sec-WebSocket-Protocol";
private int statusCode;
private String statusReason;
- private Map<String, List<String>> headers = new HashMap<>();
+ private Map<String, List<String>> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
private List<ExtensionConfig> extensions = new ArrayList<>();
private boolean success = false;
public void addHeader(String name, String value)
{
- String key = name.toLowerCase();
+ String key = name;
List<String> values = headers.get(key);
if (values == null)
{
@@ -115,7 +115,7 @@ public class UpgradeResponse
public List<String> getHeaders(String name)
{
- return headers.get(name.toLowerCase());
+ return headers.get(name);
}
public int getStatusCode()
@@ -188,7 +188,7 @@ public class UpgradeResponse
{
List<String> values = new ArrayList<>();
values.add(value);
- headers.put(name.toLowerCase(),values);
+ headers.put(name,values);
}
public void setStatusCode(int statusCode)

Back to the top