Merge pull request #9356 from eclipse/jetty-12.0.x-websocket-JPMS

cleanup of websocket to fix JPMS warnings
This commit is contained in:
Lachlan 2023-02-17 15:30:54 +11:00 committed by GitHub
commit 81046650ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
243 changed files with 532 additions and 594 deletions

View File

@ -38,7 +38,7 @@
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>*,org.eclipse.jetty.websocket.core.client.internal.*</Export-Package>
<Export-Package>*</Export-Package>
</instructions>
</configuration>
</plugin>

View File

@ -47,16 +47,16 @@ import org.eclipse.jetty.websocket.core.Behavior;
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.ExtensionStack;
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.WebSocketCoreSession;
import org.eclipse.jetty.websocket.core.client.internal.HttpUpgraderOverHTTP;
import org.eclipse.jetty.websocket.core.client.internal.HttpUpgraderOverHTTP2;
import org.eclipse.jetty.websocket.core.exception.UpgradeException;
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.LoggerFactory;
@ -480,8 +480,8 @@ public abstract class CoreClientUpgradeRequest implements Response.CompleteListe
HttpClient httpClient = wsClient.getHttpClient();
ByteBufferPool bufferPool = wsClient.getWebSocketComponents().getByteBufferPool();
WebSocketConnection wsConnection = new WebSocketConnection(endPoint, httpClient.getExecutor(), httpClient.getScheduler(), bufferPool, coreSession);
wsClient.getEventListeners().forEach(wsConnection::addEventListener);
coreSession.setWebSocketConnection(wsConnection);
wsClient.getEventListeners().forEach(wsConnection::addEventListener);
Throwable listenerError = notifyUpgradeListeners((listener) -> listener.onHandshakeResponse(request, response));
if (listenerError != null)
throw new WebSocketException("onHandshakeResponse error", listenerError);

View File

