Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimone Bordet2015-12-08 06:02:57 -0500
committerSimone Bordet2015-12-08 06:04:22 -0500
commite6f23a692ec3a7472965100854a7ade69733c71c (patch)
tree407c7c3ed1e7fd06b77aeb14daf3e4b346d3504b
parent66e596511dba86225e30281cfa2e920c646b6fcc (diff)
downloadorg.eclipse.jetty.project-e6f23a692ec3a7472965100854a7ade69733c71c.tar.gz
org.eclipse.jetty.project-e6f23a692ec3a7472965100854a7ade69733c71c.tar.xz
org.eclipse.jetty.project-e6f23a692ec3a7472965100854a7ade69733c71c.zip
482270 - Expose upgrade request locales.
Exposed as a user property.
-rw-r--r--jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/JsrCreator.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/JsrCreator.java b/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/JsrCreator.java
index 1c43be3895..b261f61dd8 100644
--- a/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/JsrCreator.java
+++ b/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/JsrCreator.java
@@ -20,7 +20,9 @@ package org.eclipse.jetty.websocket.jsr356.server;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
+import java.util.Map;
import javax.websocket.Extension;
import javax.websocket.Extension.Parameter;
@@ -43,6 +45,7 @@ public class JsrCreator implements WebSocketCreator
{
public static final String PROP_REMOTE_ADDRESS = "javax.websocket.endpoint.remoteAddress";
public static final String PROP_LOCAL_ADDRESS = "javax.websocket.endpoint.localAddress";
+ public static final String PROP_LOCALES = "javax.websocket.upgrade.locales";
private static final Logger LOG = Log.getLogger(JsrCreator.class);
private final ServerEndpointMetadata metadata;
private final ExtensionFactory extensionFactory;
@@ -61,17 +64,19 @@ public class JsrCreator implements WebSocketCreator
// Get raw config, as defined when the endpoint was added to the container
ServerEndpointConfig config = metadata.getConfig();
-
+
// Establish a copy of the config, so that the UserProperties are unique
// per upgrade request.
config = new BasicServerEndpointConfig(config);
-
+
// Bug 444617 - Expose localAddress and remoteAddress for jsr modify handshake to use
// This is being implemented as an optional set of userProperties so that
// it is not JSR api breaking. A few users on #jetty and a few from cometd
// have asked for access to this information.
- config.getUserProperties().put(PROP_LOCAL_ADDRESS,req.getLocalSocketAddress());
- config.getUserProperties().put(PROP_REMOTE_ADDRESS,req.getRemoteSocketAddress());
+ Map<String, Object> userProperties = config.getUserProperties();
+ userProperties.put(PROP_LOCAL_ADDRESS,req.getLocalSocketAddress());
+ userProperties.put(PROP_REMOTE_ADDRESS,req.getRemoteSocketAddress());
+ userProperties.put(PROP_LOCALES,Collections.list(req.getLocales()));
// Get Configurator from config object (not guaranteed to be unique per endpoint upgrade)
ServerEndpointConfig.Configurator configurator = config.getConfigurator();

Back to the top