Remove ineffective JettyByteBufferIterator from WebSocket adapter
In JettyWebSocketHandlerAdapter, JettyByteBufferIterator does not actually add extra behavior (in contrast to JettyClientHttpConnector).
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -153,7 +153,6 @@ public class JettyClientHttpConnector implements ClientHttpConnector {
|
|||||||
|
|
||||||
private final AtomicInteger refCount = new AtomicInteger(1);
|
private final AtomicInteger refCount = new AtomicInteger(1);
|
||||||
|
|
||||||
|
|
||||||
public JettyDataBuffer(DataBuffer delegate, Content.Chunk chunk) {
|
public JettyDataBuffer(DataBuffer delegate, Content.Chunk chunk) {
|
||||||
Assert.notNull(delegate, "Delegate must not be null");
|
Assert.notNull(delegate, "Delegate must not be null");
|
||||||
Assert.notNull(chunk, "Chunk must not be null");
|
Assert.notNull(chunk, "Chunk must not be null");
|
||||||
@@ -390,7 +389,6 @@ public class JettyClientHttpConnector implements ClientHttpConnector {
|
|||||||
|
|
||||||
private final Content.Chunk chunk;
|
private final Content.Chunk chunk;
|
||||||
|
|
||||||
|
|
||||||
public JettyByteBufferIterator(ByteBufferIterator delegate, Content.Chunk chunk) {
|
public JettyByteBufferIterator(ByteBufferIterator delegate, Content.Chunk chunk) {
|
||||||
Assert.notNull(delegate, "Delegate must not be null");
|
Assert.notNull(delegate, "Delegate must not be null");
|
||||||
Assert.notNull(chunk, "Chunk must not be null");
|
Assert.notNull(chunk, "Chunk must not be null");
|
||||||
@@ -400,7 +398,6 @@ public class JettyClientHttpConnector implements ClientHttpConnector {
|
|||||||
this.chunk.retain();
|
this.chunk.retain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
this.delegate.close();
|
this.delegate.close();
|
||||||
|
|||||||
@@ -306,48 +306,18 @@ public class JettyWebSocketHandlerAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ByteBufferIterator readableByteBuffers() {
|
public ByteBufferIterator readableByteBuffers() {
|
||||||
ByteBufferIterator delegateIterator = this.delegate.readableByteBuffers();
|
return this.delegate.readableByteBuffers();
|
||||||
return new JettyByteBufferIterator(delegateIterator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ByteBufferIterator writableByteBuffers() {
|
public ByteBufferIterator writableByteBuffers() {
|
||||||
ByteBufferIterator delegateIterator = this.delegate.writableByteBuffers();
|
return this.delegate.writableByteBuffers();
|
||||||
return new JettyByteBufferIterator(delegateIterator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(int index, int length, Charset charset) {
|
public String toString(int index, int length, Charset charset) {
|
||||||
return this.delegate.toString(index, length, charset);
|
return this.delegate.toString(index, length, charset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static class JettyByteBufferIterator implements ByteBufferIterator {
|
|
||||||
|
|
||||||
private final ByteBufferIterator delegate;
|
|
||||||
|
|
||||||
|
|
||||||
JettyByteBufferIterator(ByteBufferIterator delegate) {
|
|
||||||
Assert.notNull(delegate, "Delegate must not be null");
|
|
||||||
|
|
||||||
this.delegate = delegate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close() {
|
|
||||||
this.delegate.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasNext() {
|
|
||||||
return this.delegate.hasNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ByteBuffer next() {
|
|
||||||
return this.delegate.next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user