You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by th...@apache.org on 2019/09/24 16:23:56 UTC
[nifi-registry] branch NIFIREG-320 updated: Fixed rest-api loading.
Headers confirmed to be applied for docs.
This is an automated email from the ASF dual-hosted git repository.
thenatog pushed a commit to branch NIFIREG-320
in repository https://gitbox.apache.org/repos/asf/nifi-registry.git
The following commit(s) were added to refs/heads/NIFIREG-320 by this push:
new 9d78662 Fixed rest-api loading. Headers confirmed to be applied for docs.
9d78662 is described below
commit 9d786620047c19310733318a73b905b166214f2f
Author: thenatog <th...@gmail.com>
AuthorDate: Tue Sep 24 12:23:35 2019 -0400
Fixed rest-api loading. Headers confirmed to be applied for docs.
---
.../java/org/apache/nifi/registry/jetty/JettyServer.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/nifi-registry-core/nifi-registry-jetty/src/main/java/org/apache/nifi/registry/jetty/JettyServer.java b/nifi-registry-core/nifi-registry-jetty/src/main/java/org/apache/nifi/registry/jetty/JettyServer.java
index 58b6249..387857f 100644
--- a/nifi-registry-core/nifi-registry-jetty/src/main/java/org/apache/nifi/registry/jetty/JettyServer.java
+++ b/nifi-registry-core/nifi-registry-jetty/src/main/java/org/apache/nifi/registry/jetty/JettyServer.java
@@ -438,6 +438,21 @@ public class JettyServer {
docsContext.addServlet(docs, "/html/*");
docsContext.addServlet(defaultHolder, "/");
+ // load the rest documentation
+ final File webApiDocsDir = new File(webApiContext.getTempDirectory(), "webapp/docs");
+ if (!webApiDocsDir.exists()) {
+ final boolean made = webApiDocsDir.mkdirs();
+ if (!made) {
+ throw new RuntimeException(webApiDocsDir.getAbsolutePath() + " could not be created");
+ }
+ }
+
+ ServletHolder apiDocs = new ServletHolder("apiDocs", DefaultServlet.class);
+ apiDocs.setInitParameter("resourceBase", webApiDocsDir.getPath());
+ apiDocs.setInitParameter("dirAllowed", "false");
+
+ docsContext.addServlet(apiDocs, "/rest-api/*");
+
logger.info("Loading documents web app with context path set to " + docsContext.getContextPath());
} catch (Exception ex) {