garydgregory commented on a change in pull request #302:
URL:
https://github.com/apache/httpcomponents-core/pull/302#discussion_r728093123
##########
File path:
httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/AsyncEntityProducers.java
##########
@@ -218,6 +221,20 @@ public static AsyncEntityProducer create(final File
content, final ContentType c
return withTrailers(create(content, contentType), trailers);
}
+ /**
+ * @since 5.2
+ */
+ public static AsyncEntityProducer create(final Path content, final
ContentType contentType, final Header... trailers) throws IOException {
+ return withTrailers(new PathEntityProducer(content, contentType,
StandardOpenOption.READ), trailers);
+ }
+
+ /**
+ * @since 5.2
+ */
+ public static AsyncEntityProducer create(final Path content, final
ContentType contentType, final OpenOption... options) throws IOException {
Review comment:
> Does `NOFOLLOW_LINKS` make sense here? Since you want to read a file
and not a symlink, don't you?
Hi @michael-o
Yes, because in general, you want to read _something_ that is _described_ by
a path using whatever techniques specified by open options. Kind of a _where_
(Path) and _how_ (OpenOption) specification.
When you use a Path, you do not know if it is a symlink unless you ask the
file system. Also, a file system provider might have its own implementation of
the `OpenOption` interface, just like the JRE provides several. So I do not see
how we can _not_ offer this hook in the API.
We could KISS the API and not provide any factory methods but that would not
parallel the existing `File` version of the factory APIs and it would also
"hide" the new class a little more.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]