@ -30,7 +30,7 @@ import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.websocket.core.WebSocketConstants;
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
{
@ -85,7 +85,7 @@ public class HttpUpgraderOverHTTP implements HttpUpgrader
{
// Check the Accept hash
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);
if (expectedHash.equalsIgnoreCase(respHash))
{

View File

@ -38,7 +38,7 @@
<configuration>
<instructions>
<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>
osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)"; resolution:=optional
</Require-Capability>

View File

@ -21,53 +21,11 @@ module org.eclipse.jetty.websocket.core.common
exports org.eclipse.jetty.websocket.core;
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
org.eclipse.jetty.websocket.core.client,
org.eclipse.jetty.websocket.core.server,
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;
provides org.eclipse.jetty.websocket.core.Extension with

View File

@ -25,13 +25,8 @@ import org.eclipse.jetty.util.Callback;
/**
* 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();
/**
@ -120,11 +115,8 @@ public interface CoreSession extends OutgoingFrames, Configuration
*/
boolean isOutputOpen();
/**
* 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)
*/
boolean isClosed();
void flush(Callback callback);
/**
@ -270,6 +262,12 @@ public interface CoreSession extends OutgoingFrames, Configuration
return true;
}
@Override
public boolean isClosed()
{
return false;
}
@Override
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
public void sendFrame(Frame frame, Callback callback, boolean batch)
{

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.core.internal;
package org.eclipse.jetty.websocket.core;
import java.io.IOException;
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.ManagedObject;
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.util.DemandChain;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -258,7 +252,7 @@ public class ExtensionStack implements IncomingFrames, OutgoingFrames, Dumpable
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)
throw new IllegalStateException();

View File

@ -13,6 +13,7 @@
package org.eclipse.jetty.websocket.core;
import java.io.Closeable;
import java.nio.ByteBuffer;
import java.util.Arrays;
@ -510,4 +511,54 @@ public class Frame
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;
}
}
}

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.core.internal;
package org.eclipse.jetty.websocket.core;
import java.net.URI;
import java.net.URISyntaxException;
@ -23,11 +23,9 @@ import java.util.Objects;
import java.util.stream.Collectors;
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.UrlEncoded;
import org.eclipse.jetty.websocket.core.ExtensionConfig;
import org.eclipse.jetty.websocket.core.WebSocketConstants;
public class Negotiated
{
@ -56,11 +54,11 @@ public class Negotiated
else
{
map = new HashMap<>();
MultiMap<String> params = new MultiMap<>();
UrlEncoded.decodeUtf8To(rawQuery, params);
for (String p : params.keySet())
Fields fields = new Fields();
UrlEncoded.decodeUtf8To(rawQuery, fields);
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);

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.core.internal;
package org.eclipse.jetty.websocket.core;
import java.io.IOException;
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.thread.AutoLock;
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.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.LoggerFactory;
@ -129,16 +130,6 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
return super.getExecutor();
}
public Generator getGenerator()
{
return generator;
}
public Parser getParser()
{
return parser;
}
/**
* @return the local InetSocketAddress
* @deprecated use {@link #getLocalSocketAddress()} instead
@ -180,6 +171,11 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
return useInputDirectByteBuffers;
}
public void setWriteTimeout(long writeTimeout)
{
flusher.setIdleTimeout(writeTimeout);
}
public void setUseInputDirectByteBuffers(boolean useInputDirectByteBuffers)
{
this.useInputDirectByteBuffers = useInputDirectByteBuffers;
@ -239,7 +235,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
return false;
}
protected void onFrame(Parser.ParsedFrame frame)
protected void onFrame(Frame.Parsed frame)
{
if (LOG.isDebugEnabled())
LOG.debug("onFrame({})", frame);
@ -427,7 +423,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
// Parse and handle frames
while (networkBuffer.hasRemaining())
{
Parser.ParsedFrame frame = parser.parse(networkBuffer.getByteBuffer());
Frame.Parsed frame = parser.parse(networkBuffer.getByteBuffer());
if (frame == null)
break;
@ -573,11 +569,6 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
setInitialBuffer(buffer);
}
public FrameFlusher getFrameFlusher()
{
return flusher;
}
@Override
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 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)
{

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.core.internal;
package org.eclipse.jetty.websocket.core;
import java.io.IOException;
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.Utf8Appendable;
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.ProtocolException;
import org.eclipse.jetty.websocket.core.exception.WebSocketTimeoutException;
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.LoggerFactory;
@ -55,7 +46,7 @@ import static org.eclipse.jetty.util.Callback.NOOP;
/**
* 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 CloseStatus NO_CODE = new CloseStatus(CloseStatus.NO_CODE);
@ -172,7 +163,7 @@ public class WebSocketCoreSession implements IncomingFrames, CoreSession, Dumpab
{
writeTimeout = timeout;
if (getConnection() != null)
getConnection().getFrameFlusher().setIdleTimeout(timeout.toMillis());
getConnection().setWriteTimeout(timeout.toMillis());
}
public SocketAddress getLocalAddress()
@ -202,10 +193,14 @@ public class WebSocketCoreSession implements IncomingFrames, CoreSession, Dumpab
return sessionState.isClosed();
}
/**
* Used to set the WebSocketConnection on this {@link WebSocketCoreSession}.
* @param connection the websocket connection.
*/
public void setWebSocketConnection(WebSocketConnection connection)
{
connection.getEndPoint().setIdleTimeout(idleTimeout.toMillis());
connection.getFrameFlusher().setIdleTimeout(writeTimeout.toMillis());
connection.setWriteTimeout(writeTimeout.toMillis());
extensionStack.setLastDemand(connection::demand);
this.connection = connection;
}
@ -245,6 +240,9 @@ public class WebSocketCoreSession implements IncomingFrames, CoreSession, Dumpab
return components.getByteBufferPool();
}
/**
* Used to notify the {@link WebSocketCoreSession} that EOF has been read or the connection has been closed.
*/
public void onEof()
{
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()
{
@ -810,7 +808,7 @@ public class WebSocketCoreSession implements IncomingFrames, CoreSession, Dumpab
}
@Override
void forwardFrame(Frame frame, Callback callback, boolean batch)
protected void forwardFrame(Frame frame, Callback callback, boolean batch)
{
negotiated.getExtensions().sendFrame(frame, callback, batch);
}

View File

@ -16,7 +16,7 @@ package org.eclipse.jetty.websocket.core.exception;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import org.eclipse.jetty.websocket.core.internal.util.ReflectUtils;
import org.eclipse.jetty.websocket.core.util.ReflectUtils;
@SuppressWarnings("serial")
public class DuplicateAnnotationException extends InvalidWebSocketException

View File

@ -17,7 +17,7 @@ import java.lang.annotation.Annotation;
import java.lang.invoke.MethodType;
import java.lang.reflect.Method;
import org.eclipse.jetty.websocket.core.internal.util.ReflectUtils;
import org.eclipse.jetty.websocket.core.util.ReflectUtils;
@SuppressWarnings("serial")
public class InvalidSignatureException extends InvalidWebSocketException

View File

@ -23,6 +23,9 @@ import org.eclipse.jetty.websocket.core.ExtensionConfig;
import org.eclipse.jetty.websocket.core.Frame;
import org.eclipse.jetty.websocket.core.OpCode;
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.LoggerFactory;
@ -42,7 +45,7 @@ public class FragmentExtension extends AbstractExtension implements DemandChain
outgoingFlusher = new FragmentingFlusher(configuration)
{
@Override
void forwardFrame(Frame frame, Callback callback, boolean batch)
protected void forwardFrame(Frame frame, Callback callback, boolean batch)
{
nextOutgoingFrame(frame, callback, batch);
}

View File

@ -13,14 +13,12 @@
package org.eclipse.jetty.websocket.core.internal;
import java.io.Closeable;
import java.nio.ByteBuffer;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.RetainableByteBuffer;
import org.eclipse.jetty.util.BufferUtil;
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.Frame;
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.
* @throws WebSocketException if unable to parse properly
*/
public ParsedFrame parse(ByteBuffer buffer) throws WebSocketException
public Frame.Parsed parse(ByteBuffer buffer) throws WebSocketException
{
try
{
@ -212,7 +210,7 @@ public class Parser
{
if (aggregate == null)
checkFrameSize(OpCode.getOpCode(firstByte), payloadLength);
ParsedFrame frame = parsePayload(buffer);
Frame.Parsed frame = parsePayload(buffer);
if (LOG.isDebugEnabled())
LOG.debug("{} parsed {}", this, 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
byte opcode = OpCode.getOpCode(firstByte);
@ -277,10 +275,10 @@ public class Parser
if (OpCode.isControlFrame(opcode) && !fin)
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;
@ -299,14 +297,14 @@ public class Parser
content.limit(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;
firstByte = (byte)((firstByte & 0x80) | OpCode.CONTINUATION);
state = State.FRAGMENT;
return frame;
}
private ParsedFrame parsePayload(ByteBuffer buffer)
private Frame.Parsed parsePayload(ByteBuffer buffer)
{
if (payloadLength == 0)
return null;
@ -340,7 +338,7 @@ public class Parser
if (available == payloadLength)
{
// 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());
state = State.START;
return frame;
@ -351,7 +349,7 @@ public class Parser
int limit = buffer.limit();
int end = buffer.position() + payloadLength;
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.limit(limit);
state = State.START;
@ -398,54 +396,4 @@ public class Parser
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);
}
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;
}
}
}

View File

@ -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.MessageTooLargeException;
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.LoggerFactory;

View File

@ -21,7 +21,7 @@ import org.eclipse.jetty.websocket.core.ExtensionConfig;
import org.eclipse.jetty.websocket.core.Frame;
import org.eclipse.jetty.websocket.core.WebSocketComponents;
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.LoggerFactory;

View File

@ -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.util.Objects;

View File

@ -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.MethodType;

View File

@ -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.MethodType;

View File

@ -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.lang.invoke.MethodHandle;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.core.internal.messages;
package org.eclipse.jetty.websocket.core.messages;
import java.lang.invoke.MethodHandle;

View File

@ -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.InputStream;

View File

@ -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.OutputStream;

View File

@ -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.Reader;

View File

@ -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.websocket.core.Frame;

View File

@ -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.Writer;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.core.internal.messages;
package org.eclipse.jetty.websocket.core.messages;
import java.lang.invoke.MethodHandle;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.core.internal.messages;
package org.eclipse.jetty.websocket.core.messages;
import java.lang.invoke.MethodHandle;

View File

@ -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.util.Objects;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.core.internal.messages;
package org.eclipse.jetty.websocket.core.messages;
import java.lang.invoke.MethodHandle;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.core.internal.messages;
package org.eclipse.jetty.websocket.core.messages;
import java.lang.invoke.MethodHandle;

View File

@ -11,11 +11,12 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.core.internal;
package org.eclipse.jetty.websocket.core.util;
import java.util.function.LongConsumer;
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.

View File

@ -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.AtomicReference;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.core.internal;
package org.eclipse.jetty.websocket.core.util;
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.Frame;
import org.eclipse.jetty.websocket.core.OpCode;
import org.eclipse.jetty.websocket.core.internal.FrameEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -39,7 +40,7 @@ public abstract class FragmentingFlusher extends TransformingFlusher
this.configuration = configuration;
}
abstract void forwardFrame(Frame frame, Callback callback, boolean batch);
protected abstract void forwardFrame(Frame frame, Callback callback, boolean batch);
@Override
protected boolean onFrame(Frame frame, Callback callback, boolean batch)

View File

@ -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.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.MessageTooLargeException;
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}.
@ -61,7 +60,7 @@ public class FrameValidation
*/
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
}
}
@ -82,7 +81,7 @@ public class FrameValidation
*/
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);
if (!CloseStatus.isTransmittableStatusCode(closeStatus.getCode()) && (closeStatus.getCode() != CloseStatus.NO_CODE))

