diff --git a/changes.md b/changes.md
index 0fad9e8daf..8aaccc1480 100644
--- a/changes.md
+++ b/changes.md
@@ -21,6 +21,8 @@ Changes log
- Renamed extension Inject into Guice as it isn't truly generic.
- Updated the links in all Javadocs file for accuracy.
- Deprecated GAE, GWT, OSGi and RDF extensions for removal in next major release.
+ - Deprecated NIO flavor of Restlet API for removal in next major release, with plan to use
+ virtual threads instead to achieve additional scalability and reactive behavior.
- Removed code deprecated in version 2.4, including native Restlet XML configuration mechasism.
Please use Spring for an alternative approach if needed.
diff --git a/org.restlet.java/org.restlet.ext.httpclient/src/main/java/org/restlet/ext/httpclient/internal/HttpMethodCall.java b/org.restlet.java/org.restlet.ext.httpclient/src/main/java/org/restlet/ext/httpclient/internal/HttpMethodCall.java
index e4f5d79cf8..ade03643c0 100644
--- a/org.restlet.java/org.restlet.ext.httpclient/src/main/java/org/restlet/ext/httpclient/internal/HttpMethodCall.java
+++ b/org.restlet.java/org.restlet.ext.httpclient/src/main/java/org/restlet/ext/httpclient/internal/HttpMethodCall.java
@@ -165,6 +165,7 @@ public String getReasonPhrase() {
}
@Override
+ @Deprecated
public WritableByteChannel getRequestEntityChannel() {
return null;
}
@@ -180,6 +181,7 @@ public OutputStream getRequestHeadStream() {
}
@Override
+ @Deprecated
public ReadableByteChannel getResponseEntityChannel(long size) {
return null;
}
diff --git a/org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyClientCall.java b/org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyClientCall.java
index 9f3dd8cd2d..ee5cb68455 100644
--- a/org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyClientCall.java
+++ b/org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyClientCall.java
@@ -136,6 +136,7 @@ public String getReasonPhrase() {
return httpResponse == null ? null : httpResponse.getReason();
}
+ @Deprecated
public WritableByteChannel getRequestEntityChannel() {
return null;
}
@@ -148,6 +149,7 @@ public OutputStream getRequestHeadStream() {
return null;
}
+ @Deprecated
public ReadableByteChannel getResponseEntityChannel(long size) {
return null;
}
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/Call.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/Call.java
index a37632c6c7..5ce6e4b447 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/Call.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/Call.java
@@ -222,7 +222,9 @@ protected Representation getRepresentation(InputStream stream) {
*
* @param channel The response channel.
* @return The wrapping representation.
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
protected Representation getRepresentation(java.nio.channels.ReadableByteChannel channel) {
return new org.restlet.representation.ReadableRepresentation(channel, null);
}
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/ClientCall.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/ClientCall.java
index 0c2ee34256..71839c2359 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/ClientCall.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/ClientCall.java
@@ -93,7 +93,9 @@ public HttpClientHelper getHelper() {
* Returns the request entity channel if it exists.
*
* @return The request entity channel if it exists.
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
public abstract java.nio.channels.WritableByteChannel getRequestEntityChannel();
/**
@@ -165,7 +167,9 @@ public Representation getResponseEntity(Response response) {
*
* @param size The expected entity size or -1 if unknown.
* @return The response channel if it exists.
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
public abstract java.nio.channels.ReadableByteChannel getResponseEntityChannel(long size);
/**
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/DecodeRepresentation.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/DecodeRepresentation.java
index 4a127bda20..f860777124 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/DecodeRepresentation.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/DecodeRepresentation.java
@@ -75,7 +75,9 @@ public long getAvailableSize() {
* instance of FileChannel is returned.
*
* @return A readable byte channel.
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
@Override
public ReadableByteChannel getChannel() throws IOException {
if (isDecoding()) {
@@ -227,7 +229,9 @@ public void write(OutputStream outputStream) throws IOException {
* Writes the representation to a byte channel.
*
* @param writableChannel A writable byte channel.
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
@Override
public void write(WritableByteChannel writableChannel) throws IOException {
if (isDecoding()) {
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/EncodeRepresentation.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/EncodeRepresentation.java
index a207385f38..a19defdf5a 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/EncodeRepresentation.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/EncodeRepresentation.java
@@ -105,7 +105,9 @@ public long getAvailableSize() {
* instance of FileChannel is returned.
*
* @return A readable byte channel.
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
@Override
public ReadableByteChannel getChannel() throws IOException {
if (canEncode()) {
@@ -270,6 +272,7 @@ public void write(OutputStream outputStream) throws IOException {
}
}
+ @Deprecated
@Override
public void write(WritableByteChannel writableChannel) throws IOException {
if (canEncode()) {
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/RangeRepresentation.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/RangeRepresentation.java
index dbff88aa85..30e38f3b19 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/RangeRepresentation.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/RangeRepresentation.java
@@ -63,6 +63,7 @@ public long getAvailableSize() {
}
@Override
+ @Deprecated
public java.nio.channels.ReadableByteChannel getChannel() throws IOException {
return IoUtils.getChannel(getStream());
}
@@ -117,6 +118,7 @@ public void write(OutputStream outputStream) throws IOException {
}
@Override
+ @Deprecated
public void write(WritableByteChannel writableChannel) throws IOException {
OutputStream os = IoUtils.getStream(writableChannel);
write(os);
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/HttpUrlConnectionCall.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/HttpUrlConnectionCall.java
index f05086e692..e9ac41fb8c 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/HttpUrlConnectionCall.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/HttpUrlConnectionCall.java
@@ -143,6 +143,7 @@ protected Representation getRepresentation(InputStream stream) {
}
@Override
+ @Deprecated
public WritableByteChannel getRequestEntityChannel() {
return null;
}
@@ -171,6 +172,7 @@ public OutputStream getRequestStream() {
}
@Override
+ @Deprecated
public ReadableByteChannel getResponseEntityChannel(long size) {
return null;
}
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/BlockableChannel.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/BlockableChannel.java
index f8d9d1fbef..9f95ae98cf 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/BlockableChannel.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/BlockableChannel.java
@@ -15,7 +15,9 @@
* NIO channel that can indicate if it is blocking or non blocking.
*
* @author Jerome Louvel
+ * @deprecated NIO will be removed in next major release.
*/
+@Deprecated
public interface BlockableChannel extends Channel {
/**
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/InputStreamChannel.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/InputStreamChannel.java
index 0be4b04621..d254827485 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/InputStreamChannel.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/InputStreamChannel.java
@@ -18,7 +18,9 @@
* Readable byte channel wrapping an input stream.
*
* @author Jerome Louvel
+ * @deprecated NIO will be removed in next major release.
*/
+@Deprecated
public class InputStreamChannel implements ReadableByteChannel, BlockableChannel {
/** The underlying input stream. */
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/IoUtils.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/IoUtils.java
index 76c969cde9..98a5a84523 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/IoUtils.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/IoUtils.java
@@ -115,7 +115,9 @@ public static void copy(InputStream inputStream, java.io.RandomAccessFile random
* @param readableChannel The readable channel.
* @param writableChannel The writable channel.
* @throws IOException
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
public static void copy(ReadableByteChannel readableChannel, WritableByteChannel writableChannel)
throws IOException {
if ((readableChannel != null) && (writableChannel != null)) {
@@ -276,7 +278,9 @@ public static long getAvailableSize(Representation representation) {
*
* @param inputStream The input stream to convert.
* @return A readable byte channel.
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
public static ReadableByteChannel getChannel(InputStream inputStream) throws IOException {
ReadableByteChannel result = null;
@@ -294,7 +298,9 @@ public static ReadableByteChannel getChannel(InputStream inputStream) throws IOE
*
* @param outputStream The output stream.
* @return A writable byte channel.
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
public static WritableByteChannel getChannel(OutputStream outputStream) {
return (outputStream != null) ? Channels.newChannel(outputStream) : null;
}
@@ -308,7 +314,9 @@ public static WritableByteChannel getChannel(OutputStream outputStream) {
* from.
* @return A readable byte channel.
* @throws IOException
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
public static ReadableByteChannel getChannel(final Representation representation) throws IOException {
ReadableByteChannel result = null;
@@ -443,7 +451,9 @@ public static java.io.OutputStream getStream(java.io.Writer writer, CharacterSet
*
* @param readableChannel The readable byte channel.
* @return An input stream based on a given readable byte channel.
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
public static InputStream getStream(ReadableByteChannel readableChannel) {
InputStream result = null;
@@ -531,7 +541,9 @@ public void run() {
*
* @param writableChannel The writable byte channel.
* @return An output stream based on a given writable byte channel.
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
public static OutputStream getStream(WritableByteChannel writableChannel) {
OutputStream result = null;
@@ -613,7 +625,9 @@ public static boolean isBlocking(Channel channel) {
* @param selector The associated selector.
* @param selectionKey The used selection key.
* @throws IOException
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
public static void release(Selector selector, SelectionKey selectionKey) throws IOException {
if (selectionKey != null) {
// The key you registered on the temporary selector
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/NbChannelInputStream.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/NbChannelInputStream.java
index fbbbfe86e0..b090126332 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/NbChannelInputStream.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/NbChannelInputStream.java
@@ -26,7 +26,9 @@
* Input stream connected to a non-blocking readable channel.
*
* @author Jerome Louvel
+ * @deprecated NIO will be removed in next major release.
*/
+@Deprecated
public class NbChannelInputStream extends InputStream {
/** The internal byte buffer. */
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/NbChannelOutputStream.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/NbChannelOutputStream.java
index 760dae2469..8965541f04 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/NbChannelOutputStream.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/NbChannelOutputStream.java
@@ -22,7 +22,9 @@
* Output stream connected to a non-blocking writable channel.
*
* @author Jerome Louvel
+ * @deprecated NIO will be removed in next major release.
*/
+@Deprecated
public class NbChannelOutputStream extends OutputStream {
/** The internal byte buffer. */
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/ReadableSelectionChannel.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/ReadableSelectionChannel.java
index 4af5606651..123bf56a6d 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/ReadableSelectionChannel.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/ReadableSelectionChannel.java
@@ -15,7 +15,9 @@
* Readable byte channel that is based on a selectable channel.
*
* @author Jerome Louvel
+ * @deprecated NIO will be removed in next major release.
*/
+@Deprecated
public interface ReadableSelectionChannel extends SelectionChannel, ReadableByteChannel {
}
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/SelectionChannel.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/SelectionChannel.java
index f1341f2999..0bb6a7bb6e 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/SelectionChannel.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/SelectionChannel.java
@@ -17,7 +17,9 @@
* NIO channel that is based on a selectable channel.
*
* @author Jerome Louvel
+ * @deprecated NIO will be removed in next major release.
*/
+@Deprecated
public interface SelectionChannel extends Channel, BlockableChannel {
/**
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/SelectorFactory.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/SelectorFactory.java
index 8daa9f0476..6267ce17fe 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/SelectorFactory.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/SelectorFactory.java
@@ -18,7 +18,9 @@
* Factory used to dispatch/share Selector
.
*
* @author Jean-Francois Arcand
+ * @deprecated NIO will be removed in next major release.
*/
+@Deprecated
public class SelectorFactory {
/** The maximum number of Selector
to create. */
public static final int MAX_SELECTORS = 20;
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/WakeupListener.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/WakeupListener.java
index e51c95cf85..6a005e52f2 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/WakeupListener.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/WakeupListener.java
@@ -17,7 +17,9 @@
* Callback interface when a NIO selection occurs on the selectable object.
*
* @author Jerome Louvel
+ * @deprecated NIO will be removed in next major release.
*/
+@Deprecated
public interface WakeupListener {
/**
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/BufferingRepresentation.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/BufferingRepresentation.java
index a8d3510812..80fe07fb36 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/BufferingRepresentation.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/BufferingRepresentation.java
@@ -85,6 +85,7 @@ protected byte[] getBuffer() {
}
@Override
+ @Deprecated
public java.nio.channels.ReadableByteChannel getChannel() throws IOException {
return IoUtils.getChannel(getStream());
}
@@ -172,6 +173,7 @@ public void write(OutputStream outputStream) throws IOException {
}
@Override
+ @Deprecated
public void write(WritableByteChannel writableChannel) throws IOException {
buffer();
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/ChannelRepresentation.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/ChannelRepresentation.java
index e0dd42acf4..6ba9acb720 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/ChannelRepresentation.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/ChannelRepresentation.java
@@ -23,7 +23,9 @@
* Representation based on a NIO byte channel.
*
* @author Jerome Louvel
+ * @deprecated NIO will be removed in next major release.
*/
+@Deprecated
public abstract class ChannelRepresentation extends Representation {
/**
* Constructor.
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/CharacterRepresentation.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/CharacterRepresentation.java
index 07679ba136..ee702e8d37 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/CharacterRepresentation.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/CharacterRepresentation.java
@@ -35,6 +35,7 @@ public CharacterRepresentation(MediaType mediaType) {
}
@Override
+ @Deprecated
public java.nio.channels.ReadableByteChannel getChannel() throws IOException {
return IoUtils.getChannel(getStream());
}
@@ -52,6 +53,7 @@ public void write(OutputStream outputStream) throws IOException {
}
@Override
+ @Deprecated
public void write(java.nio.channels.WritableByteChannel writableChannel) throws IOException {
OutputStream os = IoUtils.getStream(writableChannel);
write(os);
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/DigesterRepresentation.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/DigesterRepresentation.java
index f7de8eeb73..b6a45d6c69 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/DigesterRepresentation.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/DigesterRepresentation.java
@@ -181,6 +181,7 @@ public long exhaust() throws IOException {
}
@Override
+ @Deprecated
public ReadableByteChannel getChannel() throws IOException {
return IoUtils.getChannel(getStream());
}
@@ -245,6 +246,7 @@ public void write(OutputStream outputStream) throws IOException {
}
@Override
+ @Deprecated
public void write(WritableByteChannel writableChannel) throws IOException {
OutputStream os = IoUtils.getStream(writableChannel);
write(os);
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/EmptyRepresentation.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/EmptyRepresentation.java
index ac7bc85b29..acd803cc8d 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/EmptyRepresentation.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/EmptyRepresentation.java
@@ -33,6 +33,7 @@ public EmptyRepresentation() {
}
@Override
+ @Deprecated
public java.nio.channels.ReadableByteChannel getChannel() throws IOException {
return null;
}
@@ -58,6 +59,7 @@ public void write(java.io.Writer writer) throws IOException {
}
@Override
+ @Deprecated
public void write(java.nio.channels.WritableByteChannel writableChannel) throws IOException {
// Do nothing
}
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/FileRepresentation.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/FileRepresentation.java
index 4f7c48375a..c2e46087c9 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/FileRepresentation.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/FileRepresentation.java
@@ -130,6 +130,7 @@ public FileRepresentation(String path, MediaType mediaType, int timeToLive) {
* @return A readable byte channel.
*/
@Override
+ @Deprecated
public FileChannel getChannel() throws IOException {
try {
return new FileInputStream(this.file).getChannel();
@@ -238,6 +239,7 @@ public void write(OutputStream outputStream) throws IOException {
* @param writableChannel A writable byte channel.
*/
@Override
+ @Deprecated
public void write(WritableByteChannel writableChannel) throws IOException {
IoUtils.copy(getChannel(), writableChannel);
}
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/OutputRepresentation.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/OutputRepresentation.java
index 09cdb1f6a7..ed4c675b0d 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/OutputRepresentation.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/OutputRepresentation.java
@@ -49,6 +49,7 @@ public OutputRepresentation(MediaType mediaType, long expectedSize) {
}
@Override
+ @Deprecated
public ReadableByteChannel getChannel() throws IOException {
return IoUtils.getChannel(this);
}
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/ReadableRepresentation.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/ReadableRepresentation.java
index ebf63c848e..f187fa81a6 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/ReadableRepresentation.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/ReadableRepresentation.java
@@ -20,7 +20,9 @@
* Transient representation based on a readable NIO byte channel.
*
* @author Jerome Louvel
+ * @deprecated NIO will be removed in next major release.
*/
+@Deprecated
public class ReadableRepresentation extends ChannelRepresentation {
/** The representation's input stream. */
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/Representation.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/Representation.java
index 689670ac9a..007371ffb9 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/Representation.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/Representation.java
@@ -232,7 +232,9 @@ public long getAvailableSize() {
*
* @return A channel with the representation's content.
* @throws IOException
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
public abstract java.nio.channels.ReadableByteChannel getChannel() throws IOException;
/**
@@ -302,7 +304,9 @@ public Range getRange() {
* @return The NIO registration.
* @throws IOException
* @see #isSelectable()
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
public org.restlet.util.SelectionRegistration getRegistration() throws IOException {
if (isSelectable()) {
return ((org.restlet.engine.io.SelectionChannel) getChannel()).getRegistration();
@@ -402,7 +406,9 @@ public boolean isEmpty() {
* content is ready for reading.
*
* @return True if the representation content supports NIO selection.
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
public boolean isSelectable() {
try {
return getChannel() instanceof org.restlet.engine.io.SelectionChannel;
@@ -498,7 +504,9 @@ public void setExpirationDate(Date expirationDate) {
* existing listener.
*
* @param readingListener The listener for NIO read events.
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
public void setListener(org.restlet.util.ReadingListener readingListener) {
try {
org.restlet.util.SelectionRegistration sr = getRegistration();
@@ -571,7 +579,9 @@ public void setTransient(boolean isTransient) {
*
* @param writableChannel A writable byte channel.
* @throws IOException
+ * @deprecated NIO will be removed in next major release.
*/
+ @Deprecated
public abstract void write(java.nio.channels.WritableByteChannel writableChannel) throws IOException;
/**
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/StreamRepresentation.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/StreamRepresentation.java
index a5f51564a7..ca0a4fbb9e 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/StreamRepresentation.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/StreamRepresentation.java
@@ -33,6 +33,7 @@ public StreamRepresentation(MediaType mediaType) {
}
@Override
+ @Deprecated
public java.nio.channels.ReadableByteChannel getChannel() throws IOException {
return IoUtils.getChannel(getStream());
}
@@ -43,6 +44,7 @@ public Reader getReader() throws IOException {
}
@Override
+ @Deprecated
public void write(java.nio.channels.WritableByteChannel writableChannel) throws IOException {
OutputStream os = IoUtils.getStream(writableChannel);
write(os);
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/WritableRepresentation.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/WritableRepresentation.java
index a2c6c4a039..5cc895df93 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/WritableRepresentation.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/WritableRepresentation.java
@@ -27,7 +27,9 @@
* needed.
*
* @author Jerome Louvel
+ * @deprecated NIO will be removed in next major release.
*/
+@Deprecated
public abstract class WritableRepresentation extends ChannelRepresentation {
/**
* Constructor.
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/ByteReadingListener.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/util/ByteReadingListener.java
index 1be0c53c47..2766e254fb 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/ByteReadingListener.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/util/ByteReadingListener.java
@@ -21,7 +21,9 @@
* Selection listener notifying new content as an {@link InputStream}.
*
* @author Jerome Louvel
+ * @deprecated NIO will be removed in next major release.
*/
+@Deprecated
public abstract class ByteReadingListener extends ReadingListener {
/**
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/ReadingListener.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/util/ReadingListener.java
index e234bfb7a8..a1afa8e254 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/ReadingListener.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/util/ReadingListener.java
@@ -22,7 +22,9 @@
* Selection listener notifying new content is read into a {@link ByteBuffer}.
*
* @author Jerome Louvel
+ * @deprecated NIO will be removed in next major release.
*/
+@Deprecated
public abstract class ReadingListener implements SelectionListener {
/** The internal byte buffer. */
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/SelectionListener.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/util/SelectionListener.java
index 8e2101a810..cfdc9d0d0a 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/SelectionListener.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/util/SelectionListener.java
@@ -15,7 +15,9 @@
* Callback interface when a NIO selection occurs on the selectable object.
*
* @author Jerome Louvel
+ * @deprecated NIO will be removed in next major release.
*/
+@Deprecated
public interface SelectionListener {
/**
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/SelectionRegistration.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/util/SelectionRegistration.java
index 3e80880f05..c36eb7d2dd 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/SelectionRegistration.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/util/SelectionRegistration.java
@@ -30,7 +30,9 @@
*
* @author Jerome Louvel
* @see SelectionKey
+ * @deprecated NIO will be removed in next major release.
*/
+@Deprecated
public class SelectionRegistration {
/**
diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/WrapperRepresentation.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/util/WrapperRepresentation.java
index 193072457e..02777efb7f 100644
--- a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/WrapperRepresentation.java
+++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/util/WrapperRepresentation.java
@@ -56,6 +56,7 @@ public long getAvailableSize() {
}
@Override
+ @Deprecated
public java.nio.channels.ReadableByteChannel getChannel() throws IOException {
return getWrappedRepresentation().getChannel();
}
@@ -150,6 +151,7 @@ public boolean isAvailable() {
}
@Override
+ @Deprecated
public boolean isSelectable() {
return getWrappedRepresentation().isSelectable();
}
@@ -160,6 +162,7 @@ public boolean isTransient() {
}
@Override
+ @Deprecated
public org.restlet.util.SelectionRegistration getRegistration() throws IOException {
return getWrappedRepresentation().getRegistration();
}
@@ -255,6 +258,7 @@ public void write(java.io.Writer writer) throws IOException {
}
@Override
+ @Deprecated
public void write(java.nio.channels.WritableByteChannel writableChannel) throws IOException {
getWrappedRepresentation().write(writableChannel);
}