Issue #3661 - review of exposed classes in jetty-websocket-server (#3779)

* Issue #3661 - review of exposed classes in jetty-websocket-server

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>

* Issue #3762 - cleanups of jetty-websocket-server

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan 2019-06-17 17:12:46 +10:00 committed by GitHub
parent 60d8661890
commit 372ed1455f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 158 additions and 544 deletions

View File

@ -56,7 +56,7 @@ public class WebSocketServer
@Override @Override
public void configure(JettyWebSocketServletFactory factory) public void configure(JettyWebSocketServletFactory factory)
{ {
factory.addMapping(factory.parsePathSpec("/"), (req,res)->new EchoSocket()); factory.addMapping("/", (req,res)->new EchoSocket());
} }
} }

View File

@ -95,7 +95,7 @@
<Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item> <Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.eclipse.jetty.webapp.JmxConfiguration</Item> <Item>org.eclipse.jetty.webapp.JmxConfiguration</Item>
<Item>org.eclipse.jetty.osgi.annotations.AnnotationConfiguration</Item> <Item>org.eclipse.jetty.osgi.annotations.AnnotationConfiguration</Item>
<Item>org.eclipse.jetty.websocket.server.JettyWebSocketConfiguration</Item> <Item>org.eclipse.jetty.websocket.server.config.JettyWebSocketConfiguration</Item>
<Item>org.eclipse.jetty.websocket.javax.server.JavaxWebSocketConfiguration</Item> <Item>org.eclipse.jetty.websocket.javax.server.JavaxWebSocketConfiguration</Item>
<Item>org.eclipse.jetty.osgi.boot.OSGiWebInfConfiguration</Item> <Item>org.eclipse.jetty.osgi.boot.OSGiWebInfConfiguration</Item>
<Item>org.eclipse.jetty.osgi.boot.OSGiMetaInfConfiguration</Item> <Item>org.eclipse.jetty.osgi.boot.OSGiMetaInfConfiguration</Item>

View File

@ -81,7 +81,7 @@
<Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item> <Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item> <Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.eclipse.jetty.webapp.JmxConfiguration</Item> <Item>org.eclipse.jetty.webapp.JmxConfiguration</Item>
<Item>org.eclipse.jetty.websocket.server.JettyWebSocketConfiguration</Item> <Item>org.eclipse.jetty.websocket.server.config.JettyWebSocketConfiguration</Item>
<Item>org.eclipse.jetty.websocket.javax.server.JavaxWebSocketConfiguration</Item> <Item>org.eclipse.jetty.websocket.javax.server.JavaxWebSocketConfiguration</Item>
<Item>org.eclipse.jetty.osgi.annotations.AnnotationConfiguration</Item> <Item>org.eclipse.jetty.osgi.annotations.AnnotationConfiguration</Item>
<Item>org.eclipse.jetty.osgi.boot.OSGiWebInfConfiguration</Item> <Item>org.eclipse.jetty.osgi.boot.OSGiWebInfConfiguration</Item>

View File

@ -84,7 +84,7 @@
<Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item> <Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.eclipse.jetty.webapp.JmxConfiguration</Item> <Item>org.eclipse.jetty.webapp.JmxConfiguration</Item>
<Item>org.eclipse.jetty.osgi.annotations.AnnotationConfiguration</Item> <Item>org.eclipse.jetty.osgi.annotations.AnnotationConfiguration</Item>
<Item>org.eclipse.jetty.websocket.server.JettyWebSocketConfiguration</Item> <Item>org.eclipse.jetty.websocket.server.config.JettyWebSocketConfiguration</Item>
<Item>org.eclipse.jetty.websocket.javax.server.JavaxWebSocketConfiguration</Item> <Item>org.eclipse.jetty.websocket.javax.server.JavaxWebSocketConfiguration</Item>
<Item>org.eclipse.jetty.osgi.boot.OSGiWebInfConfiguration</Item> <Item>org.eclipse.jetty.osgi.boot.OSGiWebInfConfiguration</Item>
<Item>org.eclipse.jetty.osgi.boot.OSGiMetaInfConfiguration</Item> <Item>org.eclipse.jetty.osgi.boot.OSGiMetaInfConfiguration</Item>

View File

@ -273,7 +273,7 @@ public class LocalServer extends ContainerLifeCycle implements LocalFuzzer.Provi
} }
@Override @Override
public FrameHandlerFactory getFactory() protected FrameHandlerFactory getFactory()
{ {
return factory; return factory;
} }

View File

