Merge pull request #9356 from eclipse/jetty-12.0.x-websocket-JPMS
cleanup of websocket to fix JPMS warnings
This commit is contained in:
commit
81046650ab
|
@ -38,7 +38,7 @@
|
||||||
<extensions>true</extensions>
|
<extensions>true</extensions>
|
||||||
<configuration>
|
<configuration>
|
||||||
<instructions>
|
<instructions>
|
||||||
<Export-Package>*,org.eclipse.jetty.websocket.core.client.internal.*</Export-Package>
|
<Export-Package>*</Export-Package>
|
||||||
</instructions>
|
</instructions>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -47,16 +47,16 @@ import org.eclipse.jetty.websocket.core.Behavior;
|
||||||
import org.eclipse.jetty.websocket.core.Configuration;
|
import org.eclipse.jetty.websocket.core.Configuration;
|
||||||
import org.eclipse.jetty.websocket.core.CoreSession;
|
import org.eclipse.jetty.websocket.core.CoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
||||||
|
import org.eclipse.jetty.websocket.core.ExtensionStack;
|
||||||
import org.eclipse.jetty.websocket.core.FrameHandler;
|
import org.eclipse.jetty.websocket.core.FrameHandler;
|
||||||
|
import org.eclipse.jetty.websocket.core.Negotiated;
|
||||||
|
import org.eclipse.jetty.websocket.core.WebSocketConnection;
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketConstants;
|
import org.eclipse.jetty.websocket.core.WebSocketConstants;
|
||||||
|
import org.eclipse.jetty.websocket.core.WebSocketCoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.client.internal.HttpUpgraderOverHTTP;
|
import org.eclipse.jetty.websocket.core.client.internal.HttpUpgraderOverHTTP;
|
||||||
import org.eclipse.jetty.websocket.core.client.internal.HttpUpgraderOverHTTP2;
|
import org.eclipse.jetty.websocket.core.client.internal.HttpUpgraderOverHTTP2;
|
||||||
import org.eclipse.jetty.websocket.core.exception.UpgradeException;
|
import org.eclipse.jetty.websocket.core.exception.UpgradeException;
|
||||||
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
|
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.ExtensionStack;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.Negotiated;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketConnection;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -480,8 +480,8 @@ public abstract class CoreClientUpgradeRequest implements Response.CompleteListe
|
||||||
HttpClient httpClient = wsClient.getHttpClient();
|
HttpClient httpClient = wsClient.getHttpClient();
|
||||||
ByteBufferPool bufferPool = wsClient.getWebSocketComponents().getByteBufferPool();
|
ByteBufferPool bufferPool = wsClient.getWebSocketComponents().getByteBufferPool();
|
||||||
WebSocketConnection wsConnection = new WebSocketConnection(endPoint, httpClient.getExecutor(), httpClient.getScheduler(), bufferPool, coreSession);
|
WebSocketConnection wsConnection = new WebSocketConnection(endPoint, httpClient.getExecutor(), httpClient.getScheduler(), bufferPool, coreSession);
|
||||||
wsClient.getEventListeners().forEach(wsConnection::addEventListener);
|
|
||||||
coreSession.setWebSocketConnection(wsConnection);
|
coreSession.setWebSocketConnection(wsConnection);
|
||||||
|
wsClient.getEventListeners().forEach(wsConnection::addEventListener);
|
||||||
Throwable listenerError = notifyUpgradeListeners((listener) -> listener.onHandshakeResponse(request, response));
|
Throwable listenerError = notifyUpgradeListeners((listener) -> listener.onHandshakeResponse(request, response));
|
||||||
if (listenerError != null)
|
if (listenerError != null)
|
||||||
throw new WebSocketException("onHandshakeResponse error", listenerError);
|
throw new WebSocketException("onHandshakeResponse error", listenerError);
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.eclipse.jetty.io.EndPoint;
|
||||||
import org.eclipse.jetty.util.Callback;
|
import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketConstants;
|
import org.eclipse.jetty.websocket.core.WebSocketConstants;
|
||||||
import org.eclipse.jetty.websocket.core.client.CoreClientUpgradeRequest;
|
import org.eclipse.jetty.websocket.core.client.CoreClientUpgradeRequest;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCore;
|
import org.eclipse.jetty.websocket.core.util.WebSocketUtils;
|
||||||
|
|
||||||
public class HttpUpgraderOverHTTP implements HttpUpgrader
|
public class HttpUpgraderOverHTTP implements HttpUpgrader
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@ public class HttpUpgraderOverHTTP implements HttpUpgrader
|
||||||
{
|
{
|
||||||
// Check the Accept hash
|
// Check the Accept hash
|
||||||
String reqKey = requestHeaders.get(HttpHeader.SEC_WEBSOCKET_KEY);
|
String reqKey = requestHeaders.get(HttpHeader.SEC_WEBSOCKET_KEY);
|
||||||
String expectedHash = WebSocketCore.hashKey(reqKey);
|
String expectedHash = WebSocketUtils.hashKey(reqKey);
|
||||||
String respHash = responseHeaders.get(HttpHeader.SEC_WEBSOCKET_ACCEPT);
|
String respHash = responseHeaders.get(HttpHeader.SEC_WEBSOCKET_ACCEPT);
|
||||||
if (expectedHash.equalsIgnoreCase(respHash))
|
if (expectedHash.equalsIgnoreCase(respHash))
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<configuration>
|
<configuration>
|
||||||
<instructions>
|
<instructions>
|
||||||
<Bundle-Description>Jetty Websocket Core Common</Bundle-Description>
|
<Bundle-Description>Jetty Websocket Core Common</Bundle-Description>
|
||||||
<Export-Package>*,org.eclipse.jetty.websocket.core.common.internal.*</Export-Package>
|
<Export-Package>*</Export-Package>
|
||||||
<Require-Capability>
|
<Require-Capability>
|
||||||
osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)"; resolution:=optional
|
osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)"; resolution:=optional
|
||||||
</Require-Capability>
|
</Require-Capability>
|
||||||
|
|
|
@ -21,53 +21,11 @@ module org.eclipse.jetty.websocket.core.common
|
||||||
|
|
||||||
exports org.eclipse.jetty.websocket.core;
|
exports org.eclipse.jetty.websocket.core;
|
||||||
exports org.eclipse.jetty.websocket.core.exception;
|
exports org.eclipse.jetty.websocket.core.exception;
|
||||||
|
exports org.eclipse.jetty.websocket.core.messages;
|
||||||
|
exports org.eclipse.jetty.websocket.core.util;
|
||||||
exports org.eclipse.jetty.websocket.core.internal to
|
exports org.eclipse.jetty.websocket.core.internal to
|
||||||
org.eclipse.jetty.websocket.core.client,
|
|
||||||
org.eclipse.jetty.websocket.core.server,
|
|
||||||
org.eclipse.jetty.util; // Export to DecoratedObjectFactory.
|
org.eclipse.jetty.util; // Export to DecoratedObjectFactory.
|
||||||
|
|
||||||
// The Jetty & Jakarta API Layers need to access both access some internal utilities which we don't want to expose.
|
|
||||||
exports org.eclipse.jetty.websocket.core.internal.util to
|
|
||||||
org.eclipse.jetty.ee8.websocket.jetty.common,
|
|
||||||
org.eclipse.jetty.ee8.websocket.jetty.client,
|
|
||||||
org.eclipse.jetty.ee8.websocket.jetty.server,
|
|
||||||
org.eclipse.jetty.ee8.websocket.javax.common,
|
|
||||||
org.eclipse.jetty.ee8.websocket.javax.client,
|
|
||||||
org.eclipse.jetty.ee8.websocket.javax.server,
|
|
||||||
org.eclipse.jetty.ee9.websocket.jetty.common,
|
|
||||||
org.eclipse.jetty.ee9.websocket.jetty.client,
|
|
||||||
org.eclipse.jetty.ee9.websocket.jetty.server,
|
|
||||||
org.eclipse.jetty.ee9.websocket.jakarta.common,
|
|
||||||
org.eclipse.jetty.ee9.websocket.jakarta.client,
|
|
||||||
org.eclipse.jetty.ee9.websocket.jakarta.server,
|
|
||||||
org.eclipse.jetty.ee10.websocket.jetty.common,
|
|
||||||
org.eclipse.jetty.ee10.websocket.jetty.client,
|
|
||||||
org.eclipse.jetty.ee10.websocket.jetty.server,
|
|
||||||
org.eclipse.jetty.ee10.websocket.jakarta.common,
|
|
||||||
org.eclipse.jetty.ee10.websocket.jakarta.client,
|
|
||||||
org.eclipse.jetty.ee10.websocket.jakarta.server;
|
|
||||||
|
|
||||||
exports org.eclipse.jetty.websocket.core.internal.messages to
|
|
||||||
org.eclipse.jetty.ee8.websocket.jetty.common,
|
|
||||||
org.eclipse.jetty.ee8.websocket.jetty.client,
|
|
||||||
org.eclipse.jetty.ee8.websocket.jetty.server,
|
|
||||||
org.eclipse.jetty.ee8.websocket.javax.common,
|
|
||||||
org.eclipse.jetty.ee8.websocket.javax.client,
|
|
||||||
org.eclipse.jetty.ee8.websocket.javax.server,
|
|
||||||
org.eclipse.jetty.ee9.websocket.jetty.common,
|
|
||||||
org.eclipse.jetty.ee9.websocket.jetty.client,
|
|
||||||
org.eclipse.jetty.ee9.websocket.jetty.server,
|
|
||||||
org.eclipse.jetty.ee9.websocket.jakarta.common,
|
|
||||||
org.eclipse.jetty.ee9.websocket.jakarta.client,
|
|
||||||
org.eclipse.jetty.ee9.websocket.jakarta.server,
|
|
||||||
org.eclipse.jetty.ee10.websocket.jetty.common,
|
|
||||||
org.eclipse.jetty.ee10.websocket.jetty.client,
|
|
||||||
org.eclipse.jetty.ee10.websocket.jetty.server,
|
|
||||||
org.eclipse.jetty.ee10.websocket.jakarta.common,
|
|
||||||
org.eclipse.jetty.ee10.websocket.jakarta.client,
|
|
||||||
org.eclipse.jetty.ee10.websocket.jakarta.server;
|
|
||||||
|
|
||||||
uses org.eclipse.jetty.websocket.core.Extension;
|
uses org.eclipse.jetty.websocket.core.Extension;
|
||||||
|
|
||||||
provides org.eclipse.jetty.websocket.core.Extension with
|
provides org.eclipse.jetty.websocket.core.Extension with
|
||||||
|
|
|
@ -25,13 +25,8 @@ import org.eclipse.jetty.util.Callback;
|
||||||
/**
|
/**
|
||||||
* Represents the outgoing Frames.
|
* Represents the outgoing Frames.
|
||||||
*/
|
*/
|
||||||
public interface CoreSession extends OutgoingFrames, Configuration
|
public interface CoreSession extends OutgoingFrames, IncomingFrames, Configuration
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* The negotiated WebSocket Sub-Protocol for this session.
|
|
||||||
*
|
|
||||||
* @return the negotiated WebSocket Sub-Protocol for this session.
|
|
||||||
*/
|
|
||||||
String getNegotiatedSubProtocol();
|
String getNegotiatedSubProtocol();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -120,11 +115,8 @@ public interface CoreSession extends OutgoingFrames, Configuration
|
||||||
*/
|
*/
|
||||||
boolean isOutputOpen();
|
boolean isOutputOpen();
|
||||||
|
|
||||||
/**
|
boolean isClosed();
|
||||||
* If using BatchMode.ON or BatchMode.AUTO, trigger a flush of enqueued / batched frames.
|
|
||||||
*
|
|
||||||
* @param callback the callback to track close frame sent (or failed)
|
|
||||||
*/
|
|
||||||
void flush(Callback callback);
|
void flush(Callback callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -270,6 +262,12 @@ public interface CoreSession extends OutgoingFrames, Configuration
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isClosed()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void flush(Callback callback)
|
public void flush(Callback callback)
|
||||||
{
|
{
|
||||||
|
@ -293,6 +291,12 @@ public interface CoreSession extends OutgoingFrames, Configuration
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFrame(Frame frame, Callback callback)
|
||||||
|
{
|
||||||
|
callback.succeeded();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendFrame(Frame frame, Callback callback, boolean batch)
|
public void sendFrame(Frame frame, Callback callback, boolean batch)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal;
|
package org.eclipse.jetty.websocket.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -26,14 +26,8 @@ import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||||
import org.eclipse.jetty.util.component.Dumpable;
|
import org.eclipse.jetty.util.component.Dumpable;
|
||||||
import org.eclipse.jetty.websocket.core.Behavior;
|
|
||||||
import org.eclipse.jetty.websocket.core.Extension;
|
|
||||||
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
|
||||||
import org.eclipse.jetty.websocket.core.IncomingFrames;
|
|
||||||
import org.eclipse.jetty.websocket.core.OutgoingFrames;
|
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
|
||||||
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
|
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
|
||||||
|
import org.eclipse.jetty.websocket.core.util.DemandChain;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -258,7 +252,7 @@ public class ExtensionStack implements IncomingFrames, OutgoingFrames, Dumpable
|
||||||
outgoing.sendFrame(frame, callback, batch);
|
outgoing.sendFrame(frame, callback, batch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize(IncomingFrames incoming, OutgoingFrames outgoing, WebSocketCoreSession coreSession)
|
public void initialize(IncomingFrames incoming, OutgoingFrames outgoing, CoreSession coreSession)
|
||||||
{
|
{
|
||||||
if (extensions == null)
|
if (extensions == null)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core;
|
package org.eclipse.jetty.websocket.core;
|
||||||
|
|
||||||
|
import java.io.Closeable;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@ -510,4 +511,54 @@ public class Frame
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Parsed extends Frame implements Closeable, CloseStatus.Supplier
|
||||||
|
{
|
||||||
|
final CloseStatus closeStatus;
|
||||||
|
final Runnable releaser;
|
||||||
|
|
||||||
|
public Parsed(byte firstByte, byte[] mask, ByteBuffer payload, Runnable releaser)
|
||||||
|
{
|
||||||
|
super(firstByte, mask, payload);
|
||||||
|
demask();
|
||||||
|
this.releaser = releaser;
|
||||||
|
if (getOpCode() == OpCode.CLOSE)
|
||||||
|
{
|
||||||
|
if (hasPayload())
|
||||||
|
closeStatus = new CloseStatus(payload.duplicate());
|
||||||
|
else
|
||||||
|
closeStatus = CloseStatus.NO_CODE_STATUS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
closeStatus = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close()
|
||||||
|
{
|
||||||
|
if (releaser != null)
|
||||||
|
releaser.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CloseStatus getCloseStatus()
|
||||||
|
{
|
||||||
|
return closeStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isReleaseable()
|
||||||
|
{
|
||||||
|
return releaser != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
if (closeStatus == null)
|
||||||
|
return super.toString();
|
||||||
|
return super.toString() + ":" + closeStatus;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal;
|
package org.eclipse.jetty.websocket.core;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
@ -23,11 +23,9 @@ import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.eclipse.jetty.http.HttpScheme;
|
import org.eclipse.jetty.http.HttpScheme;
|
||||||
import org.eclipse.jetty.util.MultiMap;
|
import org.eclipse.jetty.util.Fields;
|
||||||
import org.eclipse.jetty.util.StringUtil;
|
import org.eclipse.jetty.util.StringUtil;
|
||||||
import org.eclipse.jetty.util.UrlEncoded;
|
import org.eclipse.jetty.util.UrlEncoded;
|
||||||
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketConstants;
|
|
||||||
|
|
||||||
public class Negotiated
|
public class Negotiated
|
||||||
{
|
{
|
||||||
|
@ -56,11 +54,11 @@ public class Negotiated
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
map = new HashMap<>();
|
map = new HashMap<>();
|
||||||
MultiMap<String> params = new MultiMap<>();
|
Fields fields = new Fields();
|
||||||
UrlEncoded.decodeUtf8To(rawQuery, params);
|
UrlEncoded.decodeUtf8To(rawQuery, fields);
|
||||||
for (String p : params.keySet())
|
for (Fields.Field field : fields)
|
||||||
{
|
{
|
||||||
map.put(p, Collections.unmodifiableList(params.getValues(p)));
|
map.put(field.getValue(), Collections.unmodifiableList(field.getValues()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.parameterMap = Collections.unmodifiableMap(map);
|
this.parameterMap = Collections.unmodifiableMap(map);
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal;
|
package org.eclipse.jetty.websocket.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
@ -34,9 +34,10 @@ import org.eclipse.jetty.util.MathUtils;
|
||||||
import org.eclipse.jetty.util.component.Dumpable;
|
import org.eclipse.jetty.util.component.Dumpable;
|
||||||
import org.eclipse.jetty.util.thread.AutoLock;
|
import org.eclipse.jetty.util.thread.AutoLock;
|
||||||
import org.eclipse.jetty.util.thread.Scheduler;
|
import org.eclipse.jetty.util.thread.Scheduler;
|
||||||
import org.eclipse.jetty.websocket.core.Behavior;
|
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
|
||||||
import org.eclipse.jetty.websocket.core.exception.WebSocketTimeoutException;
|
import org.eclipse.jetty.websocket.core.exception.WebSocketTimeoutException;
|
||||||
|
import org.eclipse.jetty.websocket.core.internal.FrameFlusher;
|
||||||
|
import org.eclipse.jetty.websocket.core.internal.Generator;
|
||||||
|
import org.eclipse.jetty.websocket.core.internal.Parser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -129,16 +130,6 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
|
||||||
return super.getExecutor();
|
return super.getExecutor();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Generator getGenerator()
|
|
||||||
{
|
|
||||||
return generator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Parser getParser()
|
|
||||||
{
|
|
||||||
return parser;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the local InetSocketAddress
|
* @return the local InetSocketAddress
|
||||||
* @deprecated use {@link #getLocalSocketAddress()} instead
|
* @deprecated use {@link #getLocalSocketAddress()} instead
|
||||||
|
@ -180,6 +171,11 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
|
||||||
return useInputDirectByteBuffers;
|
return useInputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setWriteTimeout(long writeTimeout)
|
||||||
|
{
|
||||||
|
flusher.setIdleTimeout(writeTimeout);
|
||||||
|
}
|
||||||
|
|
||||||
public void setUseInputDirectByteBuffers(boolean useInputDirectByteBuffers)
|
public void setUseInputDirectByteBuffers(boolean useInputDirectByteBuffers)
|
||||||
{
|
{
|
||||||
this.useInputDirectByteBuffers = useInputDirectByteBuffers;
|
this.useInputDirectByteBuffers = useInputDirectByteBuffers;
|
||||||
|
@ -239,7 +235,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onFrame(Parser.ParsedFrame frame)
|
protected void onFrame(Frame.Parsed frame)
|
||||||
{
|
{
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("onFrame({})", frame);
|
LOG.debug("onFrame({})", frame);
|
||||||
|
@ -427,7 +423,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
|
||||||
// Parse and handle frames
|
// Parse and handle frames
|
||||||
while (networkBuffer.hasRemaining())
|
while (networkBuffer.hasRemaining())
|
||||||
{
|
{
|
||||||
Parser.ParsedFrame frame = parser.parse(networkBuffer.getByteBuffer());
|
Frame.Parsed frame = parser.parse(networkBuffer.getByteBuffer());
|
||||||
if (frame == null)
|
if (frame == null)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -573,11 +569,6 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
|
||||||
setInitialBuffer(buffer);
|
setInitialBuffer(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FrameFlusher getFrameFlusher()
|
|
||||||
{
|
|
||||||
return flusher;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getMessagesIn()
|
public long getMessagesIn()
|
||||||
{
|
{
|
||||||
|
@ -609,7 +600,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
|
||||||
* @param callback The callback to call once the frame is sent
|
* @param callback The callback to call once the frame is sent
|
||||||
* @param batch True if batch mode is to be used
|
* @param batch True if batch mode is to be used
|
||||||
*/
|
*/
|
||||||
void enqueueFrame(Frame frame, Callback callback, boolean batch)
|
public void enqueueFrame(Frame frame, Callback callback, boolean batch)
|
||||||
{
|
{
|
||||||
if (coreSession.getBehavior() == Behavior.CLIENT)
|
if (coreSession.getBehavior() == Behavior.CLIENT)
|
||||||
{
|
{
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal;
|
package org.eclipse.jetty.websocket.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
|
@ -30,23 +30,14 @@ import org.eclipse.jetty.io.ByteBufferPool;
|
||||||
import org.eclipse.jetty.util.Callback;
|
import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.util.Utf8Appendable;
|
import org.eclipse.jetty.util.Utf8Appendable;
|
||||||
import org.eclipse.jetty.util.component.Dumpable;
|
import org.eclipse.jetty.util.component.Dumpable;
|
||||||
import org.eclipse.jetty.websocket.core.Behavior;
|
|
||||||
import org.eclipse.jetty.websocket.core.CloseStatus;
|
|
||||||
import org.eclipse.jetty.websocket.core.Configuration;
|
|
||||||
import org.eclipse.jetty.websocket.core.CoreSession;
|
|
||||||
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
|
||||||
import org.eclipse.jetty.websocket.core.FrameHandler;
|
|
||||||
import org.eclipse.jetty.websocket.core.IncomingFrames;
|
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
|
||||||
import org.eclipse.jetty.websocket.core.OutgoingFrames;
|
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketConstants;
|
|
||||||
import org.eclipse.jetty.websocket.core.exception.CloseException;
|
import org.eclipse.jetty.websocket.core.exception.CloseException;
|
||||||
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
||||||
import org.eclipse.jetty.websocket.core.exception.WebSocketTimeoutException;
|
import org.eclipse.jetty.websocket.core.exception.WebSocketTimeoutException;
|
||||||
import org.eclipse.jetty.websocket.core.exception.WebSocketWriteTimeoutException;
|
import org.eclipse.jetty.websocket.core.exception.WebSocketWriteTimeoutException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.FrameValidation;
|
import org.eclipse.jetty.websocket.core.internal.FrameFlusher;
|
||||||
|
import org.eclipse.jetty.websocket.core.internal.WebSocketSessionState;
|
||||||
|
import org.eclipse.jetty.websocket.core.util.FragmentingFlusher;
|
||||||
|
import org.eclipse.jetty.websocket.core.util.FrameValidation;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -55,7 +46,7 @@ import static org.eclipse.jetty.util.Callback.NOOP;
|
||||||
/**
|
/**
|
||||||
* The Core WebSocket Session.
|
* The Core WebSocket Session.
|
||||||
*/
|
*/
|
||||||
public class WebSocketCoreSession implements IncomingFrames, CoreSession, Dumpable
|
public class WebSocketCoreSession implements CoreSession, Dumpable
|
||||||
{
|
{
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(WebSocketCoreSession.class);
|
private static final Logger LOG = LoggerFactory.getLogger(WebSocketCoreSession.class);
|
||||||
private static final CloseStatus NO_CODE = new CloseStatus(CloseStatus.NO_CODE);
|
private static final CloseStatus NO_CODE = new CloseStatus(CloseStatus.NO_CODE);
|
||||||
|
@ -172,7 +163,7 @@ public class WebSocketCoreSession implements IncomingFrames, CoreSession, Dumpab
|
||||||
{
|
{
|
||||||
writeTimeout = timeout;
|
writeTimeout = timeout;
|
||||||
if (getConnection() != null)
|
if (getConnection() != null)
|
||||||
getConnection().getFrameFlusher().setIdleTimeout(timeout.toMillis());
|
getConnection().setWriteTimeout(timeout.toMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public SocketAddress getLocalAddress()
|
public SocketAddress getLocalAddress()
|
||||||
|
@ -202,10 +193,14 @@ public class WebSocketCoreSession implements IncomingFrames, CoreSession, Dumpab
|
||||||
return sessionState.isClosed();
|
return sessionState.isClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to set the WebSocketConnection on this {@link WebSocketCoreSession}.
|
||||||
|
* @param connection the websocket connection.
|
||||||
|
*/
|
||||||
public void setWebSocketConnection(WebSocketConnection connection)
|
public void setWebSocketConnection(WebSocketConnection connection)
|
||||||
{
|
{
|
||||||
connection.getEndPoint().setIdleTimeout(idleTimeout.toMillis());
|
connection.getEndPoint().setIdleTimeout(idleTimeout.toMillis());
|
||||||
connection.getFrameFlusher().setIdleTimeout(writeTimeout.toMillis());
|
connection.setWriteTimeout(writeTimeout.toMillis());
|
||||||
extensionStack.setLastDemand(connection::demand);
|
extensionStack.setLastDemand(connection::demand);
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
}
|
}
|
||||||
|
@ -245,6 +240,9 @@ public class WebSocketCoreSession implements IncomingFrames, CoreSession, Dumpab
|
||||||
return components.getByteBufferPool();
|
return components.getByteBufferPool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to notify the {@link WebSocketCoreSession} that EOF has been read or the connection has been closed.
|
||||||
|
*/
|
||||||
public void onEof()
|
public void onEof()
|
||||||
{
|
{
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
|
@ -377,7 +375,7 @@ public class WebSocketCoreSession implements IncomingFrames, CoreSession, Dumpab
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open/Activate the session.
|
* Used to notify the {@link WebSocketCoreSession} that the connection has been opened.
|
||||||
*/
|
*/
|
||||||
public void onOpen()
|
public void onOpen()
|
||||||
{
|
{
|
||||||
|
@ -810,7 +808,7 @@ public class WebSocketCoreSession implements IncomingFrames, CoreSession, Dumpab
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void forwardFrame(Frame frame, Callback callback, boolean batch)
|
protected void forwardFrame(Frame frame, Callback callback, boolean batch)
|
||||||
{
|
{
|
||||||
negotiated.getExtensions().sendFrame(frame, callback, batch);
|
negotiated.getExtensions().sendFrame(frame, callback, batch);
|
||||||
}
|
}
|
|
@ -16,7 +16,7 @@ package org.eclipse.jetty.websocket.core.exception;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.ReflectUtils;
|
import org.eclipse.jetty.websocket.core.util.ReflectUtils;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class DuplicateAnnotationException extends InvalidWebSocketException
|
public class DuplicateAnnotationException extends InvalidWebSocketException
|
||||||
|
|
|
@ -17,7 +17,7 @@ import java.lang.annotation.Annotation;
|
||||||
import java.lang.invoke.MethodType;
|
import java.lang.invoke.MethodType;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.ReflectUtils;
|
import org.eclipse.jetty.websocket.core.util.ReflectUtils;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class InvalidSignatureException extends InvalidWebSocketException
|
public class InvalidSignatureException extends InvalidWebSocketException
|
||||||
|
|
|
@ -23,6 +23,9 @@ import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||||
|
import org.eclipse.jetty.websocket.core.util.DemandChain;
|
||||||
|
import org.eclipse.jetty.websocket.core.util.DemandingFlusher;
|
||||||
|
import org.eclipse.jetty.websocket.core.util.FragmentingFlusher;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -42,7 +45,7 @@ public class FragmentExtension extends AbstractExtension implements DemandChain
|
||||||
outgoingFlusher = new FragmentingFlusher(configuration)
|
outgoingFlusher = new FragmentingFlusher(configuration)
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
void forwardFrame(Frame frame, Callback callback, boolean batch)
|
protected void forwardFrame(Frame frame, Callback callback, boolean batch)
|
||||||
{
|
{
|
||||||
nextOutgoingFrame(frame, callback, batch);
|
nextOutgoingFrame(frame, callback, batch);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,14 +13,12 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal;
|
package org.eclipse.jetty.websocket.core.internal;
|
||||||
|
|
||||||
import java.io.Closeable;
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
import org.eclipse.jetty.io.ByteBufferPool;
|
import org.eclipse.jetty.io.ByteBufferPool;
|
||||||
import org.eclipse.jetty.io.RetainableByteBuffer;
|
import org.eclipse.jetty.io.RetainableByteBuffer;
|
||||||
import org.eclipse.jetty.util.BufferUtil;
|
import org.eclipse.jetty.util.BufferUtil;
|
||||||
import org.eclipse.jetty.util.StringUtil;
|
import org.eclipse.jetty.util.StringUtil;
|
||||||
import org.eclipse.jetty.websocket.core.CloseStatus;
|
|
||||||
import org.eclipse.jetty.websocket.core.Configuration;
|
import org.eclipse.jetty.websocket.core.Configuration;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
|
@ -87,7 +85,7 @@ public class Parser
|
||||||
* @return Frame or null if not enough data for a complete frame.
|
* @return Frame or null if not enough data for a complete frame.
|
||||||
* @throws WebSocketException if unable to parse properly
|
* @throws WebSocketException if unable to parse properly
|
||||||
*/
|
*/
|
||||||
public ParsedFrame parse(ByteBuffer buffer) throws WebSocketException
|
public Frame.Parsed parse(ByteBuffer buffer) throws WebSocketException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -212,7 +210,7 @@ public class Parser
|
||||||
{
|
{
|
||||||
if (aggregate == null)
|
if (aggregate == null)
|
||||||
checkFrameSize(OpCode.getOpCode(firstByte), payloadLength);
|
checkFrameSize(OpCode.getOpCode(firstByte), payloadLength);
|
||||||
ParsedFrame frame = parsePayload(buffer);
|
Frame.Parsed frame = parsePayload(buffer);
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("{} parsed {}", this, frame);
|
LOG.debug("{} parsed {}", this, frame);
|
||||||
return frame;
|
return frame;
|
||||||
|
@ -265,7 +263,7 @@ public class Parser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ParsedFrame newFrame(byte firstByte, byte[] mask, ByteBuffer payload, Runnable releaser)
|
protected Frame.Parsed newFrame(byte firstByte, byte[] mask, ByteBuffer payload, Runnable releaser)
|
||||||
{
|
{
|
||||||
// Validate OpCode
|
// Validate OpCode
|
||||||
byte opcode = OpCode.getOpCode(firstByte);
|
byte opcode = OpCode.getOpCode(firstByte);
|
||||||
|
@ -277,10 +275,10 @@ public class Parser
|
||||||
if (OpCode.isControlFrame(opcode) && !fin)
|
if (OpCode.isControlFrame(opcode) && !fin)
|
||||||
throw new ProtocolException("Fragmented Control Frame [" + OpCode.name(opcode) + "]");
|
throw new ProtocolException("Fragmented Control Frame [" + OpCode.name(opcode) + "]");
|
||||||
|
|
||||||
return new ParsedFrame(firstByte, mask, payload, releaser);
|
return new Frame.Parsed(firstByte, mask, payload, releaser);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ParsedFrame autoFragment(ByteBuffer buffer, int fragmentSize)
|
private Frame.Parsed autoFragment(ByteBuffer buffer, int fragmentSize)
|
||||||
{
|
{
|
||||||
payloadLength -= fragmentSize;
|
payloadLength -= fragmentSize;
|
||||||
|
|
||||||
|
@ -299,14 +297,14 @@ public class Parser
|
||||||
content.limit(fragmentSize);
|
content.limit(fragmentSize);
|
||||||
buffer.position(buffer.position() + fragmentSize);
|
buffer.position(buffer.position() + fragmentSize);
|
||||||
|
|
||||||
final ParsedFrame frame = newFrame((byte)(firstByte & 0x7F), mask, content, null);
|
final Frame.Parsed frame = newFrame((byte)(firstByte & 0x7F), mask, content, null);
|
||||||
mask = nextMask;
|
mask = nextMask;
|
||||||
firstByte = (byte)((firstByte & 0x80) | OpCode.CONTINUATION);
|
firstByte = (byte)((firstByte & 0x80) | OpCode.CONTINUATION);
|
||||||
state = State.FRAGMENT;
|
state = State.FRAGMENT;
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ParsedFrame parsePayload(ByteBuffer buffer)
|
private Frame.Parsed parsePayload(ByteBuffer buffer)
|
||||||
{
|
{
|
||||||
if (payloadLength == 0)
|
if (payloadLength == 0)
|
||||||
return null;
|
return null;
|
||||||
|
@ -340,7 +338,7 @@ public class Parser
|
||||||
if (available == payloadLength)
|
if (available == payloadLength)
|
||||||
{
|
{
|
||||||
// All the available data is for this frame and completes it
|
// All the available data is for this frame and completes it
|
||||||
ParsedFrame frame = newFrame(firstByte, mask, buffer.slice(), null);
|
Frame.Parsed frame = newFrame(firstByte, mask, buffer.slice(), null);
|
||||||
buffer.position(buffer.limit());
|
buffer.position(buffer.limit());
|
||||||
state = State.START;
|
state = State.START;
|
||||||
return frame;
|
return frame;
|
||||||
|
@ -351,7 +349,7 @@ public class Parser
|
||||||
int limit = buffer.limit();
|
int limit = buffer.limit();
|
||||||
int end = buffer.position() + payloadLength;
|
int end = buffer.position() + payloadLength;
|
||||||
buffer.limit(end);
|
buffer.limit(end);
|
||||||
final ParsedFrame frame = newFrame(firstByte, mask, buffer.slice(), null);
|
final Frame.Parsed frame = newFrame(firstByte, mask, buffer.slice(), null);
|
||||||
buffer.position(end);
|
buffer.position(end);
|
||||||
buffer.limit(limit);
|
buffer.limit(limit);
|
||||||
state = State.START;
|
state = State.START;
|
||||||
|
@ -398,54 +396,4 @@ public class Parser
|
||||||
return String
|
return String
|
||||||
.format("Parser@%x[s=%s,c=%d,o=0x%x,m=%s,l=%d]", hashCode(), state, cursor, firstByte, mask == null ? "-" : StringUtil.toHexString(mask), payloadLength);
|
.format("Parser@%x[s=%s,c=%d,o=0x%x,m=%s,l=%d]", hashCode(), state, cursor, firstByte, mask == null ? "-" : StringUtil.toHexString(mask), payloadLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ParsedFrame extends Frame implements Closeable, CloseStatus.Supplier
|
|
||||||
{
|
|
||||||
final CloseStatus closeStatus;
|
|
||||||
final Runnable releaser;
|
|
||||||
|
|
||||||
public ParsedFrame(byte firstByte, byte[] mask, ByteBuffer payload, Runnable releaser)
|
|
||||||
{
|
|
||||||
super(firstByte, mask, payload);
|
|
||||||
demask();
|
|
||||||
this.releaser = releaser;
|
|
||||||
if (getOpCode() == OpCode.CLOSE)
|
|
||||||
{
|
|
||||||
if (hasPayload())
|
|
||||||
closeStatus = new CloseStatus(payload.duplicate());
|
|
||||||
else
|
|
||||||
closeStatus = CloseStatus.NO_CODE_STATUS;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
closeStatus = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close()
|
|
||||||
{
|
|
||||||
if (releaser != null)
|
|
||||||
releaser.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CloseStatus getCloseStatus()
|
|
||||||
{
|
|
||||||
return closeStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isReleaseable()
|
|
||||||
{
|
|
||||||
return releaser != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
if (closeStatus == null)
|
|
||||||
return super.toString();
|
|
||||||
return super.toString() + ":" + closeStatus;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,9 @@ import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||||
import org.eclipse.jetty.websocket.core.exception.BadPayloadException;
|
import org.eclipse.jetty.websocket.core.exception.BadPayloadException;
|
||||||
import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException;
|
import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException;
|
||||||
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
||||||
|
import org.eclipse.jetty.websocket.core.util.DemandChain;
|
||||||
|
import org.eclipse.jetty.websocket.core.util.DemandingFlusher;
|
||||||
|
import org.eclipse.jetty.websocket.core.util.TransformingFlusher;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||||
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.FrameValidation;
|
import org.eclipse.jetty.websocket.core.util.FrameValidation;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.messages;
|
package org.eclipse.jetty.websocket.core.messages;
|
||||||
|
|
||||||
import java.lang.invoke.MethodHandle;
|
import java.lang.invoke.MethodHandle;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.messages;
|
package org.eclipse.jetty.websocket.core.messages;
|
||||||
|
|
||||||
import java.lang.invoke.MethodHandle;
|
import java.lang.invoke.MethodHandle;
|
||||||
import java.lang.invoke.MethodType;
|
import java.lang.invoke.MethodType;
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.messages;
|
package org.eclipse.jetty.websocket.core.messages;
|
||||||
|
|
||||||
import java.lang.invoke.MethodHandle;
|
import java.lang.invoke.MethodHandle;
|
||||||
import java.lang.invoke.MethodType;
|
import java.lang.invoke.MethodType;
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.messages;
|
package org.eclipse.jetty.websocket.core.messages;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.lang.invoke.MethodHandle;
|
import java.lang.invoke.MethodHandle;
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.messages;
|
package org.eclipse.jetty.websocket.core.messages;
|
||||||
|
|
||||||
import java.lang.invoke.MethodHandle;
|
import java.lang.invoke.MethodHandle;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.messages;
|
package org.eclipse.jetty.websocket.core.messages;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.messages;
|
package org.eclipse.jetty.websocket.core.messages;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.messages;
|
package org.eclipse.jetty.websocket.core.messages;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.messages;
|
package org.eclipse.jetty.websocket.core.messages;
|
||||||
|
|
||||||
import org.eclipse.jetty.util.Callback;
|
import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.messages;
|
package org.eclipse.jetty.websocket.core.messages;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.messages;
|
package org.eclipse.jetty.websocket.core.messages;
|
||||||
|
|
||||||
import java.lang.invoke.MethodHandle;
|
import java.lang.invoke.MethodHandle;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.messages;
|
package org.eclipse.jetty.websocket.core.messages;
|
||||||
|
|
||||||
import java.lang.invoke.MethodHandle;
|
import java.lang.invoke.MethodHandle;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.messages;
|
package org.eclipse.jetty.websocket.core.messages;
|
||||||
|
|
||||||
import java.lang.invoke.MethodHandle;
|
import java.lang.invoke.MethodHandle;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.messages;
|
package org.eclipse.jetty.websocket.core.messages;
|
||||||
|
|
||||||
import java.lang.invoke.MethodHandle;
|
import java.lang.invoke.MethodHandle;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.messages;
|
package org.eclipse.jetty.websocket.core.messages;
|
||||||
|
|
||||||
import java.lang.invoke.MethodHandle;
|
import java.lang.invoke.MethodHandle;
|
||||||
|
|
|
@ -11,11 +11,12 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal;
|
package org.eclipse.jetty.websocket.core.util;
|
||||||
|
|
||||||
import java.util.function.LongConsumer;
|
import java.util.function.LongConsumer;
|
||||||
|
|
||||||
import org.eclipse.jetty.websocket.core.Extension;
|
import org.eclipse.jetty.websocket.core.Extension;
|
||||||
|
import org.eclipse.jetty.websocket.core.ExtensionStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is extended by an {@link Extension} so it can intercept demand calls.
|
* This is extended by an {@link Extension} so it can intercept demand calls.
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal;
|
package org.eclipse.jetty.websocket.core.util;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal;
|
package org.eclipse.jetty.websocket.core.util;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.websocket.core.Configuration;
|
import org.eclipse.jetty.websocket.core.Configuration;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
|
import org.eclipse.jetty.websocket.core.internal.FrameEntry;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ public abstract class FragmentingFlusher extends TransformingFlusher
|
||||||
this.configuration = configuration;
|
this.configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract void forwardFrame(Frame frame, Callback callback, boolean batch);
|
protected abstract void forwardFrame(Frame frame, Callback callback, boolean batch);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onFrame(Frame frame, Callback callback, boolean batch)
|
protected boolean onFrame(Frame frame, Callback callback, boolean batch)
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.util;
|
package org.eclipse.jetty.websocket.core.util;
|
||||||
|
|
||||||
import org.eclipse.jetty.websocket.core.Behavior;
|
import org.eclipse.jetty.websocket.core.Behavior;
|
||||||
import org.eclipse.jetty.websocket.core.CloseStatus;
|
import org.eclipse.jetty.websocket.core.CloseStatus;
|
||||||
|
@ -21,7 +21,6 @@ import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.exception.CloseException;
|
import org.eclipse.jetty.websocket.core.exception.CloseException;
|
||||||
import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException;
|
import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException;
|
||||||
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.Parser;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some static utility methods for validating a {@link Frame} based on the state of its {@link CoreSession}.
|
* Some static utility methods for validating a {@link Frame} based on the state of its {@link CoreSession}.
|
||||||
|
@ -61,7 +60,7 @@ public class FrameValidation
|
||||||
*/
|
*/
|
||||||
if (frame.getOpCode() == OpCode.CLOSE)
|
if (frame.getOpCode() == OpCode.CLOSE)
|
||||||
{
|
{
|
||||||
if (!(frame instanceof Parser.ParsedFrame)) // already check in parser
|
if (!(frame instanceof Frame.Parsed)) // already check in parser
|
||||||
CloseStatus.getCloseStatus(frame); // return ignored as get used to validate there is a closeStatus
|
CloseStatus.getCloseStatus(frame); // return ignored as get used to validate there is a closeStatus
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +81,7 @@ public class FrameValidation
|
||||||
*/
|
*/
|
||||||
if (frame.getOpCode() == OpCode.CLOSE)
|
if (frame.getOpCode() == OpCode.CLOSE)
|
||||||
{
|
{
|
||||||
if (!(frame instanceof Parser.ParsedFrame)) // already check in parser
|
if (!(frame instanceof Frame.Parsed)) // already check in parser
|
||||||
{
|
{
|
||||||
CloseStatus closeStatus = CloseStatus.getCloseStatus(frame);
|
CloseStatus closeStatus = CloseStatus.getCloseStatus(frame);
|
||||||
if (!CloseStatus.isTransmittableStatusCode(closeStatus.getCode()) && (closeStatus.getCode() != CloseStatus.NO_CODE))
|
if (!CloseStatus.isTransmittableStatusCode(closeStatus.getCode()) && (closeStatus.getCode() != CloseStatus.NO_CODE))
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.util;
|
package org.eclipse.jetty.websocket.core.util;
|
||||||
|
|
||||||
import java.lang.invoke.MethodHandle;
|
import java.lang.invoke.MethodHandle;
|
||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.util;
|
package org.eclipse.jetty.websocket.core.util;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.invoke.MethodType;
|
import java.lang.invoke.MethodType;
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal.util;
|
package org.eclipse.jetty.websocket.core.util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collection of utility methods for Text content
|
* Collection of utility methods for Text content
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal;
|
package org.eclipse.jetty.websocket.core.util;
|
||||||
|
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
@ -21,6 +21,7 @@ import org.eclipse.jetty.util.IteratingCallback;
|
||||||
import org.eclipse.jetty.util.StaticException;
|
import org.eclipse.jetty.util.StaticException;
|
||||||
import org.eclipse.jetty.util.thread.AutoLock;
|
import org.eclipse.jetty.util.thread.AutoLock;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
|
import org.eclipse.jetty.websocket.core.internal.FrameEntry;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.internal;
|
package org.eclipse.jetty.websocket.core.util;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
@ -19,7 +19,7 @@ import java.util.Base64;
|
||||||
|
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketConstants;
|
import org.eclipse.jetty.websocket.core.WebSocketConstants;
|
||||||
|
|
||||||
public final class WebSocketCore
|
public final class WebSocketUtils
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -33,14 +33,14 @@ import org.eclipse.jetty.util.thread.Scheduler;
|
||||||
import org.eclipse.jetty.websocket.core.Behavior;
|
import org.eclipse.jetty.websocket.core.Behavior;
|
||||||
import org.eclipse.jetty.websocket.core.Configuration;
|
import org.eclipse.jetty.websocket.core.Configuration;
|
||||||
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
||||||
|
import org.eclipse.jetty.websocket.core.ExtensionStack;
|
||||||
import org.eclipse.jetty.websocket.core.FrameHandler;
|
import org.eclipse.jetty.websocket.core.FrameHandler;
|
||||||
|
import org.eclipse.jetty.websocket.core.Negotiated;
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||||
|
import org.eclipse.jetty.websocket.core.WebSocketConnection;
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketConstants;
|
import org.eclipse.jetty.websocket.core.WebSocketConstants;
|
||||||
|
import org.eclipse.jetty.websocket.core.WebSocketCoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
|
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.ExtensionStack;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.Negotiated;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketConnection;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
|
||||||
import org.eclipse.jetty.websocket.core.server.Handshaker;
|
import org.eclipse.jetty.websocket.core.server.Handshaker;
|
||||||
import org.eclipse.jetty.websocket.core.server.WebSocketNegotiator;
|
import org.eclipse.jetty.websocket.core.server.WebSocketNegotiator;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -129,8 +129,6 @@ public abstract class AbstractHandshaker implements Handshaker
|
||||||
|
|
||||||
connectionMetaData.getConnector().getEventListeners().forEach(connection::addEventListener);
|
connectionMetaData.getConnector().getEventListeners().forEach(connection::addEventListener);
|
||||||
|
|
||||||
coreSession.setWebSocketConnection(connection);
|
|
||||||
|
|
||||||
prepareResponse(response, negotiation);
|
prepareResponse(response, negotiation);
|
||||||
if (httpConfig.getSendServerVersion())
|
if (httpConfig.getSendServerVersion())
|
||||||
response.getHeaders().put(SERVER_VERSION);
|
response.getHeaders().put(SERVER_VERSION);
|
||||||
|
@ -190,7 +188,9 @@ public abstract class AbstractHandshaker implements Handshaker
|
||||||
|
|
||||||
protected WebSocketConnection newWebSocketConnection(EndPoint endPoint, Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, WebSocketCoreSession coreSession)
|
protected WebSocketConnection newWebSocketConnection(EndPoint endPoint, Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, WebSocketCoreSession coreSession)
|
||||||
{
|
{
|
||||||
return new WebSocketConnection(endPoint, executor, scheduler, byteBufferPool, coreSession);
|
WebSocketConnection connection = new WebSocketConnection(endPoint, executor, scheduler, byteBufferPool, coreSession);
|
||||||
|
coreSession.setWebSocketConnection(connection);
|
||||||
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void prepareResponse(Response response, WebSocketNegotiation negotiation);
|
protected abstract void prepareResponse(Response response, WebSocketNegotiation negotiation);
|
||||||
|
|
|
@ -28,9 +28,9 @@ import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.Response;
|
import org.eclipse.jetty.server.Response;
|
||||||
import org.eclipse.jetty.util.Callback;
|
import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketConnection;
|
import org.eclipse.jetty.websocket.core.WebSocketConnection;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCore;
|
import org.eclipse.jetty.websocket.core.WebSocketCoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
import org.eclipse.jetty.websocket.core.util.WebSocketUtils;
|
||||||
|
|
||||||
public final class RFC6455Handshaker extends AbstractHandshaker
|
public final class RFC6455Handshaker extends AbstractHandshaker
|
||||||
{
|
{
|
||||||
|
@ -80,7 +80,9 @@ public final class RFC6455Handshaker extends AbstractHandshaker
|
||||||
ConnectionMetaData connectionMetaData = baseRequest.getConnectionMetaData();
|
ConnectionMetaData connectionMetaData = baseRequest.getConnectionMetaData();
|
||||||
Connector connector = connectionMetaData.getConnector();
|
Connector connector = connectionMetaData.getConnector();
|
||||||
ByteBufferPool byteBufferPool = connector.getByteBufferPool();
|
ByteBufferPool byteBufferPool = connector.getByteBufferPool();
|
||||||
return newWebSocketConnection(connectionMetaData.getConnection().getEndPoint(), connector.getExecutor(), connector.getScheduler(), byteBufferPool, coreSession);
|
WebSocketConnection connection = newWebSocketConnection(connectionMetaData.getConnection().getEndPoint(), connector.getExecutor(), connector.getScheduler(), byteBufferPool, coreSession);
|
||||||
|
coreSession.setWebSocketConnection(connection);
|
||||||
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -90,6 +92,6 @@ public final class RFC6455Handshaker extends AbstractHandshaker
|
||||||
HttpFields.Mutable responseFields = response.getHeaders();
|
HttpFields.Mutable responseFields = response.getHeaders();
|
||||||
responseFields.put(UPGRADE_WEBSOCKET);
|
responseFields.put(UPGRADE_WEBSOCKET);
|
||||||
responseFields.put(CONNECTION_UPGRADE);
|
responseFields.put(CONNECTION_UPGRADE);
|
||||||
responseFields.put(HttpHeader.SEC_WEBSOCKET_ACCEPT, WebSocketCore.hashKey(((RFC6455Negotiation)negotiation).getKey()));
|
responseFields.put(HttpHeader.SEC_WEBSOCKET_ACCEPT, WebSocketUtils.hashKey(((RFC6455Negotiation)negotiation).getKey()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@ import org.eclipse.jetty.server.Response;
|
||||||
import org.eclipse.jetty.server.TunnelSupport;
|
import org.eclipse.jetty.server.TunnelSupport;
|
||||||
import org.eclipse.jetty.util.Callback;
|
import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketConnection;
|
import org.eclipse.jetty.websocket.core.WebSocketConnection;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
import org.eclipse.jetty.websocket.core.WebSocketCoreSession;
|
||||||
|
|
||||||
public class RFC8441Handshaker extends AbstractHandshaker
|
public class RFC8441Handshaker extends AbstractHandshaker
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,8 +16,8 @@ package org.eclipse.jetty.websocket.core;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.eclipse.jetty.util.TypeUtil;
|
import org.eclipse.jetty.util.StringUtil;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCore;
|
import org.eclipse.jetty.websocket.core.util.WebSocketUtils;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
|
@ -29,7 +29,7 @@ public class AcceptHashTest
|
||||||
{
|
{
|
||||||
private static String hexAsKey(String hex)
|
private static String hexAsKey(String hex)
|
||||||
{
|
{
|
||||||
byte[] key = TypeUtil.fromHexString(hex);
|
byte[] key = StringUtil.fromHexString(hex);
|
||||||
assertThat("Key size of hex:[" + hex + "]", key.length, is(16));
|
assertThat("Key size of hex:[" + hex + "]", key.length, is(16));
|
||||||
return Base64.getEncoder().encodeToString(key);
|
return Base64.getEncoder().encodeToString(key);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public class AcceptHashTest
|
||||||
@MethodSource("data")
|
@MethodSource("data")
|
||||||
public void testHashKey(String clientKey, String expectedHash)
|
public void testHashKey(String clientKey, String expectedHash)
|
||||||
{
|
{
|
||||||
String serverAccept = WebSocketCore.hashKey(clientKey);
|
String serverAccept = WebSocketUtils.hashKey(clientKey);
|
||||||
assertThat("Hashed Key", serverAccept, is(expectedHash));
|
assertThat("Hashed Key", serverAccept, is(expectedHash));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
package org.eclipse.jetty.websocket.core;
|
package org.eclipse.jetty.websocket.core;
|
||||||
|
|
||||||
import org.eclipse.jetty.util.Callback;
|
import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
|
||||||
|
|
||||||
public class DemandingIncomingFramesCapture extends IncomingFramesCapture
|
public class DemandingIncomingFramesCapture extends IncomingFramesCapture
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,11 +19,8 @@ import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.eclipse.jetty.util.BufferUtil;
|
import org.eclipse.jetty.util.BufferUtil;
|
||||||
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.ExtensionStack;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.Generator;
|
import org.eclipse.jetty.websocket.core.internal.Generator;
|
||||||
import org.eclipse.jetty.websocket.core.internal.Negotiated;
|
import org.eclipse.jetty.websocket.core.util.FrameValidation;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.FrameValidation;
|
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
|
|
|
@ -25,11 +25,8 @@ import org.eclipse.jetty.util.BufferUtil;
|
||||||
import org.eclipse.jetty.util.StringUtil;
|
import org.eclipse.jetty.util.StringUtil;
|
||||||
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
||||||
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
|
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.ExtensionStack;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.Generator;
|
import org.eclipse.jetty.websocket.core.internal.Generator;
|
||||||
import org.eclipse.jetty.websocket.core.internal.Negotiated;
|
import org.eclipse.jetty.websocket.core.util.FrameValidation;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.FrameValidation;
|
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
|
@ -20,7 +20,7 @@ import java.util.Locale;
|
||||||
|
|
||||||
import org.eclipse.jetty.util.BufferUtil;
|
import org.eclipse.jetty.util.BufferUtil;
|
||||||
import org.eclipse.jetty.util.Callback;
|
import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.util.TypeUtil;
|
import org.eclipse.jetty.util.StringUtil;
|
||||||
import org.eclipse.jetty.websocket.core.internal.Generator;
|
import org.eclipse.jetty.websocket.core.internal.Generator;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
@ -45,7 +45,7 @@ public class OutgoingNetworkBytesCapture implements OutgoingFrames
|
||||||
{
|
{
|
||||||
assertThat("Capture index does not exist", idx, lessThan(captured.size()));
|
assertThat("Capture index does not exist", idx, lessThan(captured.size()));
|
||||||
ByteBuffer buf = captured.get(idx);
|
ByteBuffer buf = captured.get(idx);
|
||||||
String actualHex = TypeUtil.toHexString(BufferUtil.toArray(buf)).toUpperCase(Locale.ENGLISH);
|
String actualHex = StringUtil.toHexString(BufferUtil.toArray(buf)).toUpperCase(Locale.ENGLISH);
|
||||||
assertThat("captured[" + idx + "]", actualHex, is(expectedHex.toUpperCase(Locale.ENGLISH)));
|
assertThat("captured[" + idx + "]", actualHex, is(expectedHex.toUpperCase(Locale.ENGLISH)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,8 @@ import java.util.LinkedList;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
import java.util.concurrent.LinkedBlockingDeque;
|
import java.util.concurrent.LinkedBlockingDeque;
|
||||||
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.ExtensionStack;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.Negotiated;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.Parser;
|
import org.eclipse.jetty.websocket.core.internal.Parser;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
import org.eclipse.jetty.websocket.core.util.FrameValidation;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.FrameValidation;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
|
|
@ -23,11 +23,9 @@ import java.util.concurrent.TimeUnit;
|
||||||
import org.eclipse.jetty.toolchain.test.Hex;
|
import org.eclipse.jetty.toolchain.test.Hex;
|
||||||
import org.eclipse.jetty.util.BufferUtil;
|
import org.eclipse.jetty.util.BufferUtil;
|
||||||
import org.eclipse.jetty.util.StringUtil;
|
import org.eclipse.jetty.util.StringUtil;
|
||||||
import org.eclipse.jetty.util.TypeUtil;
|
|
||||||
import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException;
|
import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException;
|
||||||
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.Generator;
|
import org.eclipse.jetty.websocket.core.internal.Generator;
|
||||||
import org.eclipse.jetty.websocket.core.internal.Parser;
|
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -1497,7 +1495,7 @@ public class ParserTest
|
||||||
@Test
|
@Test
|
||||||
public void testParseAutobahn793() throws Exception
|
public void testParseAutobahn793() throws Exception
|
||||||
{
|
{
|
||||||
ByteBuffer buf = BufferUtil.toBuffer(TypeUtil.fromHexString("8882c2887e61c164"));
|
ByteBuffer buf = BufferUtil.toBuffer(StringUtil.fromHexString("8882c2887e61c164"));
|
||||||
Exception e = assertThrows(ProtocolException.class, () -> parse(Behavior.SERVER, MAX_ALLOWED_FRAME_SIZE, buf, true));
|
Exception e = assertThrows(ProtocolException.class, () -> parse(Behavior.SERVER, MAX_ALLOWED_FRAME_SIZE, buf, true));
|
||||||
assertThat(e.getMessage(), Matchers.containsString("Invalid CLOSE Code: "));
|
assertThat(e.getMessage(), Matchers.containsString("Invalid CLOSE Code: "));
|
||||||
}
|
}
|
||||||
|
@ -1505,7 +1503,7 @@ public class ParserTest
|
||||||
@Test
|
@Test
|
||||||
public void testParseAutobahn796() throws Exception
|
public void testParseAutobahn796() throws Exception
|
||||||
{
|
{
|
||||||
ByteBuffer buf = BufferUtil.toBuffer(TypeUtil.fromHexString("88824c49cb474fbf"));
|
ByteBuffer buf = BufferUtil.toBuffer(StringUtil.fromHexString("88824c49cb474fbf"));
|
||||||
ParserCapture capture = parse(Behavior.SERVER, MAX_ALLOWED_FRAME_SIZE, buf, true);
|
ParserCapture capture = parse(Behavior.SERVER, MAX_ALLOWED_FRAME_SIZE, buf, true);
|
||||||
|
|
||||||
capture.assertHasFrame(OpCode.CLOSE, 1);
|
capture.assertHasFrame(OpCode.CLOSE, 1);
|
||||||
|
@ -1523,7 +1521,7 @@ public class ParserTest
|
||||||
ParserCapture capture = parse(Behavior.CLIENT, MAX_ALLOWED_FRAME_SIZE, buffer, false);
|
ParserCapture capture = parse(Behavior.CLIENT, MAX_ALLOWED_FRAME_SIZE, buffer, false);
|
||||||
|
|
||||||
capture.assertHasFrame(OpCode.TEXT, 1);
|
capture.assertHasFrame(OpCode.TEXT, 1);
|
||||||
Parser.ParsedFrame text = (Parser.ParsedFrame)capture.framesQueue.take();
|
Frame.Parsed text = (Frame.Parsed)capture.framesQueue.take();
|
||||||
assertEquals("Hello World", text.getPayloadAsUTF8());
|
assertEquals("Hello World", text.getPayloadAsUTF8());
|
||||||
assertTrue(text.getPayload().isDirect());
|
assertTrue(text.getPayload().isDirect());
|
||||||
assertFalse(text.isReleaseable());
|
assertFalse(text.isReleaseable());
|
||||||
|
@ -1538,7 +1536,7 @@ public class ParserTest
|
||||||
ParserCapture capture = parse(Behavior.CLIENT, MAX_ALLOWED_FRAME_SIZE, buffer, false);
|
ParserCapture capture = parse(Behavior.CLIENT, MAX_ALLOWED_FRAME_SIZE, buffer, false);
|
||||||
|
|
||||||
capture.assertHasFrame(OpCode.TEXT, 1);
|
capture.assertHasFrame(OpCode.TEXT, 1);
|
||||||
Parser.ParsedFrame text = (Parser.ParsedFrame)capture.framesQueue.take();
|
Frame.Parsed text = (Frame.Parsed)capture.framesQueue.take();
|
||||||
assertEquals("Hello World", text.getPayloadAsUTF8());
|
assertEquals("Hello World", text.getPayloadAsUTF8());
|
||||||
assertThat(text.getPayload().array(), sameInstance(buffer.array()));
|
assertThat(text.getPayload().array(), sameInstance(buffer.array()));
|
||||||
assertFalse(text.isReleaseable());
|
assertFalse(text.isReleaseable());
|
||||||
|
@ -1559,7 +1557,7 @@ public class ParserTest
|
||||||
capture.parse(buffer);
|
capture.parse(buffer);
|
||||||
assertEquals(1, capture.framesQueue.size());
|
assertEquals(1, capture.framesQueue.size());
|
||||||
assertEquals(0, buffer.remaining());
|
assertEquals(0, buffer.remaining());
|
||||||
Parser.ParsedFrame text = (Parser.ParsedFrame)capture.framesQueue.take();
|
Frame.Parsed text = (Frame.Parsed)capture.framesQueue.take();
|
||||||
assertFalse(text.isFin());
|
assertFalse(text.isFin());
|
||||||
assertEquals("Hello", text.getPayloadAsUTF8());
|
assertEquals("Hello", text.getPayloadAsUTF8());
|
||||||
assertThat(text.getPayload().array(), sameInstance(buffer.array()));
|
assertThat(text.getPayload().array(), sameInstance(buffer.array()));
|
||||||
|
@ -1570,7 +1568,7 @@ public class ParserTest
|
||||||
capture.parse(buffer);
|
capture.parse(buffer);
|
||||||
assertEquals(1, capture.framesQueue.size());
|
assertEquals(1, capture.framesQueue.size());
|
||||||
assertEquals(0, buffer.remaining());
|
assertEquals(0, buffer.remaining());
|
||||||
text = (Parser.ParsedFrame)capture.framesQueue.take();
|
text = (Frame.Parsed)capture.framesQueue.take();
|
||||||
assertFalse(text.isFin());
|
assertFalse(text.isFin());
|
||||||
assertEquals(" ", text.getPayloadAsUTF8());
|
assertEquals(" ", text.getPayloadAsUTF8());
|
||||||
assertThat(text.getPayload().array(), sameInstance(buffer.array()));
|
assertThat(text.getPayload().array(), sameInstance(buffer.array()));
|
||||||
|
@ -1582,7 +1580,7 @@ public class ParserTest
|
||||||
assertEquals(1, capture.framesQueue.size());
|
assertEquals(1, capture.framesQueue.size());
|
||||||
assertEquals(0, buffer.remaining());
|
assertEquals(0, buffer.remaining());
|
||||||
capture.assertHasFrame(OpCode.CONTINUATION, 1);
|
capture.assertHasFrame(OpCode.CONTINUATION, 1);
|
||||||
text = (Parser.ParsedFrame)capture.framesQueue.take();
|
text = (Frame.Parsed)capture.framesQueue.take();
|
||||||
assertTrue(text.isFin());
|
assertTrue(text.isFin());
|
||||||
assertEquals("World", text.getPayloadAsUTF8());
|
assertEquals("World", text.getPayloadAsUTF8());
|
||||||
assertThat(text.getPayload().array(), sameInstance(buffer.array()));
|
assertThat(text.getPayload().array(), sameInstance(buffer.array()));
|
||||||
|
@ -1618,7 +1616,7 @@ public class ParserTest
|
||||||
assertEquals(0, buffer.remaining());
|
assertEquals(0, buffer.remaining());
|
||||||
|
|
||||||
capture.assertHasFrame(OpCode.TEXT, 1);
|
capture.assertHasFrame(OpCode.TEXT, 1);
|
||||||
Parser.ParsedFrame text = (Parser.ParsedFrame)capture.framesQueue.take();
|
Frame.Parsed text = (Frame.Parsed)capture.framesQueue.take();
|
||||||
assertEquals("Hello World", text.getPayloadAsUTF8());
|
assertEquals("Hello World", text.getPayloadAsUTF8());
|
||||||
assertThat(text.getPayload().array(), not(sameInstance(buffer.array())));
|
assertThat(text.getPayload().array(), not(sameInstance(buffer.array())));
|
||||||
assertTrue(text.isReleaseable());
|
assertTrue(text.isReleaseable());
|
||||||
|
@ -1652,7 +1650,7 @@ public class ParserTest
|
||||||
assertEquals(0, buffer.remaining());
|
assertEquals(0, buffer.remaining());
|
||||||
|
|
||||||
capture.assertHasFrame(OpCode.PING, 1);
|
capture.assertHasFrame(OpCode.PING, 1);
|
||||||
Parser.ParsedFrame text = (Parser.ParsedFrame)capture.framesQueue.take();
|
Frame.Parsed text = (Frame.Parsed)capture.framesQueue.take();
|
||||||
assertEquals("Hello World", text.getPayloadAsUTF8());
|
assertEquals("Hello World", text.getPayloadAsUTF8());
|
||||||
assertThat(text.getPayload().array(), not(sameInstance(buffer.array())));
|
assertThat(text.getPayload().array(), not(sameInstance(buffer.array())));
|
||||||
assertTrue(text.isReleaseable());
|
assertTrue(text.isReleaseable());
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.util.StringUtil;
|
import org.eclipse.jetty.util.StringUtil;
|
||||||
import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient;
|
import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient;
|
||||||
import org.eclipse.jetty.websocket.core.internal.Generator;
|
import org.eclipse.jetty.websocket.core.internal.Generator;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCore;
|
import org.eclipse.jetty.websocket.core.util.WebSocketUtils;
|
||||||
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;
|
||||||
|
@ -313,7 +313,7 @@ public class UpgradeWithLeftOverHttpBytesTest extends WebSocketTester
|
||||||
assertTrue(matcher.matches());
|
assertTrue(matcher.matches());
|
||||||
String key = matcher.group(1);
|
String key = matcher.group(1);
|
||||||
assertFalse(StringUtil.isEmpty(key));
|
assertFalse(StringUtil.isEmpty(key));
|
||||||
return WebSocketCore.hashKey(key);
|
return WebSocketUtils.hashKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getRequestHeaders(InputStream is)
|
static String getRequestHeaders(InputStream is)
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.eclipse.jetty.logging.StacklessLogging;
|
||||||
import org.eclipse.jetty.util.BlockingArrayQueue;
|
import org.eclipse.jetty.util.BlockingArrayQueue;
|
||||||
import org.eclipse.jetty.util.BufferUtil;
|
import org.eclipse.jetty.util.BufferUtil;
|
||||||
import org.eclipse.jetty.util.Callback;
|
import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.ValueSource;
|
import org.junit.jupiter.params.provider.ValueSource;
|
||||||
|
|
|
@ -17,7 +17,7 @@ import java.nio.ByteBuffer;
|
||||||
|
|
||||||
import org.eclipse.jetty.toolchain.test.Hex;
|
import org.eclipse.jetty.toolchain.test.Hex;
|
||||||
import org.eclipse.jetty.util.BufferUtil;
|
import org.eclipse.jetty.util.BufferUtil;
|
||||||
import org.eclipse.jetty.util.TypeUtil;
|
import org.eclipse.jetty.util.StringUtil;
|
||||||
import org.eclipse.jetty.websocket.core.internal.Generator;
|
import org.eclipse.jetty.websocket.core.internal.Generator;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -117,8 +117,8 @@ public class WebSocketFrameTest
|
||||||
for (int i = 0; i <= 8; i++)
|
for (int i = 0; i <= 8; i++)
|
||||||
{
|
{
|
||||||
Frame frame = new Frame(OpCode.BINARY);
|
Frame frame = new Frame(OpCode.BINARY);
|
||||||
frame.setPayload(TypeUtil.fromHexString("0000FFFF000FFFF0".substring(0, i * 2)));
|
frame.setPayload(StringUtil.fromHexString("0000FFFF000FFFF0".substring(0, i * 2)));
|
||||||
frame.setMask(TypeUtil.fromHexString("FF00FF00"));
|
frame.setMask(StringUtil.fromHexString("FF00FF00"));
|
||||||
frame.demask();
|
frame.demask();
|
||||||
assertEquals("Ff0000FfFf0f00F0".substring(0, i * 2), BufferUtil.toHexString(frame.getPayload()), "len=" + i);
|
assertEquals("Ff0000FfFf0f00F0".substring(0, i * 2), BufferUtil.toHexString(frame.getPayload()), "len=" + i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ import org.eclipse.jetty.websocket.core.client.CoreClientUpgradeRequest;
|
||||||
import org.eclipse.jetty.websocket.core.client.UpgradeListener;
|
import org.eclipse.jetty.websocket.core.client.UpgradeListener;
|
||||||
import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient;
|
import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient;
|
||||||
import org.eclipse.jetty.websocket.core.exception.UpgradeException;
|
import org.eclipse.jetty.websocket.core.exception.UpgradeException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
|
||||||
import org.eclipse.jetty.websocket.core.server.ServerUpgradeRequest;
|
import org.eclipse.jetty.websocket.core.server.ServerUpgradeRequest;
|
||||||
import org.eclipse.jetty.websocket.core.server.ServerUpgradeResponse;
|
import org.eclipse.jetty.websocket.core.server.ServerUpgradeResponse;
|
||||||
import org.eclipse.jetty.websocket.core.server.WebSocketNegotiator;
|
import org.eclipse.jetty.websocket.core.server.WebSocketNegotiator;
|
||||||
|
|
|
@ -20,8 +20,6 @@ import java.util.function.BiFunction;
|
||||||
|
|
||||||
import org.eclipse.jetty.logging.StacklessLogging;
|
import org.eclipse.jetty.logging.StacklessLogging;
|
||||||
import org.eclipse.jetty.util.Callback;
|
import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.websocket.core.internal.Parser;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -74,7 +72,7 @@ public class WebSocketOpenTest extends WebSocketTester
|
||||||
s.demand(1);
|
s.demand(1);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
Parser.ParsedFrame frame = receiveFrame(client.getInputStream());
|
Frame.Parsed frame = receiveFrame(client.getInputStream());
|
||||||
assertThat(frame.getPayloadAsUTF8(), is("Hello"));
|
assertThat(frame.getPayloadAsUTF8(), is("Hello"));
|
||||||
|
|
||||||
client.getOutputStream().write(RawFrameBuilder.buildClose(new CloseStatus(CloseStatus.NORMAL), true));
|
client.getOutputStream().write(RawFrameBuilder.buildClose(new CloseStatus(CloseStatus.NORMAL), true));
|
||||||
|
@ -104,7 +102,7 @@ public class WebSocketOpenTest extends WebSocketTester
|
||||||
assertTrue(serverHandler.closeLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(serverHandler.closeLatch.await(5, TimeUnit.SECONDS));
|
||||||
assertThat(serverHandler.closeStatus.getCode(), is(CloseStatus.SERVER_ERROR));
|
assertThat(serverHandler.closeStatus.getCode(), is(CloseStatus.SERVER_ERROR));
|
||||||
|
|
||||||
Parser.ParsedFrame frame = receiveFrame(client.getInputStream());
|
Frame.Parsed frame = receiveFrame(client.getInputStream());
|
||||||
assertThat(frame.getOpCode(), is(OpCode.CLOSE));
|
assertThat(frame.getOpCode(), is(OpCode.CLOSE));
|
||||||
assertThat(new CloseStatus(frame).getCode(), is(CloseStatus.SERVER_ERROR));
|
assertThat(new CloseStatus(frame).getCode(), is(CloseStatus.SERVER_ERROR));
|
||||||
}
|
}
|
||||||
|
@ -120,7 +118,7 @@ public class WebSocketOpenTest extends WebSocketTester
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
Parser.ParsedFrame frame = receiveFrame(client.getInputStream());
|
Frame.Parsed frame = receiveFrame(client.getInputStream());
|
||||||
assertThat(frame.getOpCode(), is(OpCode.CLOSE));
|
assertThat(frame.getOpCode(), is(OpCode.CLOSE));
|
||||||
assertThat(new CloseStatus(frame).getCode(), is(CloseStatus.SHUTDOWN));
|
assertThat(new CloseStatus(frame).getCode(), is(CloseStatus.SHUTDOWN));
|
||||||
|
|
||||||
|
@ -155,7 +153,7 @@ public class WebSocketOpenTest extends WebSocketTester
|
||||||
|
|
||||||
// Can send while onOpen is active
|
// Can send while onOpen is active
|
||||||
coreSession.sendFrame(new Frame(OpCode.TEXT, "Hello"), NOOP, false);
|
coreSession.sendFrame(new Frame(OpCode.TEXT, "Hello"), NOOP, false);
|
||||||
Parser.ParsedFrame frame = receiveFrame(client.getInputStream());
|
Frame.Parsed frame = receiveFrame(client.getInputStream());
|
||||||
assertThat(frame.getPayloadAsUTF8(), is("Hello"));
|
assertThat(frame.getPayloadAsUTF8(), is("Hello"));
|
||||||
|
|
||||||
// Succeeded moves to OPEN state.
|
// Succeeded moves to OPEN state.
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class WebSocketTester
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Parser.ParsedFrame receiveFrame(InputStream in) throws IOException
|
protected Frame.Parsed receiveFrame(InputStream in) throws IOException
|
||||||
{
|
{
|
||||||
if (buffer == null)
|
if (buffer == null)
|
||||||
buffer = bufferPool.acquire(4096, false);
|
buffer = bufferPool.acquire(4096, false);
|
||||||
|
@ -162,7 +162,7 @@ public class WebSocketTester
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
ByteBuffer byteBuffer = buffer.getByteBuffer();
|
ByteBuffer byteBuffer = buffer.getByteBuffer();
|
||||||
Parser.ParsedFrame frame = parser.parse(byteBuffer);
|
Frame.Parsed frame = parser.parse(byteBuffer);
|
||||||
if (!byteBuffer.hasRemaining())
|
if (!byteBuffer.hasRemaining())
|
||||||
BufferUtil.clear(byteBuffer);
|
BufferUtil.clear(byteBuffer);
|
||||||
if (frame != null)
|
if (frame != null)
|
||||||
|
|
|
@ -23,8 +23,8 @@ import org.eclipse.jetty.websocket.core.CoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.TestFrameHandler;
|
import org.eclipse.jetty.websocket.core.TestFrameHandler;
|
||||||
|
import org.eclipse.jetty.websocket.core.WebSocketCoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketServer;
|
import org.eclipse.jetty.websocket.core.WebSocketServer;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
|
@ -19,12 +19,12 @@ import java.util.List;
|
||||||
import org.eclipse.jetty.websocket.core.Behavior;
|
import org.eclipse.jetty.websocket.core.Behavior;
|
||||||
import org.eclipse.jetty.websocket.core.Extension;
|
import org.eclipse.jetty.websocket.core.Extension;
|
||||||
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
||||||
|
import org.eclipse.jetty.websocket.core.ExtensionStack;
|
||||||
import org.eclipse.jetty.websocket.core.IncomingFrames;
|
import org.eclipse.jetty.websocket.core.IncomingFrames;
|
||||||
import org.eclipse.jetty.websocket.core.IncomingFramesCapture;
|
import org.eclipse.jetty.websocket.core.IncomingFramesCapture;
|
||||||
import org.eclipse.jetty.websocket.core.OutgoingFrames;
|
import org.eclipse.jetty.websocket.core.OutgoingFrames;
|
||||||
import org.eclipse.jetty.websocket.core.OutgoingFramesCapture;
|
import org.eclipse.jetty.websocket.core.OutgoingFramesCapture;
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||||
import org.eclipse.jetty.websocket.core.internal.ExtensionStack;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.IdentityExtension;
|
import org.eclipse.jetty.websocket.core.internal.IdentityExtension;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
|
@ -22,19 +22,19 @@ import org.eclipse.jetty.io.ArrayByteBufferPool;
|
||||||
import org.eclipse.jetty.toolchain.test.ByteBufferAssert;
|
import org.eclipse.jetty.toolchain.test.ByteBufferAssert;
|
||||||
import org.eclipse.jetty.util.BufferUtil;
|
import org.eclipse.jetty.util.BufferUtil;
|
||||||
import org.eclipse.jetty.util.FutureCallback;
|
import org.eclipse.jetty.util.FutureCallback;
|
||||||
import org.eclipse.jetty.util.TypeUtil;
|
import org.eclipse.jetty.util.StringUtil;
|
||||||
import org.eclipse.jetty.websocket.core.Behavior;
|
import org.eclipse.jetty.websocket.core.Behavior;
|
||||||
import org.eclipse.jetty.websocket.core.Extension;
|
import org.eclipse.jetty.websocket.core.Extension;
|
||||||
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
||||||
|
import org.eclipse.jetty.websocket.core.ExtensionStack;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.IncomingFramesCapture;
|
import org.eclipse.jetty.websocket.core.IncomingFramesCapture;
|
||||||
|
import org.eclipse.jetty.websocket.core.Negotiated;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.TestMessageHandler;
|
import org.eclipse.jetty.websocket.core.TestMessageHandler;
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||||
import org.eclipse.jetty.websocket.core.internal.ExtensionStack;
|
import org.eclipse.jetty.websocket.core.WebSocketCoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.internal.Negotiated;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.Parser;
|
import org.eclipse.jetty.websocket.core.internal.Parser;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public class ExtensionTool
|
||||||
for (int i = 0; i < parts; i++)
|
for (int i = 0; i < parts; i++)
|
||||||
{
|
{
|
||||||
String hex = rawhex[i].replaceAll("\\s*(0x)?", "");
|
String hex = rawhex[i].replaceAll("\\s*(0x)?", "");
|
||||||
net = TypeUtil.fromHexString(hex);
|
net = StringUtil.fromHexString(hex);
|
||||||
|
|
||||||
ByteBuffer buffer = ByteBuffer.wrap(net);
|
ByteBuffer buffer = ByteBuffer.wrap(net);
|
||||||
while (BufferUtil.hasContent(buffer))
|
while (BufferUtil.hasContent(buffer))
|
||||||
|
|
|
@ -29,15 +29,15 @@ import org.eclipse.jetty.websocket.core.Behavior;
|
||||||
import org.eclipse.jetty.websocket.core.Configuration;
|
import org.eclipse.jetty.websocket.core.Configuration;
|
||||||
import org.eclipse.jetty.websocket.core.DemandingIncomingFramesCapture;
|
import org.eclipse.jetty.websocket.core.DemandingIncomingFramesCapture;
|
||||||
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
||||||
|
import org.eclipse.jetty.websocket.core.ExtensionStack;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.IncomingFramesCapture;
|
import org.eclipse.jetty.websocket.core.IncomingFramesCapture;
|
||||||
|
import org.eclipse.jetty.websocket.core.Negotiated;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.OutgoingFramesCapture;
|
import org.eclipse.jetty.websocket.core.OutgoingFramesCapture;
|
||||||
import org.eclipse.jetty.websocket.core.TestMessageHandler;
|
import org.eclipse.jetty.websocket.core.TestMessageHandler;
|
||||||
import org.eclipse.jetty.websocket.core.internal.ExtensionStack;
|
import org.eclipse.jetty.websocket.core.WebSocketCoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.internal.FragmentExtension;
|
import org.eclipse.jetty.websocket.core.internal.FragmentExtension;
|
||||||
import org.eclipse.jetty.websocket.core.internal.Negotiated;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
|
|
@ -24,21 +24,21 @@ import java.util.concurrent.TimeUnit;
|
||||||
import org.eclipse.jetty.toolchain.test.ByteBufferAssert;
|
import org.eclipse.jetty.toolchain.test.ByteBufferAssert;
|
||||||
import org.eclipse.jetty.util.BufferUtil;
|
import org.eclipse.jetty.util.BufferUtil;
|
||||||
import org.eclipse.jetty.util.Callback;
|
import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.util.TypeUtil;
|
import org.eclipse.jetty.util.StringUtil;
|
||||||
import org.eclipse.jetty.websocket.core.Behavior;
|
import org.eclipse.jetty.websocket.core.Behavior;
|
||||||
import org.eclipse.jetty.websocket.core.Configuration.ConfigurationCustomizer;
|
import org.eclipse.jetty.websocket.core.Configuration.ConfigurationCustomizer;
|
||||||
import org.eclipse.jetty.websocket.core.DemandingIncomingFramesCapture;
|
import org.eclipse.jetty.websocket.core.DemandingIncomingFramesCapture;
|
||||||
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
||||||
|
import org.eclipse.jetty.websocket.core.ExtensionStack;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.IncomingFramesCapture;
|
import org.eclipse.jetty.websocket.core.IncomingFramesCapture;
|
||||||
|
import org.eclipse.jetty.websocket.core.Negotiated;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.OutgoingFramesCapture;
|
import org.eclipse.jetty.websocket.core.OutgoingFramesCapture;
|
||||||
import org.eclipse.jetty.websocket.core.TestMessageHandler;
|
import org.eclipse.jetty.websocket.core.TestMessageHandler;
|
||||||
|
import org.eclipse.jetty.websocket.core.WebSocketCoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.ExtensionStack;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.Negotiated;
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.PerMessageDeflateExtension;
|
import org.eclipse.jetty.websocket.core.internal.PerMessageDeflateExtension;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
@ -60,7 +60,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
|
||||||
|
|
||||||
private void assertEndsWithTail(String hexStr, boolean expectedResult)
|
private void assertEndsWithTail(String hexStr, boolean expectedResult)
|
||||||
{
|
{
|
||||||
ByteBuffer buf = ByteBuffer.wrap(TypeUtil.fromHexString(hexStr));
|
ByteBuffer buf = ByteBuffer.wrap(StringUtil.fromHexString(hexStr));
|
||||||
assertThat("endsWithTail([" + hexStr + "])", PerMessageDeflateExtension.endsWithTail(buf), is(expectedResult));
|
assertThat("endsWithTail([" + hexStr + "])", PerMessageDeflateExtension.endsWithTail(buf), is(expectedResult));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ public class FrameFlusherTest
|
||||||
{
|
{
|
||||||
for (ByteBuffer buffer : buffers)
|
for (ByteBuffer buffer : buffers)
|
||||||
{
|
{
|
||||||
Parser.ParsedFrame frame = parser.parse(buffer);
|
Frame.Parsed frame = parser.parse(buffer);
|
||||||
if (frame != null)
|
if (frame != null)
|
||||||
{
|
{
|
||||||
incomingFrames.offer(frame);
|
incomingFrames.offer(frame);
|
||||||
|
|
|
@ -39,9 +39,9 @@ import org.eclipse.jetty.websocket.core.FrameHandler;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.TestAsyncFrameHandler;
|
import org.eclipse.jetty.websocket.core.TestAsyncFrameHandler;
|
||||||
import org.eclipse.jetty.websocket.core.TestWebSocketNegotiator;
|
import org.eclipse.jetty.websocket.core.TestWebSocketNegotiator;
|
||||||
|
import org.eclipse.jetty.websocket.core.WebSocketCoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.client.CoreClientUpgradeRequest;
|
import org.eclipse.jetty.websocket.core.client.CoreClientUpgradeRequest;
|
||||||
import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient;
|
import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient;
|
||||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
|
||||||
import org.eclipse.jetty.websocket.core.server.ServerUpgradeRequest;
|
import org.eclipse.jetty.websocket.core.server.ServerUpgradeRequest;
|
||||||
import org.eclipse.jetty.websocket.core.server.ServerUpgradeResponse;
|
import org.eclipse.jetty.websocket.core.server.ServerUpgradeResponse;
|
||||||
import org.eclipse.jetty.websocket.core.server.WebSocketNegotiator;
|
import org.eclipse.jetty.websocket.core.server.WebSocketNegotiator;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.eclipse.jetty.util.IO;
|
||||||
import org.eclipse.jetty.util.StringUtil;
|
import org.eclipse.jetty.util.StringUtil;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.MessageReader;
|
import org.eclipse.jetty.websocket.core.messages.MessageReader;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.eclipse.jetty.util.Utf8StringBuilder;
|
||||||
import org.eclipse.jetty.websocket.core.CoreSession;
|
import org.eclipse.jetty.websocket.core.CoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.MessageWriter;
|
import org.eclipse.jetty.websocket.core.messages.MessageWriter;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.eclipse.jetty.util.Utf8Appendable;
|
||||||
import org.eclipse.jetty.websocket.core.CoreSession;
|
import org.eclipse.jetty.websocket.core.CoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.PartialStringMessageSink;
|
import org.eclipse.jetty.websocket.core.messages.PartialStringMessageSink;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.eclipse.jetty.websocket.core.CoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException;
|
import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.StringMessageSink;
|
import org.eclipse.jetty.websocket.core.messages.StringMessageSink;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
|
|
@ -43,8 +43,8 @@ import jakarta.websocket.server.ServerEndpointConfig;
|
||||||
import org.eclipse.jetty.ee10.cdi.CdiDecoratingListener;
|
import org.eclipse.jetty.ee10.cdi.CdiDecoratingListener;
|
||||||
import org.eclipse.jetty.ee10.cdi.CdiServletContainerInitializer;
|
import org.eclipse.jetty.ee10.cdi.CdiServletContainerInitializer;
|
||||||
import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
|
import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
|
||||||
|
import org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainer;
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainerProvider;
|
import org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainerProvider;
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.client.internal.JakartaWebSocketClientContainer;
|
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer;
|
import org.eclipse.jetty.ee10.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer;
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer.Configurator;
|
import org.eclipse.jetty.ee10.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer.Configurator;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
|
|
|
@ -13,20 +13,17 @@
|
||||||
|
|
||||||
module org.eclipse.jetty.ee10.websocket.jakarta.client
|
module org.eclipse.jetty.ee10.websocket.jakarta.client
|
||||||
{
|
{
|
||||||
requires org.eclipse.jetty.websocket.core.client;
|
|
||||||
requires org.eclipse.jetty.ee10.websocket.jakarta.common;
|
|
||||||
requires org.slf4j;
|
requires org.slf4j;
|
||||||
|
|
||||||
requires transitive jakarta.websocket;
|
requires transitive org.eclipse.jetty.ee10.websocket.jakarta.common;
|
||||||
requires transitive org.eclipse.jetty.client;
|
|
||||||
|
|
||||||
requires static jakarta.servlet;
|
requires static jakarta.servlet;
|
||||||
|
|
||||||
exports org.eclipse.jetty.ee10.websocket.jakarta.client;
|
exports org.eclipse.jetty.ee10.websocket.jakarta.client;
|
||||||
|
|
||||||
exports org.eclipse.jetty.ee10.websocket.jakarta.client.internal to
|
|
||||||
org.eclipse.jetty.ee10.websocket.jakarta.server;
|
|
||||||
|
|
||||||
provides jakarta.websocket.ContainerProvider with
|
provides jakarta.websocket.ContainerProvider with
|
||||||
org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainerProvider;
|
org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainerProvider;
|
||||||
|
|
||||||
|
provides jakarta.servlet.ServletContainerInitializer with
|
||||||
|
org.eclipse.jetty.ee10.websocket.jakarta.client.internal.JakartaWebSocketShutdownContainer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.ee10.websocket.jakarta.client.internal;
|
package org.eclipse.jetty.ee10.websocket.jakarta.client;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
@ -33,6 +33,10 @@ import jakarta.websocket.EndpointConfig;
|
||||||
import jakarta.websocket.Extension;
|
import jakarta.websocket.Extension;
|
||||||
import jakarta.websocket.Session;
|
import jakarta.websocket.Session;
|
||||||
import org.eclipse.jetty.client.HttpClient;
|
import org.eclipse.jetty.client.HttpClient;
|
||||||
|
import org.eclipse.jetty.ee10.websocket.jakarta.client.internal.AnnotatedClientEndpointConfig;
|
||||||
|
import org.eclipse.jetty.ee10.websocket.jakarta.client.internal.BasicClientEndpointConfig;
|
||||||
|
import org.eclipse.jetty.ee10.websocket.jakarta.client.internal.JakartaClientUpgradeRequest;
|
||||||
|
import org.eclipse.jetty.ee10.websocket.jakarta.client.internal.JsrUpgradeListener;
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.common.ConfiguredEndpoint;
|
import org.eclipse.jetty.ee10.websocket.jakarta.common.ConfiguredEndpoint;
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketContainer;
|
import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketContainer;
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketExtensionConfig;
|
import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketExtensionConfig;
|
|
@ -16,7 +16,6 @@ package org.eclipse.jetty.ee10.websocket.jakarta.client;
|
||||||
import jakarta.websocket.ContainerProvider;
|
import jakarta.websocket.ContainerProvider;
|
||||||
import jakarta.websocket.WebSocketContainer;
|
import jakarta.websocket.WebSocketContainer;
|
||||||
import org.eclipse.jetty.client.HttpClient;
|
import org.eclipse.jetty.client.HttpClient;
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.client.internal.JakartaWebSocketClientContainer;
|
|
||||||
import org.eclipse.jetty.util.component.LifeCycle;
|
import org.eclipse.jetty.util.component.LifeCycle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,14 +11,15 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.ee10.websocket.jakarta.client.internal;
|
package org.eclipse.jetty.ee10.websocket.jakarta.client;
|
||||||
|
|
||||||
import jakarta.websocket.ClientEndpoint;
|
import jakarta.websocket.ClientEndpoint;
|
||||||
import jakarta.websocket.EndpointConfig;
|
import jakarta.websocket.EndpointConfig;
|
||||||
|
import org.eclipse.jetty.ee10.websocket.jakarta.client.internal.BasicClientEndpointConfig;
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketContainer;
|
import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketContainer;
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketFrameHandlerFactory;
|
import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketFrameHandlerFactory;
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketFrameHandlerMetadata;
|
import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketFrameHandlerMetadata;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.InvokerUtils;
|
import org.eclipse.jetty.websocket.core.util.InvokerUtils;
|
||||||
|
|
||||||
public class JakartaWebSocketClientFrameHandlerFactory extends JakartaWebSocketFrameHandlerFactory
|
public class JakartaWebSocketClientFrameHandlerFactory extends JakartaWebSocketFrameHandlerFactory
|
||||||
{
|
{
|
|
@ -16,6 +16,7 @@ package org.eclipse.jetty.ee10.websocket.jakarta.client.internal;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.security.Principal;
|
import java.security.Principal;
|
||||||
|
|
||||||
|
import org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainer;
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketFrameHandler;
|
import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketFrameHandler;
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.common.UpgradeRequest;
|
import org.eclipse.jetty.ee10.websocket.jakarta.common.UpgradeRequest;
|
||||||
import org.eclipse.jetty.websocket.core.FrameHandler;
|
import org.eclipse.jetty.websocket.core.FrameHandler;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.ee10.websocket.jakarta.client;
|
package org.eclipse.jetty.ee10.websocket.jakarta.client.internal;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import jakarta.servlet.ServletContext;
|
||||||
import jakarta.servlet.ServletContextEvent;
|
import jakarta.servlet.ServletContextEvent;
|
||||||
import jakarta.servlet.ServletContextListener;
|
import jakarta.servlet.ServletContextListener;
|
||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.client.internal.JakartaWebSocketClientContainer;
|
import org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainer;
|
||||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||||
import org.eclipse.jetty.util.component.LifeCycle;
|
import org.eclipse.jetty.util.component.LifeCycle;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
|
@ -1 +1 @@
|
||||||
org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketShutdownContainer
|
org.eclipse.jetty.ee10.websocket.jakarta.client.internal.JakartaWebSocketShutdownContainer
|
||||||
|
|
|
@ -26,9 +26,9 @@ import org.eclipse.jetty.util.FutureCallback;
|
||||||
import org.eclipse.jetty.websocket.core.CoreSession;
|
import org.eclipse.jetty.websocket.core.CoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.MessageOutputStream;
|
import org.eclipse.jetty.websocket.core.messages.MessageOutputStream;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.MessageWriter;
|
import org.eclipse.jetty.websocket.core.messages.MessageWriter;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.TextUtils;
|
import org.eclipse.jetty.websocket.core.util.TextUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.eclipse.jetty.util.FutureCallback;
|
||||||
import org.eclipse.jetty.websocket.core.CoreSession;
|
import org.eclipse.jetty.websocket.core.CoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.TextUtils;
|
import org.eclipse.jetty.websocket.core.util.TextUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
@ -46,11 +46,11 @@ import org.eclipse.jetty.websocket.core.FrameHandler;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
|
||||||
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
|
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.MessageSink;
|
import org.eclipse.jetty.websocket.core.messages.MessageSink;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.PartialByteArrayMessageSink;
|
import org.eclipse.jetty.websocket.core.messages.PartialByteArrayMessageSink;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.PartialByteBufferMessageSink;
|
import org.eclipse.jetty.websocket.core.messages.PartialByteBufferMessageSink;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.PartialStringMessageSink;
|
import org.eclipse.jetty.websocket.core.messages.PartialStringMessageSink;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.InvokerUtils;
|
import org.eclipse.jetty.websocket.core.util.InvokerUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
@ -47,12 +47,12 @@ import org.eclipse.jetty.websocket.core.CoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||||
import org.eclipse.jetty.websocket.core.exception.InvalidSignatureException;
|
import org.eclipse.jetty.websocket.core.exception.InvalidSignatureException;
|
||||||
import org.eclipse.jetty.websocket.core.exception.InvalidWebSocketException;
|
import org.eclipse.jetty.websocket.core.exception.InvalidWebSocketException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.MessageSink;
|
import org.eclipse.jetty.websocket.core.messages.MessageSink;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.PartialByteArrayMessageSink;
|
import org.eclipse.jetty.websocket.core.messages.PartialByteArrayMessageSink;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.PartialByteBufferMessageSink;
|
import org.eclipse.jetty.websocket.core.messages.PartialByteBufferMessageSink;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.PartialStringMessageSink;
|
import org.eclipse.jetty.websocket.core.messages.PartialStringMessageSink;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.InvokerUtils;
|
import org.eclipse.jetty.websocket.core.util.InvokerUtils;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.ReflectUtils;
|
import org.eclipse.jetty.websocket.core.util.ReflectUtils;
|
||||||
|
|
||||||
public abstract class JakartaWebSocketFrameHandlerFactory
|
public abstract class JakartaWebSocketFrameHandlerFactory
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,7 @@ import java.lang.invoke.MethodHandle;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.common.decoders.RegisteredDecoder;
|
import org.eclipse.jetty.ee10.websocket.jakarta.common.decoders.RegisteredDecoder;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.MessageSink;
|
import org.eclipse.jetty.websocket.core.messages.MessageSink;
|
||||||
|
|
||||||
public class JakartaWebSocketMessageMetadata
|
public class JakartaWebSocketMessageMetadata
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,8 +28,8 @@ import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.OutgoingFrames;
|
import org.eclipse.jetty.websocket.core.OutgoingFrames;
|
||||||
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
|
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.MessageOutputStream;
|
import org.eclipse.jetty.websocket.core.messages.MessageOutputStream;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.MessageWriter;
|
import org.eclipse.jetty.websocket.core.messages.MessageWriter;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ import org.eclipse.jetty.ee10.websocket.jakarta.common.encoders.AvailableEncoder
|
||||||
import org.eclipse.jetty.util.Callback;
|
import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.websocket.core.CoreSession;
|
import org.eclipse.jetty.websocket.core.CoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.ReflectUtils;
|
import org.eclipse.jetty.websocket.core.util.ReflectUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ import jakarta.websocket.EndpointConfig;
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||||
import org.eclipse.jetty.websocket.core.exception.InvalidSignatureException;
|
import org.eclipse.jetty.websocket.core.exception.InvalidSignatureException;
|
||||||
import org.eclipse.jetty.websocket.core.exception.InvalidWebSocketException;
|
import org.eclipse.jetty.websocket.core.exception.InvalidWebSocketException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.ReflectUtils;
|
import org.eclipse.jetty.websocket.core.util.ReflectUtils;
|
||||||
|
|
||||||
public class AvailableDecoders implements Iterable<RegisteredDecoder>, Closeable
|
public class AvailableDecoders implements Iterable<RegisteredDecoder>, Closeable
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.eclipse.jetty.ee10.websocket.jakarta.common.InitException;
|
||||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||||
import org.eclipse.jetty.websocket.core.exception.InvalidSignatureException;
|
import org.eclipse.jetty.websocket.core.exception.InvalidSignatureException;
|
||||||
import org.eclipse.jetty.websocket.core.exception.InvalidWebSocketException;
|
import org.eclipse.jetty.websocket.core.exception.InvalidWebSocketException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.ReflectUtils;
|
import org.eclipse.jetty.websocket.core.util.ReflectUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.websocket.core.CoreSession;
|
import org.eclipse.jetty.websocket.core.CoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.exception.CloseException;
|
import org.eclipse.jetty.websocket.core.exception.CloseException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.MessageSink;
|
import org.eclipse.jetty.websocket.core.messages.MessageSink;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,8 @@ import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketFrameHand
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.common.decoders.RegisteredDecoder;
|
import org.eclipse.jetty.ee10.websocket.jakarta.common.decoders.RegisteredDecoder;
|
||||||
import org.eclipse.jetty.websocket.core.CoreSession;
|
import org.eclipse.jetty.websocket.core.CoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.exception.CloseException;
|
import org.eclipse.jetty.websocket.core.exception.CloseException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.ByteBufferMessageSink;
|
import org.eclipse.jetty.websocket.core.messages.ByteBufferMessageSink;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.MessageSink;
|
import org.eclipse.jetty.websocket.core.messages.MessageSink;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketFrameHand
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.common.decoders.RegisteredDecoder;
|
import org.eclipse.jetty.ee10.websocket.jakarta.common.decoders.RegisteredDecoder;
|
||||||
import org.eclipse.jetty.websocket.core.CoreSession;
|
import org.eclipse.jetty.websocket.core.CoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.exception.CloseException;
|
import org.eclipse.jetty.websocket.core.exception.CloseException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.InputStreamMessageSink;
|
import org.eclipse.jetty.websocket.core.messages.InputStreamMessageSink;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.MessageSink;
|
import org.eclipse.jetty.websocket.core.messages.MessageSink;
|
||||||
|
|
||||||
public class DecodedBinaryStreamMessageSink<T> extends AbstractDecodedMessageSink.Stream<Decoder.BinaryStream<T>>
|
public class DecodedBinaryStreamMessageSink<T> extends AbstractDecodedMessageSink.Stream<Decoder.BinaryStream<T>>
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,8 +24,8 @@ import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketFrameHand
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.common.decoders.RegisteredDecoder;
|
import org.eclipse.jetty.ee10.websocket.jakarta.common.decoders.RegisteredDecoder;
|
||||||
import org.eclipse.jetty.websocket.core.CoreSession;
|
import org.eclipse.jetty.websocket.core.CoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.exception.CloseException;
|
import org.eclipse.jetty.websocket.core.exception.CloseException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.MessageSink;
|
import org.eclipse.jetty.websocket.core.messages.MessageSink;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.StringMessageSink;
|
import org.eclipse.jetty.websocket.core.messages.StringMessageSink;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketFrameHand
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.common.decoders.RegisteredDecoder;
|
import org.eclipse.jetty.ee10.websocket.jakarta.common.decoders.RegisteredDecoder;
|
||||||
import org.eclipse.jetty.websocket.core.CoreSession;
|
import org.eclipse.jetty.websocket.core.CoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.exception.CloseException;
|
import org.eclipse.jetty.websocket.core.exception.CloseException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.MessageSink;
|
import org.eclipse.jetty.websocket.core.messages.MessageSink;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.ReaderMessageSink;
|
import org.eclipse.jetty.websocket.core.messages.ReaderMessageSink;
|
||||||
|
|
||||||
public class DecodedTextStreamMessageSink<T> extends AbstractDecodedMessageSink.Stream<Decoder.TextStream<T>>
|
public class DecodedTextStreamMessageSink<T> extends AbstractDecodedMessageSink.Stream<Decoder.TextStream<T>>
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ package org.eclipse.jetty.ee10.websocket.jakarta.common;
|
||||||
import jakarta.websocket.ClientEndpoint;
|
import jakarta.websocket.ClientEndpoint;
|
||||||
import jakarta.websocket.ClientEndpointConfig;
|
import jakarta.websocket.ClientEndpointConfig;
|
||||||
import jakarta.websocket.EndpointConfig;
|
import jakarta.websocket.EndpointConfig;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.InvokerUtils;
|
import org.eclipse.jetty.websocket.core.util.InvokerUtils;
|
||||||
|
|
||||||
public class DummyFrameHandlerFactory extends JakartaWebSocketFrameHandlerFactory
|
public class DummyFrameHandlerFactory extends JakartaWebSocketFrameHandlerFactory
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.eclipse.jetty.util.FutureCallback;
|
||||||
import org.eclipse.jetty.util.IO;
|
import org.eclipse.jetty.util.IO;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.InputStreamMessageSink;
|
import org.eclipse.jetty.websocket.core.messages.InputStreamMessageSink;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.eclipse.jetty.util.Utf8StringBuilder;
|
||||||
import org.eclipse.jetty.websocket.core.CoreSession;
|
import org.eclipse.jetty.websocket.core.CoreSession;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.MessageWriter;
|
import org.eclipse.jetty.websocket.core.messages.MessageWriter;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.eclipse.jetty.util.FutureCallback;
|
||||||
import org.eclipse.jetty.util.IO;
|
import org.eclipse.jetty.util.IO;
|
||||||
import org.eclipse.jetty.websocket.core.Frame;
|
import org.eclipse.jetty.websocket.core.Frame;
|
||||||
import org.eclipse.jetty.websocket.core.OpCode;
|
import org.eclipse.jetty.websocket.core.OpCode;
|
||||||
import org.eclipse.jetty.websocket.core.internal.messages.ReaderMessageSink;
|
import org.eclipse.jetty.websocket.core.messages.ReaderMessageSink;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
|
|
@ -22,8 +22,8 @@ import java.util.Map;
|
||||||
import jakarta.websocket.Session;
|
import jakarta.websocket.Session;
|
||||||
import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketFrameHandlerFactory;
|
import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketFrameHandlerFactory;
|
||||||
import org.eclipse.jetty.util.annotation.Name;
|
import org.eclipse.jetty.util.annotation.Name;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.InvokerUtils;
|
import org.eclipse.jetty.websocket.core.util.InvokerUtils;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.ReflectUtils;
|
import org.eclipse.jetty.websocket.core.util.ReflectUtils;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
|
|
@ -19,8 +19,8 @@ import java.lang.invoke.MethodHandles;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import org.eclipse.jetty.util.annotation.Name;
|
import org.eclipse.jetty.util.annotation.Name;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.InvokerUtils;
|
import org.eclipse.jetty.websocket.core.util.InvokerUtils;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.ReflectUtils;
|
import org.eclipse.jetty.websocket.core.util.ReflectUtils;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
|
|
@ -17,7 +17,7 @@ import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import org.eclipse.jetty.util.annotation.Name;
|
import org.eclipse.jetty.util.annotation.Name;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.InvokerUtils;
|
import org.eclipse.jetty.websocket.core.util.InvokerUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple {@link InvokerUtils.ParamIdentifier}
|
* Simple {@link InvokerUtils.ParamIdentifier}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.ee10.websocket.jakarta.common.util;
|
package org.eclipse.jetty.ee10.websocket.jakarta.common.util;
|
||||||
|
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.ReflectUtils;
|
import org.eclipse.jetty.websocket.core.util.ReflectUtils;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
module org.eclipse.jetty.ee10.websocket.jakarta.server
|
module org.eclipse.jetty.ee10.websocket.jakarta.server
|
||||||
{
|
{
|
||||||
requires org.eclipse.jetty.websocket.core.server;
|
requires org.eclipse.jetty.websocket.core.server;
|
||||||
requires org.eclipse.jetty.ee10.websocket.jakarta.common;
|
|
||||||
requires org.eclipse.jetty.ee10.websocket.servlet;
|
requires org.eclipse.jetty.ee10.websocket.servlet;
|
||||||
requires org.slf4j;
|
requires org.slf4j;
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,6 @@ public class JakartaWebSocketConfiguration extends AbstractConfiguration
|
||||||
protectAndExpose("org.eclipse.jetty.ee10.websocket.servlet."); // For WebSocketUpgradeFilter
|
protectAndExpose("org.eclipse.jetty.ee10.websocket.servlet."); // For WebSocketUpgradeFilter
|
||||||
protectAndExpose("org.eclipse.jetty.ee10.websocket.jakarta.server.config.");
|
protectAndExpose("org.eclipse.jetty.ee10.websocket.jakarta.server.config.");
|
||||||
protectAndExpose("org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainerProvider");
|
protectAndExpose("org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainerProvider");
|
||||||
protectAndExpose("org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketShutdownContainer");
|
protectAndExpose("org.eclipse.jetty.ee10.websocket.jakarta.client.internal.JakartaWebSocketShutdownContainer");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue