You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/11/06 17:32:01 UTC
[jira] [Commented] (NIFI-3402) Add ETag Support to InvokeHTTP
[ https://issues.apache.org/jira/browse/NIFI-3402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16240587#comment-16240587 ]
ASF GitHub Bot commented on NIFI-3402:
--------------------------------------
Github user m-hogue commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2150#discussion_r149147685
--- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java ---
@@ -1093,6 +1133,19 @@ private Charset getCharsetFromMediaType(MediaType contentType) {
return contentType != null ? contentType.charset(StandardCharsets.UTF_8) : StandardCharsets.UTF_8;
}
+ /**
+ * Retrieve the directory in which OkHttp should cache responses. This method opts
+ * to use a temp directory to write the cache, which means that the cache will be written
+ * to a new location each time this processor is scheduled.
+ *
+ * Ref: https://github.com/square/okhttp/wiki/Recipes#response-caching
+ *
+ * @return the directory in which the ETag cache should be written
+ */
+ private static File getETagCacheDir() {
+ return Files.createTempDir();
--- End diff --
As it's currently written, this should be done via OS-controlled temporary folder cleanup [1]. I elected to do this to 1) avoid manual cleanup and 2) avoid introducing something error prone. As this is only a cache, its durability isn't important.
[1] https://google.github.io/guava/releases/19.0/api/docs/com/google/common/io/Files.html#createTempDir()
> Add ETag Support to InvokeHTTP
> ------------------------------
>
> Key: NIFI-3402
> URL: https://issues.apache.org/jira/browse/NIFI-3402
> Project: Apache NiFi
> Issue Type: Improvement
> Reporter: Brandon DeVries
> Assignee: Michael Hogue
> Priority: Trivial
>
> Unlike GetHTTP, when running in "source" mode InvokeHTTP doesn't support ETags. It will pull from a URL as often as it is scheduled to run. When running with an input relationship, it would potentially make sense to not use the ETag. But at least in "source" mode, it seems like it should at least be an option.
> To maintain backwards compatibility and support the non-"source" usage, I'd suggest creating a new "Use ETag" property that defaults to false...
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)