diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketUpgradeFilter.java b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketUpgradeFilter.java index a189155d486..b9f4d702d6b 100644 --- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketUpgradeFilter.java +++ b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketUpgradeFilter.java @@ -36,6 +36,8 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.http.pathmap.MappedResource; import org.eclipse.jetty.http.pathmap.PathMappings; import org.eclipse.jetty.http.pathmap.PathSpec; +import org.eclipse.jetty.http.pathmap.RegexPathSpec; +import org.eclipse.jetty.http.pathmap.ServletPathSpec; import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.MappedByteBufferPool; import org.eclipse.jetty.servlet.FilterHolder; @@ -142,6 +144,26 @@ public class WebSocketUpgradeFilter extends ContainerLifeCycle implements Filter { pathmap.put(spec,creator); } + + /** + * @deprecated use new {@link #addMapping(org.eclipse.jetty.http.pathmap.PathSpec, WebSocketCreator)} instead + */ + @Deprecated + public void addMapping(org.eclipse.jetty.websocket.server.pathmap.PathSpec spec, WebSocketCreator creator) + { + if (spec instanceof org.eclipse.jetty.websocket.server.pathmap.ServletPathSpec) + { + addMapping(new ServletPathSpec(spec.getSpec()), creator); + } + else if (spec instanceof org.eclipse.jetty.websocket.server.pathmap.RegexPathSpec) + { + addMapping(new RegexPathSpec(spec.getSpec()), creator); + } + else + { + throw new RuntimeException("Unsupported (Deprecated) PathSpec implementation: " + spec.getClass().getName()); + } + } @Override public void destroy() diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/pathmap/PathSpec.java b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/pathmap/PathSpec.java new file mode 100644 index 00000000000..e0a3d672e57 --- /dev/null +++ b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/pathmap/PathSpec.java @@ -0,0 +1,38 @@ +// +// ======================================================================== +// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.server.pathmap; + +/** + * @deprecated moved to jetty-http {@link org.eclipse.jetty.http.pathmap.PathSpec} (this facade will be removed in Jetty 9.4) + */ +@Deprecated +public abstract class PathSpec +{ + private final String spec; + + protected PathSpec(String spec) + { + this.spec = spec; + } + + public String getSpec() + { + return spec; + } +} diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/pathmap/RegexPathSpec.java b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/pathmap/RegexPathSpec.java index 3111a6c23a2..e6e004acb49 100644 --- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/pathmap/RegexPathSpec.java +++ b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/pathmap/RegexPathSpec.java @@ -22,7 +22,7 @@ package org.eclipse.jetty.websocket.server.pathmap; * @deprecated moved to jetty-http {@link org.eclipse.jetty.http.pathmap.RegexPathSpec} (this facade will be removed in Jetty 9.4) */ @Deprecated -public class RegexPathSpec extends org.eclipse.jetty.http.pathmap.RegexPathSpec +public class RegexPathSpec extends PathSpec { public RegexPathSpec(String regex) { diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/pathmap/ServletPathSpec.java b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/pathmap/ServletPathSpec.java index da52817bfb8..852aae68de2 100644 --- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/pathmap/ServletPathSpec.java +++ b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/pathmap/ServletPathSpec.java @@ -22,7 +22,7 @@ package org.eclipse.jetty.websocket.server.pathmap; * @deprecated moved to jetty-http {@link org.eclipse.jetty.http.pathmap.ServletPathSpec} (this facade will be removed in Jetty 9.4) */ @Deprecated -public class ServletPathSpec extends org.eclipse.jetty.http.pathmap.ServletPathSpec +public class ServletPathSpec extends PathSpec { public ServletPathSpec(String servletPathSpec) {