You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "kwin (via GitHub)" <gi...@apache.org> on 2026/01/13 18:17:12 UTC

[PR] Update to Jetty 12.1 [maven-resolver]

kwin opened a new pull request, #1748:
URL: https://github.com/apache/maven-resolver/pull/1748

   This affects both Server used for Tests and Jetty Transport (for HTTP) This increases Java requirements to 17 for Jetty Transport
   
   Following this checklist to help us incorporate your
   contribution quickly and easily:
   
   - [ ] Your pull request should address just one issue, without pulling in other changes.
   - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [ ] Each commit in the pull request should have a meaningful subject line and body.
     Note that commits might be squashed by a maintainer on merge.
   - [ ] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
     This may not always be possible but is a best-practice.
   - [ ] Run `mvn verify` to make sure basic checks pass.
     A more thorough check will be performed on your pull request automatically.
   - [ ] You have run the integration tests successfully (`mvn -Prun-its verify`).
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
   - [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Update to Jetty 12.1 [maven-resolver]

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin merged PR #1748:
URL: https://github.com/apache/maven-resolver/pull/1748


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Update to Jetty 12.1 [maven-resolver]

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #1748:
URL: https://github.com/apache/maven-resolver/pull/1748#discussion_r2687552265


##########
maven-resolver-transport-jetty/src/main/java/org/eclipse/aether/transport/jetty/PutTaskRequestContent.java:
##########
@@ -18,118 +18,260 @@
  */
 package org.eclipse.aether.transport.jetty;
 
-import java.io.EOFException;
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.nio.channels.ByteChannel;
 import java.nio.channels.Channels;
+import java.nio.channels.ClosedChannelException;
 import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.SeekableByteChannel;
 import java.nio.file.Files;
 import java.nio.file.StandardOpenOption;
+import java.util.Objects;
 
 import org.eclipse.aether.spi.connector.transport.PutTask;
-import org.eclipse.jetty.client.util.AbstractRequestContent;
+import org.eclipse.jetty.client.ByteBufferRequestContent;
+import org.eclipse.jetty.client.Request;
 import org.eclipse.jetty.io.ByteBufferPool;
+import org.eclipse.jetty.io.Content;
+import org.eclipse.jetty.io.RetainableByteBuffer;
+import org.eclipse.jetty.io.internal.ByteChannelContentSource;
 import org.eclipse.jetty.util.BufferUtil;
-import org.eclipse.jetty.util.Callback;
+import org.eclipse.jetty.util.ExceptionUtil;
 import org.eclipse.jetty.util.IO;
+import org.eclipse.jetty.util.TypeUtil;
+import org.eclipse.jetty.util.thread.AutoLock;
+import org.eclipse.jetty.util.thread.SerializedInvoker;
 
-class PutTaskRequestContent extends AbstractRequestContent {
-    private final PutTask putTask;
-    private final int bufferSize;
-    private ByteBufferPool bufferPool;
-    private boolean useDirectByteBuffers = true;
+/**
+ * Heavily inspired by Jetty's org.eclipse.jetty.io.internal.ByteChannelContentSource but adjusted to deal with
+ * ReadableByteChannels.
+ * Also Jetty's ByteChannelContentSource is an internal package so should not be used directly.
+ */
+public class PutTaskRequestContent extends ByteBufferRequestContent implements Request.Content {
 
-    PutTaskRequestContent(PutTask putTask) {
-        this(putTask, 4096);
+    public static Request.Content from(PutTask putTask) throws IOException {
+        ReadableByteChannel channel;
+        if (putTask.getDataPath() != null) {
+            channel = Files.newByteChannel(putTask.getDataPath(), StandardOpenOption.READ);
+        } else {
+            // TODO: support rewind for retries when using InputStream

Review Comment:
   @cstamas Any idea how to implement that with minimal effort?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Update to Jetty 12.1 [maven-resolver]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #1748:
URL: https://github.com/apache/maven-resolver/pull/1748#issuecomment-3761458781

   @kwin Please assign appropriate label to PR according to the type of change.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Update to Jetty 12.1 [maven-resolver]

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #1748:
URL: https://github.com/apache/maven-resolver/pull/1748#discussion_r2694507084


##########
maven-resolver-transport-jetty/src/main/java/org/eclipse/aether/transport/jetty/PutTaskRequestContent.java:
##########
@@ -18,118 +18,260 @@
  */
 package org.eclipse.aether.transport.jetty;
 
-import java.io.EOFException;
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.nio.channels.ByteChannel;
 import java.nio.channels.Channels;
+import java.nio.channels.ClosedChannelException;
 import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.SeekableByteChannel;
 import java.nio.file.Files;
 import java.nio.file.StandardOpenOption;
+import java.util.Objects;
 
 import org.eclipse.aether.spi.connector.transport.PutTask;
-import org.eclipse.jetty.client.util.AbstractRequestContent;
+import org.eclipse.jetty.client.ByteBufferRequestContent;
+import org.eclipse.jetty.client.Request;
 import org.eclipse.jetty.io.ByteBufferPool;
+import org.eclipse.jetty.io.Content;
+import org.eclipse.jetty.io.RetainableByteBuffer;
+import org.eclipse.jetty.io.internal.ByteChannelContentSource;
 import org.eclipse.jetty.util.BufferUtil;
-import org.eclipse.jetty.util.Callback;
+import org.eclipse.jetty.util.ExceptionUtil;
 import org.eclipse.jetty.util.IO;
+import org.eclipse.jetty.util.TypeUtil;
+import org.eclipse.jetty.util.thread.AutoLock;
+import org.eclipse.jetty.util.thread.SerializedInvoker;
 
-class PutTaskRequestContent extends AbstractRequestContent {
-    private final PutTask putTask;
-    private final int bufferSize;
-    private ByteBufferPool bufferPool;
-    private boolean useDirectByteBuffers = true;
+/**
+ * Heavily inspired by Jetty's org.eclipse.jetty.io.internal.ByteChannelContentSource but adjusted to deal with
+ * ReadableByteChannels.
+ * Also Jetty's ByteChannelContentSource is an internal package so should not be used directly.
+ */
+public class PutTaskRequestContent extends ByteBufferRequestContent implements Request.Content {
 
-    PutTaskRequestContent(PutTask putTask) {
-        this(putTask, 4096);
+    public static Request.Content from(PutTask putTask) throws IOException {
+        ReadableByteChannel channel;
+        if (putTask.getDataPath() != null) {
+            channel = Files.newByteChannel(putTask.getDataPath(), StandardOpenOption.READ);
+        } else {
+            // TODO: support rewind for retries when using InputStream

Review Comment:
   Improvement tracked in https://github.com/apache/maven-resolver/issues/1751



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Update to Jetty 12.1 [maven-resolver]

Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1748:
URL: https://github.com/apache/maven-resolver/pull/1748#discussion_r2687599399


##########
maven-resolver-transport-jetty/src/main/java/org/eclipse/aether/transport/jetty/PutTaskRequestContent.java:
##########
@@ -18,118 +18,260 @@
  */
 package org.eclipse.aether.transport.jetty;
 
-import java.io.EOFException;
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.nio.channels.ByteChannel;
 import java.nio.channels.Channels;
+import java.nio.channels.ClosedChannelException;
 import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.SeekableByteChannel;
 import java.nio.file.Files;
 import java.nio.file.StandardOpenOption;
+import java.util.Objects;
 
 import org.eclipse.aether.spi.connector.transport.PutTask;
-import org.eclipse.jetty.client.util.AbstractRequestContent;
+import org.eclipse.jetty.client.ByteBufferRequestContent;
+import org.eclipse.jetty.client.Request;
 import org.eclipse.jetty.io.ByteBufferPool;
+import org.eclipse.jetty.io.Content;
+import org.eclipse.jetty.io.RetainableByteBuffer;
+import org.eclipse.jetty.io.internal.ByteChannelContentSource;
 import org.eclipse.jetty.util.BufferUtil;
-import org.eclipse.jetty.util.Callback;
+import org.eclipse.jetty.util.ExceptionUtil;
 import org.eclipse.jetty.util.IO;
+import org.eclipse.jetty.util.TypeUtil;
+import org.eclipse.jetty.util.thread.AutoLock;
+import org.eclipse.jetty.util.thread.SerializedInvoker;
 
-class PutTaskRequestContent extends AbstractRequestContent {
-    private final PutTask putTask;
-    private final int bufferSize;
-    private ByteBufferPool bufferPool;
-    private boolean useDirectByteBuffers = true;
+/**
+ * Heavily inspired by Jetty's org.eclipse.jetty.io.internal.ByteChannelContentSource but adjusted to deal with
+ * ReadableByteChannels.
+ * Also Jetty's ByteChannelContentSource is an internal package so should not be used directly.
+ */
+public class PutTaskRequestContent extends ByteBufferRequestContent implements Request.Content {
 
-    PutTaskRequestContent(PutTask putTask) {
-        this(putTask, 4096);
+    public static Request.Content from(PutTask putTask) throws IOException {
+        ReadableByteChannel channel;
+        if (putTask.getDataPath() != null) {
+            channel = Files.newByteChannel(putTask.getDataPath(), StandardOpenOption.READ);
+        } else {
+            // TODO: support rewind for retries when using InputStream

Review Comment:
   https://github.com/apache/maven-resolver/blob/1f01b66d782c592d3e073de3e734f797a74a988b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/transport/PutTask.java#L58-L63
   
   PutTask carries either a file (`File` in Resolver 1 or `Path` in Resolver 2) or handful of bytes (as `byte[]`). Also is a `final` class, so maybe we just need to expose this?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Update to Jetty 12.1 [maven-resolver]

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #1748:
URL: https://github.com/apache/maven-resolver/pull/1748#discussion_r2687764933


##########
maven-resolver-transport-jetty/src/main/java/org/eclipse/aether/transport/jetty/PutTaskRequestContent.java:
##########
@@ -18,118 +18,260 @@
  */
 package org.eclipse.aether.transport.jetty;
 
-import java.io.EOFException;
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.nio.channels.ByteChannel;
 import java.nio.channels.Channels;
+import java.nio.channels.ClosedChannelException;
 import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.SeekableByteChannel;
 import java.nio.file.Files;
 import java.nio.file.StandardOpenOption;
+import java.util.Objects;
 
 import org.eclipse.aether.spi.connector.transport.PutTask;
-import org.eclipse.jetty.client.util.AbstractRequestContent;
+import org.eclipse.jetty.client.ByteBufferRequestContent;
+import org.eclipse.jetty.client.Request;
 import org.eclipse.jetty.io.ByteBufferPool;
+import org.eclipse.jetty.io.Content;
+import org.eclipse.jetty.io.RetainableByteBuffer;
+import org.eclipse.jetty.io.internal.ByteChannelContentSource;
 import org.eclipse.jetty.util.BufferUtil;
-import org.eclipse.jetty.util.Callback;
+import org.eclipse.jetty.util.ExceptionUtil;
 import org.eclipse.jetty.util.IO;
+import org.eclipse.jetty.util.TypeUtil;
+import org.eclipse.jetty.util.thread.AutoLock;
+import org.eclipse.jetty.util.thread.SerializedInvoker;
 
-class PutTaskRequestContent extends AbstractRequestContent {
-    private final PutTask putTask;
-    private final int bufferSize;
-    private ByteBufferPool bufferPool;
-    private boolean useDirectByteBuffers = true;
+/**
+ * Heavily inspired by Jetty's org.eclipse.jetty.io.internal.ByteChannelContentSource but adjusted to deal with
+ * ReadableByteChannels.
+ * Also Jetty's ByteChannelContentSource is an internal package so should not be used directly.
+ */
+public class PutTaskRequestContent extends ByteBufferRequestContent implements Request.Content {
 
-    PutTaskRequestContent(PutTask putTask) {
-        this(putTask, 4096);
+    public static Request.Content from(PutTask putTask) throws IOException {
+        ReadableByteChannel channel;
+        if (putTask.getDataPath() != null) {
+            channel = Files.newByteChannel(putTask.getDataPath(), StandardOpenOption.READ);
+        } else {
+            // TODO: support rewind for retries when using InputStream

Review Comment:
   Came up with a simpler solution based on `Supplier<ReadableByteChannel>` in https://github.com/apache/maven-resolver/pull/1748/commits/82f6bda5b7f7a3e94cfbb924b8d681b201899699.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org