View File

@ -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.MethodHandles;

View File

@ -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.invoke.MethodType;

View File

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

View File

@ -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.Queue;
@ -21,6 +21,7 @@ import org.eclipse.jetty.util.IteratingCallback;
import org.eclipse.jetty.util.StaticException;
import org.eclipse.jetty.util.thread.AutoLock;
import org.eclipse.jetty.websocket.core.Frame;
import org.eclipse.jetty.websocket.core.internal.FrameEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -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.security.MessageDigest;
@ -19,7 +19,7 @@ import java.util.Base64;
import org.eclipse.jetty.websocket.core.WebSocketConstants;
public final class WebSocketCore
public final class WebSocketUtils
{
/**

View File

@ -33,14 +33,14 @@ import org.eclipse.jetty.util.thread.Scheduler;
import org.eclipse.jetty.websocket.core.Behavior;
import org.eclipse.jetty.websocket.core.Configuration;
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.Negotiated;
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.WebSocketCoreSession;
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.WebSocketNegotiator;
import org.slf4j.Logger;
@ -129,8 +129,6 @@ public abstract class AbstractHandshaker implements Handshaker
connectionMetaData.getConnector().getEventListeners().forEach(connection::addEventListener);
coreSession.setWebSocketConnection(connection);
prepareResponse(response, negotiation);
if (httpConfig.getSendServerVersion())
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)
{
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);

View File

@ -28,9 +28,9 @@ import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.websocket.core.WebSocketComponents;
import org.eclipse.jetty.websocket.core.internal.WebSocketConnection;
import org.eclipse.jetty.websocket.core.internal.WebSocketCore;
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
import org.eclipse.jetty.websocket.core.WebSocketConnection;
import org.eclipse.jetty.websocket.core.WebSocketCoreSession;
import org.eclipse.jetty.websocket.core.util.WebSocketUtils;
public final class RFC6455Handshaker extends AbstractHandshaker
{
@ -80,7 +80,9 @@ public final class RFC6455Handshaker extends AbstractHandshaker
ConnectionMetaData connectionMetaData = baseRequest.getConnectionMetaData();
Connector connector = connectionMetaData.getConnector();
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
@ -90,6 +92,6 @@ public final class RFC6455Handshaker extends AbstractHandshaker
HttpFields.Mutable responseFields = response.getHeaders();
responseFields.put(UPGRADE_WEBSOCKET);
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()));
}
}

View File

@ -24,8 +24,8 @@ import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.server.TunnelSupport;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.websocket.core.WebSocketComponents;
import org.eclipse.jetty.websocket.core.internal.WebSocketConnection;
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
import org.eclipse.jetty.websocket.core.WebSocketConnection;
import org.eclipse.jetty.websocket.core.WebSocketCoreSession;
public class RFC8441Handshaker extends AbstractHandshaker
{

View File

@ -16,8 +16,8 @@ package org.eclipse.jetty.websocket.core;
import java.util.Base64;
import java.util.stream.Stream;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.websocket.core.internal.WebSocketCore;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.websocket.core.util.WebSocketUtils;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
@ -29,7 +29,7 @@ public class AcceptHashTest
{
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));
return Base64.getEncoder().encodeToString(key);
}
@ -53,7 +53,7 @@ public class AcceptHashTest
@MethodSource("data")
public void testHashKey(String clientKey, String expectedHash)
{
String serverAccept = WebSocketCore.hashKey(clientKey);
String serverAccept = WebSocketUtils.hashKey(clientKey);
assertThat("Hashed Key", serverAccept, is(expectedHash));
}
}

View File

@ -14,7 +14,6 @@
package org.eclipse.jetty.websocket.core;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
public class DemandingIncomingFramesCapture extends IncomingFramesCapture
{

View File

@ -19,11 +19,8 @@ import java.util.stream.Stream;
import org.eclipse.jetty.util.BufferUtil;
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.Negotiated;
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
import org.eclipse.jetty.websocket.core.internal.util.FrameValidation;
import org.eclipse.jetty.websocket.core.util.FrameValidation;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

View File

@ -25,11 +25,8 @@ import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
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.Negotiated;
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
import org.eclipse.jetty.websocket.core.internal.util.FrameValidation;
import org.eclipse.jetty.websocket.core.util.FrameValidation;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;

View File

@ -20,7 +20,7 @@ import java.util.Locale;
import org.eclipse.jetty.util.BufferUtil;
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 static org.hamcrest.MatcherAssert.assertThat;
@ -45,7 +45,7 @@ public class OutgoingNetworkBytesCapture implements OutgoingFrames
{
assertThat("Capture index does not exist", idx, lessThan(captured.size()));
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)));
}

View File

@ -18,11 +18,8 @@ import java.util.LinkedList;
import java.util.concurrent.BlockingQueue;
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.WebSocketCoreSession;
import org.eclipse.jetty.websocket.core.internal.util.FrameValidation;
import org.eclipse.jetty.websocket.core.util.FrameValidation;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

View File

@ -23,11 +23,9 @@ import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.toolchain.test.Hex;
import org.eclipse.jetty.util.BufferUtil;
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.ProtocolException;
import org.eclipse.jetty.websocket.core.internal.Generator;
import org.eclipse.jetty.websocket.core.internal.Parser;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
@ -1497,7 +1495,7 @@ public class ParserTest
@Test
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));
assertThat(e.getMessage(), Matchers.containsString("Invalid CLOSE Code: "));
}
@ -1505,7 +1503,7 @@ public class ParserTest
@Test
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);
capture.assertHasFrame(OpCode.CLOSE, 1);
@ -1523,7 +1521,7 @@ public class ParserTest
ParserCapture capture = parse(Behavior.CLIENT, MAX_ALLOWED_FRAME_SIZE, buffer, false);
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());
assertTrue(text.getPayload().isDirect());
assertFalse(text.isReleaseable());
@ -1538,7 +1536,7 @@ public class ParserTest
ParserCapture capture = parse(Behavior.CLIENT, MAX_ALLOWED_FRAME_SIZE, buffer, false);
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());
assertThat(text.getPayload().array(), sameInstance(buffer.array()));
assertFalse(text.isReleaseable());
@ -1559,7 +1557,7 @@ public class ParserTest
capture.parse(buffer);
assertEquals(1, capture.framesQueue.size());
assertEquals(0, buffer.remaining());
Parser.ParsedFrame text = (Parser.ParsedFrame)capture.framesQueue.take();
Frame.Parsed text = (Frame.Parsed)capture.framesQueue.take();
assertFalse(text.isFin());
assertEquals("Hello", text.getPayloadAsUTF8());
assertThat(text.getPayload().array(), sameInstance(buffer.array()));
@ -1570,7 +1568,7 @@ public class ParserTest
capture.parse(buffer);
assertEquals(1, capture.framesQueue.size());
assertEquals(0, buffer.remaining());
text = (Parser.ParsedFrame)capture.framesQueue.take();
text = (Frame.Parsed)capture.framesQueue.take();
assertFalse(text.isFin());
assertEquals(" ", text.getPayloadAsUTF8());
assertThat(text.getPayload().array(), sameInstance(buffer.array()));
@ -1582,7 +1580,7 @@ public class ParserTest
assertEquals(1, capture.framesQueue.size());
assertEquals(0, buffer.remaining());
capture.assertHasFrame(OpCode.CONTINUATION, 1);
text = (Parser.ParsedFrame)capture.framesQueue.take();
text = (Frame.Parsed)capture.framesQueue.take();
assertTrue(text.isFin());
assertEquals("World", text.getPayloadAsUTF8());
assertThat(text.getPayload().array(), sameInstance(buffer.array()));
@ -1618,7 +1616,7 @@ public class ParserTest
assertEquals(0, buffer.remaining());
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());
assertThat(text.getPayload().array(), not(sameInstance(buffer.array())));
assertTrue(text.isReleaseable());
@ -1652,7 +1650,7 @@ public class ParserTest
assertEquals(0, buffer.remaining());
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());
assertThat(text.getPayload().array(), not(sameInstance(buffer.array())));
assertTrue(text.isReleaseable());

View File

@ -33,7 +33,7 @@ import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient;
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.BeforeEach;
import org.junit.jupiter.api.Test;
@ -313,7 +313,7 @@ public class UpgradeWithLeftOverHttpBytesTest extends WebSocketTester
assertTrue(matcher.matches());
String key = matcher.group(1);
assertFalse(StringUtil.isEmpty(key));
return WebSocketCore.hashKey(key);
return WebSocketUtils.hashKey(key);
}
static String getRequestHeaders(InputStream is)

View File

@ -26,7 +26,6 @@ import org.eclipse.jetty.logging.StacklessLogging;
import org.eclipse.jetty.util.BlockingArrayQueue;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

View File

@ -17,7 +17,7 @@ import java.nio.ByteBuffer;
import org.eclipse.jetty.toolchain.test.Hex;
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.junit.jupiter.api.Test;
@ -117,8 +117,8 @@ public class WebSocketFrameTest
for (int i = 0; i <= 8; i++)
{
Frame frame = new Frame(OpCode.BINARY);
frame.setPayload(TypeUtil.fromHexString("0000FFFF000FFFF0".substring(0, i * 2)));
frame.setMask(TypeUtil.fromHexString("FF00FF00"));
frame.setPayload(StringUtil.fromHexString("0000FFFF000FFFF0".substring(0, i * 2)));
frame.setMask(StringUtil.fromHexString("FF00FF00"));
frame.demask();
assertEquals("Ff0000FfFf0f00F0".substring(0, i * 2), BufferUtil.toHexString(frame.getPayload()), "len=" + i);
}

View File

@ -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.WebSocketCoreClient;
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.ServerUpgradeResponse;
import org.eclipse.jetty.websocket.core.server.WebSocketNegotiator;

View File

@ -20,8 +20,6 @@ import java.util.function.BiFunction;
import org.eclipse.jetty.logging.StacklessLogging;
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.Test;
import org.slf4j.Logger;
@ -74,7 +72,7 @@ public class WebSocketOpenTest extends WebSocketTester
s.demand(1);
return null;
});
Parser.ParsedFrame frame = receiveFrame(client.getInputStream());
Frame.Parsed frame = receiveFrame(client.getInputStream());
assertThat(frame.getPayloadAsUTF8(), is("Hello"));
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));
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(new CloseStatus(frame).getCode(), is(CloseStatus.SERVER_ERROR));
}
@ -120,7 +118,7 @@ public class WebSocketOpenTest extends WebSocketTester
return null;
});
Parser.ParsedFrame frame = receiveFrame(client.getInputStream());
Frame.Parsed frame = receiveFrame(client.getInputStream());
assertThat(frame.getOpCode(), is(OpCode.CLOSE));
assertThat(new CloseStatus(frame).getCode(), is(CloseStatus.SHUTDOWN));
@ -155,7 +153,7 @@ public class WebSocketOpenTest extends WebSocketTester
// Can send while onOpen is active
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"));
// Succeeded moves to OPEN state.

View File

@ -154,7 +154,7 @@ public class WebSocketTester
return client;
}
protected Parser.ParsedFrame receiveFrame(InputStream in) throws IOException
protected Frame.Parsed receiveFrame(InputStream in) throws IOException
{
if (buffer == null)
buffer = bufferPool.acquire(4096, false);
@ -162,7 +162,7 @@ public class WebSocketTester
while (true)
{
ByteBuffer byteBuffer = buffer.getByteBuffer();
Parser.ParsedFrame frame = parser.parse(byteBuffer);
Frame.Parsed frame = parser.parse(byteBuffer);
if (!byteBuffer.hasRemaining())
BufferUtil.clear(byteBuffer);
if (frame != null)

View File

@ -23,8 +23,8 @@ import org.eclipse.jetty.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.Frame;
import org.eclipse.jetty.websocket.core.OpCode;
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.internal.WebSocketCoreSession;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

View File

@ -19,12 +19,12 @@ import java.util.List;
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.ExtensionStack;
import org.eclipse.jetty.websocket.core.IncomingFrames;
import org.eclipse.jetty.websocket.core.IncomingFramesCapture;
import org.eclipse.jetty.websocket.core.OutgoingFrames;
import org.eclipse.jetty.websocket.core.OutgoingFramesCapture;
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.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

View File

@ -22,19 +22,19 @@ import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.toolchain.test.ByteBufferAssert;
import org.eclipse.jetty.util.BufferUtil;
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.Extension;
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.IncomingFramesCapture;
import org.eclipse.jetty.websocket.core.Negotiated;
import org.eclipse.jetty.websocket.core.OpCode;
import org.eclipse.jetty.websocket.core.TestMessageHandler;
import org.eclipse.jetty.websocket.core.WebSocketComponents;
import org.eclipse.jetty.websocket.core.internal.ExtensionStack;
import org.eclipse.jetty.websocket.core.internal.Negotiated;
import org.eclipse.jetty.websocket.core.WebSocketCoreSession;
import org.eclipse.jetty.websocket.core.internal.Parser;
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Assertions;
@ -87,7 +87,7 @@ public class ExtensionTool
for (int i = 0; i < parts; i++)
{
String hex = rawhex[i].replaceAll("\\s*(0x)?", "");
net = TypeUtil.fromHexString(hex);
net = StringUtil.fromHexString(hex);
ByteBuffer buffer = ByteBuffer.wrap(net);
while (BufferUtil.hasContent(buffer))

View File

@ -29,15 +29,15 @@ import org.eclipse.jetty.websocket.core.Behavior;
import org.eclipse.jetty.websocket.core.Configuration;
import org.eclipse.jetty.websocket.core.DemandingIncomingFramesCapture;
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.IncomingFramesCapture;
import org.eclipse.jetty.websocket.core.Negotiated;
import org.eclipse.jetty.websocket.core.OpCode;
import org.eclipse.jetty.websocket.core.OutgoingFramesCapture;
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.Negotiated;
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;

View File

@ -24,21 +24,21 @@ import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.toolchain.test.ByteBufferAssert;
import org.eclipse.jetty.util.BufferUtil;
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.Configuration.ConfigurationCustomizer;
import org.eclipse.jetty.websocket.core.DemandingIncomingFramesCapture;
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.IncomingFramesCapture;
import org.eclipse.jetty.websocket.core.Negotiated;
import org.eclipse.jetty.websocket.core.OpCode;
import org.eclipse.jetty.websocket.core.OutgoingFramesCapture;
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.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.WebSocketCoreSession;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -60,7 +60,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
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));
}

View File

@ -250,7 +250,7 @@ public class FrameFlusherTest
{
for (ByteBuffer buffer : buffers)
{
Parser.ParsedFrame frame = parser.parse(buffer);
Frame.Parsed frame = parser.parse(buffer);
if (frame != null)
{
incomingFrames.offer(frame);

View File

@ -39,9 +39,9 @@ import org.eclipse.jetty.websocket.core.FrameHandler;
import org.eclipse.jetty.websocket.core.OpCode;
import org.eclipse.jetty.websocket.core.TestAsyncFrameHandler;
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.WebSocketCoreClient;
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
import org.eclipse.jetty.websocket.core.server.ServerUpgradeRequest;
import org.eclipse.jetty.websocket.core.server.ServerUpgradeResponse;
import org.eclipse.jetty.websocket.core.server.WebSocketNegotiator;

View File

@ -26,7 +26,7 @@ import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.websocket.core.Frame;
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.Test;

View File

@ -27,7 +27,7 @@ import org.eclipse.jetty.util.Utf8StringBuilder;
import org.eclipse.jetty.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.Frame;
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 static org.hamcrest.MatcherAssert.assertThat;

View File

@ -29,7 +29,7 @@ import org.eclipse.jetty.util.Utf8Appendable;
import org.eclipse.jetty.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.Frame;
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.Test;

View File

@ -27,7 +27,7 @@ import org.eclipse.jetty.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.Frame;
import org.eclipse.jetty.websocket.core.OpCode;
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 static org.hamcrest.MatcherAssert.assertThat;

View File

@ -43,8 +43,8 @@ import jakarta.websocket.server.ServerEndpointConfig;
import org.eclipse.jetty.ee10.cdi.CdiDecoratingListener;
import org.eclipse.jetty.ee10.cdi.CdiServletContainerInitializer;
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.internal.JakartaWebSocketClientContainer;
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.server.Server;

View File

@ -13,20 +13,17 @@
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 transitive jakarta.websocket;
requires transitive org.eclipse.jetty.client;
requires transitive org.eclipse.jetty.ee10.websocket.jakarta.common;
requires static jakarta.servlet;
requires static jakarta.servlet;
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
org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainerProvider;
provides jakarta.servlet.ServletContainerInitializer with
org.eclipse.jetty.ee10.websocket.jakarta.client.internal.JakartaWebSocketShutdownContainer;
}

View File

@ -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.net.URI;
@ -33,6 +33,10 @@ import jakarta.websocket.EndpointConfig;
import jakarta.websocket.Extension;
import jakarta.websocket.Session;
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.JakartaWebSocketContainer;
import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketExtensionConfig;

View File

@ -16,7 +16,6 @@ package org.eclipse.jetty.ee10.websocket.jakarta.client;
import jakarta.websocket.ContainerProvider;
import jakarta.websocket.WebSocketContainer;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.ee10.websocket.jakarta.client.internal.JakartaWebSocketClientContainer;
import org.eclipse.jetty.util.component.LifeCycle;
/**

View File

@ -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.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.JakartaWebSocketFrameHandlerFactory;
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
{

View File

@ -16,6 +16,7 @@ package org.eclipse.jetty.ee10.websocket.jakarta.client.internal;
import java.net.URI;
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.UpgradeRequest;
import org.eclipse.jetty.websocket.core.FrameHandler;

View File

@ -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;
@ -20,7 +20,7 @@ import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener;
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.LifeCycle;
import org.slf4j.Logger;

View File

@ -1 +1 @@
org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketShutdownContainer
org.eclipse.jetty.ee10.websocket.jakarta.client.internal.JakartaWebSocketShutdownContainer

View File

@ -26,9 +26,9 @@ import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.Frame;
import org.eclipse.jetty.websocket.core.OpCode;
import org.eclipse.jetty.websocket.core.internal.messages.MessageOutputStream;
import org.eclipse.jetty.websocket.core.internal.messages.MessageWriter;
import org.eclipse.jetty.websocket.core.internal.util.TextUtils;
import org.eclipse.jetty.websocket.core.messages.MessageOutputStream;
import org.eclipse.jetty.websocket.core.messages.MessageWriter;
import org.eclipse.jetty.websocket.core.util.TextUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -25,7 +25,7 @@ import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.Frame;
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.LoggerFactory;

View File

@ -46,11 +46,11 @@ import org.eclipse.jetty.websocket.core.FrameHandler;
import org.eclipse.jetty.websocket.core.OpCode;
import org.eclipse.jetty.websocket.core.exception.ProtocolException;
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
import org.eclipse.jetty.websocket.core.internal.messages.MessageSink;
import org.eclipse.jetty.websocket.core.internal.messages.PartialByteArrayMessageSink;
import org.eclipse.jetty.websocket.core.internal.messages.PartialByteBufferMessageSink;
import org.eclipse.jetty.websocket.core.internal.messages.PartialStringMessageSink;
import org.eclipse.jetty.websocket.core.internal.util.InvokerUtils;
import org.eclipse.jetty.websocket.core.messages.MessageSink;
import org.eclipse.jetty.websocket.core.messages.PartialByteArrayMessageSink;
import org.eclipse.jetty.websocket.core.messages.PartialByteBufferMessageSink;
import org.eclipse.jetty.websocket.core.messages.PartialStringMessageSink;
import org.eclipse.jetty.websocket.core.util.InvokerUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -47,12 +47,12 @@ import org.eclipse.jetty.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.WebSocketComponents;
import org.eclipse.jetty.websocket.core.exception.InvalidSignatureException;
import org.eclipse.jetty.websocket.core.exception.InvalidWebSocketException;
import org.eclipse.jetty.websocket.core.internal.messages.MessageSink;
import org.eclipse.jetty.websocket.core.internal.messages.PartialByteArrayMessageSink;
import org.eclipse.jetty.websocket.core.internal.messages.PartialByteBufferMessageSink;
import org.eclipse.jetty.websocket.core.internal.messages.PartialStringMessageSink;
import org.eclipse.jetty.websocket.core.internal.util.InvokerUtils;
import org.eclipse.jetty.websocket.core.internal.util.ReflectUtils;
import org.eclipse.jetty.websocket.core.messages.MessageSink;
import org.eclipse.jetty.websocket.core.messages.PartialByteArrayMessageSink;
import org.eclipse.jetty.websocket.core.messages.PartialByteBufferMessageSink;
import org.eclipse.jetty.websocket.core.messages.PartialStringMessageSink;
import org.eclipse.jetty.websocket.core.util.InvokerUtils;
import org.eclipse.jetty.websocket.core.util.ReflectUtils;
public abstract class JakartaWebSocketFrameHandlerFactory
{

View File

@ -17,7 +17,7 @@ import java.lang.invoke.MethodHandle;
import java.util.List;
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
{

View File

@ -28,8 +28,8 @@ import org.eclipse.jetty.websocket.core.Frame;
import org.eclipse.jetty.websocket.core.OpCode;
import org.eclipse.jetty.websocket.core.OutgoingFrames;
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
import org.eclipse.jetty.websocket.core.internal.messages.MessageOutputStream;
import org.eclipse.jetty.websocket.core.internal.messages.MessageWriter;
import org.eclipse.jetty.websocket.core.messages.MessageOutputStream;
import org.eclipse.jetty.websocket.core.messages.MessageWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -38,7 +38,7 @@ import org.eclipse.jetty.ee10.websocket.jakarta.common.encoders.AvailableEncoder
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.websocket.core.CoreSession;
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.LoggerFactory;

View File

@ -29,7 +29,7 @@ import jakarta.websocket.EndpointConfig;
import org.eclipse.jetty.websocket.core.WebSocketComponents;
import org.eclipse.jetty.websocket.core.exception.InvalidSignatureException;
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
{

View File

@ -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.exception.InvalidSignatureException;
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.LoggerFactory;

View File

@ -24,7 +24,7 @@ import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.Frame;
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.LoggerFactory;

View File

@ -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.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.exception.CloseException;
import org.eclipse.jetty.websocket.core.internal.messages.ByteBufferMessageSink;
import org.eclipse.jetty.websocket.core.internal.messages.MessageSink;
import org.eclipse.jetty.websocket.core.messages.ByteBufferMessageSink;
import org.eclipse.jetty.websocket.core.messages.MessageSink;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -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.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.exception.CloseException;
import org.eclipse.jetty.websocket.core.internal.messages.InputStreamMessageSink;
import org.eclipse.jetty.websocket.core.internal.messages.MessageSink;
import org.eclipse.jetty.websocket.core.messages.InputStreamMessageSink;
import org.eclipse.jetty.websocket.core.messages.MessageSink;
public class DecodedBinaryStreamMessageSink<T> extends AbstractDecodedMessageSink.Stream<Decoder.BinaryStream<T>>
{

View File

@ -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.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.exception.CloseException;
import org.eclipse.jetty.websocket.core.internal.messages.MessageSink;
import org.eclipse.jetty.websocket.core.internal.messages.StringMessageSink;
import org.eclipse.jetty.websocket.core.messages.MessageSink;
import org.eclipse.jetty.websocket.core.messages.StringMessageSink;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -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.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.exception.CloseException;
import org.eclipse.jetty.websocket.core.internal.messages.MessageSink;
import org.eclipse.jetty.websocket.core.internal.messages.ReaderMessageSink;
import org.eclipse.jetty.websocket.core.messages.MessageSink;
import org.eclipse.jetty.websocket.core.messages.ReaderMessageSink;
public class DecodedTextStreamMessageSink<T> extends AbstractDecodedMessageSink.Stream<Decoder.TextStream<T>>
{

View File

@ -16,7 +16,7 @@ package org.eclipse.jetty.ee10.websocket.jakarta.common;
import jakarta.websocket.ClientEndpoint;
import jakarta.websocket.ClientEndpointConfig;
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
{

View File

@ -32,7 +32,7 @@ import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.websocket.core.Frame;
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 static java.nio.charset.StandardCharsets.UTF_8;

View File

@ -26,7 +26,7 @@ import org.eclipse.jetty.util.Utf8StringBuilder;
import org.eclipse.jetty.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.Frame;
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 static org.hamcrest.MatcherAssert.assertThat;

View File

@ -27,7 +27,7 @@ import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.websocket.core.Frame;
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 static org.hamcrest.MatcherAssert.assertThat;

View File

@ -22,8 +22,8 @@ import java.util.Map;
import jakarta.websocket.Session;
import org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketFrameHandlerFactory;
import org.eclipse.jetty.util.annotation.Name;
import org.eclipse.jetty.websocket.core.internal.util.InvokerUtils;
import org.eclipse.jetty.websocket.core.internal.util.ReflectUtils;
import org.eclipse.jetty.websocket.core.util.InvokerUtils;
import org.eclipse.jetty.websocket.core.util.ReflectUtils;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;

View File

@ -19,8 +19,8 @@ import java.lang.invoke.MethodHandles;
import java.lang.reflect.Method;
import org.eclipse.jetty.util.annotation.Name;
import org.eclipse.jetty.websocket.core.internal.util.InvokerUtils;
import org.eclipse.jetty.websocket.core.internal.util.ReflectUtils;
import org.eclipse.jetty.websocket.core.util.InvokerUtils;
import org.eclipse.jetty.websocket.core.util.ReflectUtils;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;

View File

@ -17,7 +17,7 @@ import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
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}

View File

@ -13,7 +13,7 @@
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 static org.hamcrest.MatcherAssert.assertThat;

View File

@ -14,7 +14,6 @@
module org.eclipse.jetty.ee10.websocket.jakarta.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.slf4j;

View File

@ -35,6 +35,6 @@ public class JakartaWebSocketConfiguration extends AbstractConfiguration
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.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