Issue #1502 - Changing WSUF target creation used by PathMappings match

This commit is contained in:
Joakim Erdfelt 2017-04-24 16:08:37 -07:00
parent 5e4853e177
commit 4c5dd93b30
2 changed files with 7 additions and 6 deletions

View File

@ -77,7 +77,7 @@ public class AltFilterTest
{
client.start();
JettyEchoSocket clientEcho = new JettyEchoSocket();
Future<Session> future = client.connect(clientEcho,uri.resolve("echo"));
Future<Session> future = client.connect(clientEcho,uri.resolve("echo;jsession=xyz"));
// wait for connect
future.get(1,TimeUnit.SECONDS);
clientEcho.sendMessage("Hello Echo");

View File

@ -207,12 +207,13 @@ public class WebSocketUpgradeFilter implements Filter, MappedWebSocketCreator, D
return;
}
// Since this is a filter, we need to be smart about determining the target path
String contextPath = httpreq.getContextPath();
String target = httpreq.getRequestURI();
if (target.startsWith(contextPath))
// Since this is a filter, we need to be smart about determining the target path.
// We should rely on the Container for stripping path parameters and its ilk before
// attempting to match a specific mapped websocket creator.
String target = httpreq.getServletPath();
if (httpreq.getPathInfo() != null)
{
target = target.substring(contextPath.length());
target = target + httpreq.getPathInfo();
}
MappedResource<WebSocketCreator> resource = configuration.getMatch(target);