@ -72,11 +72,7 @@
<extensions>true</extensions> <extensions>true</extensions>
<configuration> <configuration>
<instructions> <instructions>
<Bundle-Description>Websocket Server API</Bundle-Description> <Bundle-Description>Jetty Websocket Server</Bundle-Description>
<Bundle-Classpath/>
<DynamicImport-Package>
org.eclipse.jetty.websocket.server.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}",org.eclipse.jetty.websocket.server.pathmap.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}"
</DynamicImport-Package>
<Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional</Require-Capability> <Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional</Require-Capability>
<Provide-Capability> <Provide-Capability>
osgi.serviceloader;osgi.serviceloader=org.eclipse.jetty.webapp.Configuration,osgi.serviceloader;osgi.serviceloader=javax.servlet.ServletContainerInitializer osgi.serviceloader;osgi.serviceloader=org.eclipse.jetty.webapp.Configuration,osgi.serviceloader;osgi.serviceloader=javax.servlet.ServletContainerInitializer

View File

@ -19,8 +19,8 @@
import javax.servlet.ServletContainerInitializer; import javax.servlet.ServletContainerInitializer;
import org.eclipse.jetty.webapp.Configuration; import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.websocket.server.JettyWebSocketConfiguration; import org.eclipse.jetty.websocket.server.config.JettyWebSocketConfiguration;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer; import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
module org.eclipse.jetty.websocket.jetty.server module org.eclipse.jetty.websocket.jetty.server
{ {

View File

@ -43,7 +43,7 @@ public class JettyServerUpgradeRequest
{ {
private ServletUpgradeRequest upgradeRequest; private ServletUpgradeRequest upgradeRequest;
public JettyServerUpgradeRequest(ServletUpgradeRequest request) JettyServerUpgradeRequest(ServletUpgradeRequest request)
{ {
upgradeRequest = request; upgradeRequest = request;
} }

View File

@ -32,7 +32,7 @@ public class JettyServerUpgradeResponse
{ {
private ServletUpgradeResponse upgradeResponse; private ServletUpgradeResponse upgradeResponse;
public JettyServerUpgradeResponse(ServletUpgradeResponse response) JettyServerUpgradeResponse(ServletUpgradeResponse response)
{ {
upgradeResponse = response; upgradeResponse = response;
} }

View File

@ -42,6 +42,8 @@ import org.eclipse.jetty.websocket.common.WebSocketContainer;
import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.FrameHandler;
import org.eclipse.jetty.websocket.core.WebSocketComponents; import org.eclipse.jetty.websocket.core.WebSocketComponents;
import org.eclipse.jetty.websocket.core.WebSocketException; import org.eclipse.jetty.websocket.core.WebSocketException;
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.server.internal.JettyServerFrameHandlerFactory;
import org.eclipse.jetty.websocket.servlet.FrameHandlerFactory; import org.eclipse.jetty.websocket.servlet.FrameHandlerFactory;
import org.eclipse.jetty.websocket.servlet.WebSocketMapping; import org.eclipse.jetty.websocket.servlet.WebSocketMapping;
@ -94,7 +96,7 @@ public class JettyWebSocketServerContainer extends ContainerLifeCycle implements
* @param webSocketComponents the {@link WebSocketComponents} instance to use * @param webSocketComponents the {@link WebSocketComponents} instance to use
* @param executor the {@link Executor} to use * @param executor the {@link Executor} to use
*/ */
public JettyWebSocketServerContainer(ServletContextHandler contextHandler, WebSocketMapping webSocketMapping, WebSocketComponents webSocketComponents, Executor executor) JettyWebSocketServerContainer(ServletContextHandler contextHandler, WebSocketMapping webSocketMapping, WebSocketComponents webSocketComponents, Executor executor)
{ {
this.webSocketMapping = webSocketMapping; this.webSocketMapping = webSocketMapping;
this.webSocketComponents = webSocketComponents; this.webSocketComponents = webSocketComponents;

View File

@ -18,6 +18,7 @@
package org.eclipse.jetty.websocket.server; package org.eclipse.jetty.websocket.server;
import org.eclipse.jetty.websocket.server.internal.JettyServerFrameHandlerFactory;
import org.eclipse.jetty.websocket.servlet.FrameHandlerFactory; import org.eclipse.jetty.websocket.servlet.FrameHandlerFactory;
import org.eclipse.jetty.websocket.servlet.WebSocketServlet; import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory; import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
@ -33,7 +34,7 @@ public abstract class JettyWebSocketServlet extends WebSocketServlet
} }
@Override @Override
public FrameHandlerFactory getFactory() protected FrameHandlerFactory getFactory()
{ {
JettyServerFrameHandlerFactory frameHandlerFactory = JettyServerFrameHandlerFactory.getFactory(getServletContext()); JettyServerFrameHandlerFactory frameHandlerFactory = JettyServerFrameHandlerFactory.getFactory(getServletContext());

View File

@ -22,17 +22,19 @@ import java.time.Duration;
import java.util.Set; import java.util.Set;
import org.eclipse.jetty.http.pathmap.PathSpec; import org.eclipse.jetty.http.pathmap.PathSpec;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.WebSocketBehavior;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest; import org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest;
import org.eclipse.jetty.websocket.servlet.ServletUpgradeResponse; import org.eclipse.jetty.websocket.servlet.ServletUpgradeResponse;
import org.eclipse.jetty.websocket.servlet.WebSocketCreator; import org.eclipse.jetty.websocket.servlet.WebSocketCreator;
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory; import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
public class JettyWebSocketServletFactory implements WebSocketPolicy
public class JettyWebSocketServletFactory
{ {
private WebSocketServletFactory factory; private WebSocketServletFactory factory;
public JettyWebSocketServletFactory(WebSocketServletFactory factory) JettyWebSocketServletFactory(WebSocketServletFactory factory)
{ {
this.factory = factory; this.factory = factory;
} }
@ -42,81 +44,116 @@ public class JettyWebSocketServletFactory
return factory.getExtensionRegistry().getAvailableExtensionNames(); return factory.getExtensionRegistry().getAvailableExtensionNames();
} }
public Duration getIdleTimeout() @Override
public WebSocketBehavior getBehavior()
{ {
return factory.getIdleTimeout(); return WebSocketBehavior.SERVER;
}
public void setIdleTimeout(Duration duration)
{
factory.setIdleTimeout(duration);
}
public int getInputBufferSize()
{
return factory.getInputBufferSize();
}
public void setInputBufferSize(int bufferSize)
{
factory.setInputBufferSize(bufferSize);
}
public long getMaxFrameSize()
{
return factory.getMaxFrameSize();
}
public void setMaxFrameSize(long maxFrameSize)
{
factory.setMaxFrameSize(maxFrameSize);
}
public long getMaxBinaryMessageSize()
{
return factory.getMaxBinaryMessageSize();
}
public void setMaxBinaryMessageSize(long bufferSize)
{
factory.setMaxBinaryMessageSize(bufferSize);
}
public long getMaxTextMessageSize()
{
return factory.getMaxTextMessageSize();
}
public void setMaxTextMessageSize(long bufferSize)
{
factory.setMaxTextMessageSize(bufferSize);
}
public int getOutputBufferSize()
{
return factory.getOutputBufferSize();
}
public void setOutputBufferSize(int bufferSize)
{
factory.setOutputBufferSize(bufferSize);
} }
/**
* If true, frames are automatically fragmented to respect the maximum frame size.
*
* @return whether to automatically fragment incoming WebSocket Frames.
*/
public boolean isAutoFragment() public boolean isAutoFragment()
{ {
return factory.isAutoFragment(); return factory.isAutoFragment();
} }
/**
* If set to true, frames are automatically fragmented to respect the maximum frame size.
*
* @param autoFragment whether to automatically fragment incoming WebSocket Frames.
*/
public void setAutoFragment(boolean autoFragment) public void setAutoFragment(boolean autoFragment)
{ {
factory.setAutoFragment(autoFragment); factory.setAutoFragment(autoFragment);
} }
public void addMapping(String pathSpec, JettyWebSocketCreator creator) /**
* The maximum payload size of any WebSocket Frame which can be received.
*
* @return the maximum size of a WebSocket Frame.
*/
public long getMaxFrameSize()
{ {
factory.addMapping(pathSpec, new WrappedCreator(creator)); return factory.getMaxFrameSize();
} }
/**
* The maximum payload size of any WebSocket Frame which can be received.
* <p>
* WebSocket Frames over this maximum will result in a close code 1009 {@link StatusCode#MESSAGE_TOO_LARGE}
* </p>
*
* @param maxFrameSize the maximum allowed size of a WebSocket Frame.
*/
public void setMaxFrameSize(long maxFrameSize)
{
factory.setMaxFrameSize(maxFrameSize);
}
@Override
public Duration getIdleTimeout()
{
return factory.getIdleTimeout();
}
@Override
public void setIdleTimeout(Duration duration)
{
factory.setIdleTimeout(duration);
}
@Override
public int getInputBufferSize()
{
return factory.getInputBufferSize();
}
@Override
public void setInputBufferSize(int bufferSize)
{
factory.setInputBufferSize(bufferSize);
}
@Override
public long getMaxBinaryMessageSize()
{
return factory.getMaxBinaryMessageSize();
}
@Override
public void setMaxBinaryMessageSize(long bufferSize)
{
factory.setMaxBinaryMessageSize(bufferSize);
}
@Override
public long getMaxTextMessageSize()
{
return factory.getMaxTextMessageSize();
}
@Override
public void setMaxTextMessageSize(long bufferSize)
{
factory.setMaxTextMessageSize(bufferSize);
}
@Override
public int getOutputBufferSize()
{
return factory.getOutputBufferSize();
}
@Override
public void setOutputBufferSize(int bufferSize)
{
factory.setOutputBufferSize(bufferSize);
}
/** /**
* add a WebSocket mapping to a provided {@link JettyWebSocketCreator}. * add a WebSocket mapping to a provided {@link JettyWebSocketCreator}.
* <p> * <p>
@ -129,7 +166,7 @@ public class JettyWebSocketServletFactory
* @param creator the WebSocketCreator to use * @param creator the WebSocketCreator to use
* @since 10.0 * @since 10.0
*/ */
public void addMapping(PathSpec pathSpec, JettyWebSocketCreator creator) public void addMapping(String pathSpec, JettyWebSocketCreator creator)
{ {
factory.addMapping(pathSpec, new WrappedCreator(creator)); factory.addMapping(pathSpec, new WrappedCreator(creator));
} }
@ -160,64 +197,36 @@ public class JettyWebSocketServletFactory
* @param pathSpec the pathspec to respond on * @param pathSpec the pathspec to respond on
* @return the websocket creator if path spec exists, or null * @return the websocket creator if path spec exists, or null
*/ */
public JettyWebSocketCreator getMapping(PathSpec pathSpec) public JettyWebSocketCreator getMapping(String pathSpec)
{ {
WebSocketCreator creator = factory.getMapping(pathSpec); WebSocketCreator creator = factory.getMapping(parsePathSpec(pathSpec));
if (creator instanceof WrappedCreator) if (creator instanceof WrappedCreator)
return ((WrappedCreator)creator).getCreator(); return ((WrappedCreator)creator).getCreator();
return null; return null;
} }
/**
* Get the MappedResource for the given target path.
*
* @param target the target path
* @return the MappedResource if matched, or null if not matched.
*/
public JettyWebSocketCreator getMatch(String target)
{
WebSocketCreator creator = factory.getMatch(target);
if (creator instanceof WrappedCreator)
return ((WrappedCreator)creator).getCreator();
return null;
}
/**
* Parse a PathSpec string into a PathSpec instance.
* <p>
* Recognized Path Spec syntaxes:
* </p>
* <dl>
* <dt><code>/path/to</code> or <code>/</code> or <code>*.ext</code> or <code>servlet|{spec}</code></dt>
* <dd>Servlet Syntax</dd>
* <dt><code>^{spec}</code> or <code>regex|{spec}</code></dt>
* <dd>Regex Syntax</dd>
* <dt><code>uri-template|{spec}</code></dt>
* <dd>URI Template (see JSR356 and RFC6570 level 1)</dd>
* </dl>
*
* @param rawSpec the raw path spec as String to parse.
* @return the {@link PathSpec} implementation for the rawSpec
*/
public PathSpec parsePathSpec(String rawSpec)
{
return factory.parsePathSpec(rawSpec);
}
/** /**
* Removes the mapping based on the given path spec. * Removes the mapping based on the given path spec.
* *
* @param pathSpec the pathspec to respond on * @param pathSpec the pathspec to respond on
* @return true if underlying mapping were altered, false otherwise * @return true if underlying mapping were altered, false otherwise
*/ */
public boolean removeMapping(PathSpec pathSpec) public boolean removeMapping(String pathSpec)
{ {
return factory.removeMapping(pathSpec); return factory.removeMapping(parsePathSpec(pathSpec));
} }
/**
* Parse a PathSpec string into a PathSpec instance.
*
* @param rawSpec the raw path spec as String to parse.
* @return the {@link PathSpec} implementation for the rawSpec
*/
private PathSpec parsePathSpec(String rawSpec)
{
return factory.parsePathSpec(rawSpec);
}
private static class WrappedCreator implements WebSocketCreator private static class WrappedCreator implements WebSocketCreator
{ {

View File

@ -1,39 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2019 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;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
/**
* @deprecated Moved to #org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter
*/
@Deprecated
public class WebSocketUpgradeFilter extends org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter
{
@Override
public void init(FilterConfig config) throws ServletException
{
super.init(config);
config.getServletContext().log(
WebSocketUpgradeFilter.class.getName() +
" is deprecated. Use " +
org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter.class.getName());
}
}

View File

@ -16,7 +16,7 @@
// ======================================================================== // ========================================================================
// //
package org.eclipse.jetty.websocket.server; package org.eclipse.jetty.websocket.server.config;
import java.util.ServiceLoader; import java.util.ServiceLoader;
@ -59,6 +59,9 @@ public class JettyWebSocketConfiguration extends AbstractConfiguration
protectAndExpose( protectAndExpose(
"org.eclipse.jetty.websocket.api.", "org.eclipse.jetty.websocket.api.",
"org.eclipse.jetty.websocket.server."); "org.eclipse.jetty.websocket.server.");
hide("org.eclipse.jetty.server.internal.",
"org.eclipse.jetty.server.config.");
} }
@Override @Override

View File

@ -16,7 +16,7 @@
// ======================================================================== // ========================================================================
// //
package org.eclipse.jetty.websocket.server; package org.eclipse.jetty.websocket.server.config;
import java.util.Set; import java.util.Set;
@ -29,6 +29,7 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.core.WebSocketComponents; import org.eclipse.jetty.websocket.core.WebSocketComponents;
import org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer;
import org.eclipse.jetty.websocket.servlet.WebSocketMapping; import org.eclipse.jetty.websocket.servlet.WebSocketMapping;
import org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter; import org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter;

View File

@ -1,235 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2019 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.internal;
import java.net.HttpCookie;
import java.net.URI;
import java.security.Principal;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.eclipse.jetty.websocket.api.UpgradeRequest;
import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig;
import org.eclipse.jetty.websocket.common.JettyExtensionConfig;
import org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest;
public class DelegatedJettyServletUpgradeRequest implements UpgradeRequest
{
private final ServletUpgradeRequest servletRequest;
public DelegatedJettyServletUpgradeRequest(ServletUpgradeRequest servletRequest)
{
this.servletRequest = servletRequest;
}
@Override
public void addExtensions(ExtensionConfig... configs)
{
throw new UnsupportedOperationException("Not supported from Servlet API");
}
@Override
public void addExtensions(String... configs)
{
throw new UnsupportedOperationException("Not supported from Servlet API");
}
@Override
public List<HttpCookie> getCookies()
{
return this.servletRequest.getCookies();
}
@Override
public List<ExtensionConfig> getExtensions()
{
return this.servletRequest.getExtensions().stream()
.map((ext) -> new JettyExtensionConfig(ext.getName(), ext.getParameters()))
.collect(Collectors.toList());
}
@Override
public String getHeader(String name)
{
return this.servletRequest.getHeader(name);
}
@Override
public int getHeaderInt(String name)
{
return this.servletRequest.getHeaderInt(name);
}
@Override
public Map<String, List<String>> getHeaders()
{
return this.servletRequest.getHeadersMap();
}
@Override
public List<String> getHeaders(String name)
{
return this.servletRequest.getHeaders(name);
}
@Override
public String getHost()
{
return this.servletRequest.getHost();
}
@Override
public String getHttpVersion()
{
return this.servletRequest.getHttpVersion();
}
@Override
public String getMethod()
{
return this.servletRequest.getMethod();
}
@Override
public String getOrigin()
{
return this.servletRequest.getOrigin();
}
@Override
public Map<String, List<String>> getParameterMap()
{
return this.servletRequest.getParameterMap();
}
@Override
public String getProtocolVersion()
{
return this.servletRequest.getProtocolVersion();
}
@Override
public String getQueryString()
{
return this.servletRequest.getQueryString();
}
@Override
public URI getRequestURI()
{
return this.servletRequest.getRequestURI();
}
@Override
public Object getSession()
{
return this.servletRequest.getSession();
}
@Override
public List<String> getSubProtocols()
{
return this.servletRequest.getSubProtocols();
}
@Override
public Principal getUserPrincipal()
{
return this.servletRequest.getUserPrincipal();
}
@Override
public boolean hasSubProtocol(String test)
{
return this.servletRequest.hasSubProtocol(test);
}
@Override
public boolean isSecure()
{
return this.servletRequest.isSecure();
}
@Override
public void setCookies(List<HttpCookie> cookies)
{
throw new UnsupportedOperationException("Not supported from Servlet API");
}
@Override
public void setExtensions(List<ExtensionConfig> configs)
{
throw new UnsupportedOperationException("Not supported from Servlet API");
}
@Override
public void setHeader(String name, List<String> values)
{
throw new UnsupportedOperationException("Not supported from Servlet API");
}
@Override
public void setHeader(String name, String value)
{
throw new UnsupportedOperationException("Not supported from Servlet API");
}
@Override
public void setHeaders(Map<String, List<String>> headers)
{
throw new UnsupportedOperationException("Not supported from Servlet API");
}
@Override
public void setHttpVersion(String httpVersion)
{
throw new UnsupportedOperationException("Not supported from Servlet API");
}
@Override
public void setMethod(String method)
{
throw new UnsupportedOperationException("Not supported from Servlet API");
}
@Override
public void setRequestURI(URI uri)
{
throw new UnsupportedOperationException("Not supported from Servlet API");
}
@Override
public void setSession(Object session)
{
throw new UnsupportedOperationException("Not supported from Servlet API");
}
@Override
public void setSubProtocols(List<String> protocols)
{
throw new UnsupportedOperationException("Not supported from Servlet API");
}
@Override
public void setSubProtocols(String... protocols)
{
throw new UnsupportedOperationException("Not supported from Servlet API");
}
}

View File

@ -16,7 +16,7 @@
// ======================================================================== // ========================================================================
// //
package org.eclipse.jetty.websocket.server; package org.eclipse.jetty.websocket.server.internal;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;

View File

@ -1,123 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2019 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.internal;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.jetty.websocket.api.UpgradeResponse;
import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig;
import org.eclipse.jetty.websocket.common.JettyExtensionConfig;
import org.eclipse.jetty.websocket.servlet.ServletUpgradeResponse;
public class UpgradeResponseAdapter implements UpgradeResponse
{
private final ServletUpgradeResponse servletResponse;
public UpgradeResponseAdapter(ServletUpgradeResponse servletResponse)
{
this.servletResponse = servletResponse;
}
@Override
public void addHeader(String name, String value)
{
this.servletResponse.addHeader(name, value);
}
@Override
public String getAcceptedSubProtocol()
{
return this.servletResponse.getAcceptedSubProtocol();
}
@Override
public List<ExtensionConfig> getExtensions()
{
return this.servletResponse.getExtensions().stream()
.map((ext) -> new JettyExtensionConfig(ext.getName(), ext.getParameters()))
.collect(Collectors.toList());
}
@Override
public String getHeader(String name)
{
return this.servletResponse.getHeader(name);
}
@Override
public Set<String> getHeaderNames()
{
return this.servletResponse.getHeaderNames();
}
@Override
public Map<String, List<String>> getHeaders()
{
return this.servletResponse.getHeadersMap();
}
@Override
public List<String> getHeaders(String name)
{
return this.servletResponse.getHeaders(name);
}
@Override
public int getStatusCode()
{
return this.servletResponse.getStatusCode();
}
@Override
public void sendForbidden(String message) throws IOException
{
this.servletResponse.sendForbidden(message);
}
@Override
public void setAcceptedSubProtocol(String protocol)
{
this.servletResponse.setAcceptedSubProtocol(protocol);
}
@Override
public void setExtensions(List<ExtensionConfig> extensions)
{
List<org.eclipse.jetty.websocket.core.ExtensionConfig> coreExtensionConfigs = extensions.stream()
.map((ext) -> new org.eclipse.jetty.websocket.core.ExtensionConfig(ext.getName(), ext.getParameters()))
.collect(Collectors.toList());
this.servletResponse.setExtensions(coreExtensionConfigs);
}
@Override
public void setHeader(String name, String value)
{
this.servletResponse.setHeader(name, value);
}
@Override
public void setStatusCode(int statusCode)
{
this.servletResponse.setStatusCode(statusCode);
}
}

View File

@ -1 +1 @@
org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer

View File

@ -1 +1 @@
org.eclipse.jetty.websocket.server.JettyWebSocketConfiguration org.eclipse.jetty.websocket.server.config.JettyWebSocketConfiguration

View File

@ -29,7 +29,6 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.http.pathmap.ServletPathSpec;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.handler.DefaultHandler; import org.eclipse.jetty.server.handler.DefaultHandler;
@ -47,8 +46,8 @@ import org.eclipse.jetty.websocket.server.JettyServerUpgradeRequest;
import org.eclipse.jetty.websocket.server.JettyServerUpgradeResponse; import org.eclipse.jetty.websocket.server.JettyServerUpgradeResponse;
import org.eclipse.jetty.websocket.server.JettyWebSocketCreator; import org.eclipse.jetty.websocket.server.JettyWebSocketCreator;
import org.eclipse.jetty.websocket.server.JettyWebSocketServlet; import org.eclipse.jetty.websocket.server.JettyWebSocketServlet;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory; import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory;
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
/** /**
* Tool to help debug websocket circumstances reported around browsers. * Tool to help debug websocket circumstances reported around browsers.
@ -144,7 +143,7 @@ public class BrowserDebugTool
LOG.debug("Configuring WebSocketServerFactory ..."); LOG.debug("Configuring WebSocketServerFactory ...");
// Setup the desired Socket to use for all incoming upgrade requests // Setup the desired Socket to use for all incoming upgrade requests
factory.addMapping(new ServletPathSpec("/"), new BrowserSocketCreator()); factory.addMapping("/", new BrowserSocketCreator());
// Set the timeout // Set the timeout
factory.setIdleTimeout(Duration.ofSeconds(30)); factory.setIdleTimeout(Duration.ofSeconds(30));

View File

@ -37,7 +37,7 @@ import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.JettyUpgradeListener; import org.eclipse.jetty.websocket.client.JettyUpgradeListener;
import org.eclipse.jetty.websocket.client.WebSocketClient; import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer; import org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer; import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View File

@ -28,7 +28,7 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.client.WebSocketClient; import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer; import org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer; import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View File

@ -33,7 +33,7 @@ import org.eclipse.jetty.websocket.api.UpgradeRequest;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient; import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer; import org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer; import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View File

@ -28,8 +28,8 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.client.WebSocketClient; import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.server.JettyWebSocketServlet; import org.eclipse.jetty.websocket.server.JettyWebSocketServlet;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory; import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory;
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View File

@ -32,8 +32,8 @@ import org.eclipse.jetty.websocket.api.SuspendToken;
import org.eclipse.jetty.websocket.api.annotations.WebSocket; import org.eclipse.jetty.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.websocket.client.WebSocketClient; import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.server.JettyWebSocketServlet; import org.eclipse.jetty.websocket.server.JettyWebSocketServlet;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory; import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory;
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;

View File

@ -39,7 +39,7 @@ import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.UpgradeRequest; import org.eclipse.jetty.websocket.api.UpgradeRequest;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient; import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer; import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.tests.examples.MyAdvancedEchoServlet; import org.eclipse.jetty.websocket.tests.examples.MyAdvancedEchoServlet;
import org.eclipse.jetty.websocket.tests.examples.MyAuthedServlet; import org.eclipse.jetty.websocket.tests.examples.MyAuthedServlet;
import org.eclipse.jetty.websocket.tests.examples.MyEchoServlet; import org.eclipse.jetty.websocket.tests.examples.MyEchoServlet;

View File

@ -41,8 +41,8 @@ import org.eclipse.jetty.websocket.core.OpCode;
import org.eclipse.jetty.websocket.core.internal.Generator; import org.eclipse.jetty.websocket.core.internal.Generator;
import org.eclipse.jetty.websocket.core.internal.WebSocketConnection; import org.eclipse.jetty.websocket.core.internal.WebSocketConnection;
import org.eclipse.jetty.websocket.server.JettyWebSocketServlet; import org.eclipse.jetty.websocket.server.JettyWebSocketServlet;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory; import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory;
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View File

@ -38,8 +38,8 @@ import org.eclipse.jetty.websocket.api.WebSocketListener;
import org.eclipse.jetty.websocket.api.util.WSURI; import org.eclipse.jetty.websocket.api.util.WSURI;
import org.eclipse.jetty.websocket.client.WebSocketClient; import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.server.JettyWebSocketServlet; import org.eclipse.jetty.websocket.server.JettyWebSocketServlet;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory; import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory;
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.tests.CloseTrackingEndpoint; import org.eclipse.jetty.websocket.tests.CloseTrackingEndpoint;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;

View File

@ -51,8 +51,8 @@ import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.core.CloseStatus; import org.eclipse.jetty.websocket.core.CloseStatus;
import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.core.OpCode;
import org.eclipse.jetty.websocket.server.JettyWebSocketServlet; import org.eclipse.jetty.websocket.server.JettyWebSocketServlet;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory; import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory;
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.tests.CloseTrackingEndpoint; import org.eclipse.jetty.websocket.tests.CloseTrackingEndpoint;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;

View File

@ -39,7 +39,7 @@ import org.eclipse.jetty.websocket.common.WebSocketSession;
import org.eclipse.jetty.websocket.core.internal.WebSocketConnection; import org.eclipse.jetty.websocket.core.internal.WebSocketConnection;
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession; import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
import org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer; import org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer; import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.tests.EchoSocket; import org.eclipse.jetty.websocket.tests.EchoSocket;
import org.eclipse.jetty.websocket.tests.EventSocket; import org.eclipse.jetty.websocket.tests.EventSocket;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;

View File

@ -39,8 +39,8 @@ import org.eclipse.jetty.websocket.api.util.WSURI;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient; import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.server.JettyWebSocketServlet; import org.eclipse.jetty.websocket.server.JettyWebSocketServlet;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory; import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory;
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.tests.CloseTrackingEndpoint; import org.eclipse.jetty.websocket.tests.CloseTrackingEndpoint;
import org.eclipse.jetty.websocket.tests.EchoCreator; import org.eclipse.jetty.websocket.tests.EchoCreator;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;

View File

@ -33,8 +33,8 @@ import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.util.WSURI; import org.eclipse.jetty.websocket.api.util.WSURI;
import org.eclipse.jetty.websocket.client.WebSocketClient; import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.server.JettyWebSocketServlet; import org.eclipse.jetty.websocket.server.JettyWebSocketServlet;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory; import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory;
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.tests.CloseTrackingEndpoint; import org.eclipse.jetty.websocket.tests.CloseTrackingEndpoint;
import org.eclipse.jetty.websocket.tests.EchoSocket; import org.eclipse.jetty.websocket.tests.EchoSocket;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;

View File

@ -38,8 +38,8 @@ import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.common.WebSocketSession; import org.eclipse.jetty.websocket.common.WebSocketSession;
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession; import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
import org.eclipse.jetty.websocket.server.JettyWebSocketServlet; import org.eclipse.jetty.websocket.server.JettyWebSocketServlet;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory; import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory;
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.tests.CloseTrackingEndpoint; import org.eclipse.jetty.websocket.tests.CloseTrackingEndpoint;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;

View File

@ -44,8 +44,8 @@ import org.eclipse.jetty.websocket.core.internal.WebSocketConnection;
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession; import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
import org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer; import org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer;
import org.eclipse.jetty.websocket.server.JettyWebSocketServlet; import org.eclipse.jetty.websocket.server.JettyWebSocketServlet;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory; import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory;
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.tests.EventSocket; import org.eclipse.jetty.websocket.tests.EventSocket;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;

View File

@ -33,8 +33,8 @@ import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.util.WSURI; import org.eclipse.jetty.websocket.api.util.WSURI;
import org.eclipse.jetty.websocket.client.WebSocketClient; import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.server.JettyWebSocketServlet; import org.eclipse.jetty.websocket.server.JettyWebSocketServlet;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory; import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory;
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.tests.CloseTrackingEndpoint; import org.eclipse.jetty.websocket.tests.CloseTrackingEndpoint;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;

View File

@ -107,7 +107,7 @@ public abstract class WebSocketServlet extends HttpServlet
/** /**
* @return the instance of {@link FrameHandlerFactory} to be used to create the FrameHandler * @return the instance of {@link FrameHandlerFactory} to be used to create the FrameHandler
*/ */
public abstract FrameHandlerFactory getFactory(); protected abstract FrameHandlerFactory getFactory();
@Override @Override
public void init() throws ServletException public void init() throws ServletException

View File

@ -17,7 +17,7 @@
<Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item> <Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.eclipse.jetty.webapp.JmxConfiguration</Item> <Item>org.eclipse.jetty.webapp.JmxConfiguration</Item>
<Item>org.eclipse.jetty.annotations.AnnotationConfiguration</Item> <Item>org.eclipse.jetty.annotations.AnnotationConfiguration</Item>
<Item>org.eclipse.jetty.websocket.server.JettyWebSocketConfiguration</Item> <Item>org.eclipse.jetty.websocket.server.config.JettyWebSocketConfiguration</Item>
<Item>org.eclipse.jetty.websocket.jsr356.server.JavaxWebSocketConfiguration</Item> <Item>org.eclipse.jetty.websocket.jsr356.server.JavaxWebSocketConfiguration</Item>
</Array> </Array>
</Arg> </Arg>

View File

@ -65,7 +65,7 @@ public class WebSocketChatServlet extends JettyWebSocketServlet implements Jetty
@Override @Override
public void configure(JettyWebSocketServletFactory factory) public void configure(JettyWebSocketServletFactory factory)
{ {
factory.addMapping(factory.parsePathSpec("/"), this); factory.addMapping("/", this);
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */