Fixes #780 - The moved websocket PathSpec is incompatible with cometd 3.0.x

This commit is contained in:
Joakim Erdfelt 2016-07-27 09:31:11 -07:00
parent 62ff196b43
commit b3d25183b5
4 changed files with 62 additions and 2 deletions

View File

@ -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;
@ -143,6 +145,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()
{

View File

@ -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;
}
}

View File

@ -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)
{

View File

@ -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)
{