You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2015/02/04 19:57:28 UTC

[34/36] incubator-nifi git commit: NIFI-317: - Code clean up. Earlier versions of this used a GET request which required the img be url encoded. Converted to using POST due to URL length limitations but left the encoding code in place.

NIFI-317:
- Code clean up. Earlier versions of this used a GET request which required the img be url encoded. Converted to using POST due to URL length limitations but left the encoding code in place.

Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/ed53b46b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/ed53b46b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/ed53b46b

Branch: refs/heads/NIFI-250
Commit: ed53b46b7aac460d0b832c20332c8881419c4fab
Parents: 3a0cb2d
Author: Matt Gilman <ma...@gmail.com>
Authored: Wed Feb 4 10:02:51 2015 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Wed Feb 4 10:02:51 2015 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/nifi/web/servlet/DownloadSvg.java   | 8 ++------
 .../nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js  | 8 +++-----
 .../main/webapp/js/nf/provenance/nf-provenance-lineage.js    | 4 ++--
 3 files changed, 7 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ed53b46b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/java/org/apache/nifi/web/servlet/DownloadSvg.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/java/org/apache/nifi/web/servlet/DownloadSvg.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/java/org/apache/nifi/web/servlet/DownloadSvg.java
index ab76d4e..d912998 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/java/org/apache/nifi/web/servlet/DownloadSvg.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/java/org/apache/nifi/web/servlet/DownloadSvg.java
@@ -18,7 +18,6 @@ package org.apache.nifi.web.servlet;
 
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.net.URLDecoder;
 import javax.servlet.ServletException;
 import javax.servlet.annotation.WebServlet;
 import javax.servlet.http.HttpServlet;
@@ -44,10 +43,10 @@ public class DownloadSvg extends HttpServlet {
      */
     @Override
     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-        final String rawSvg = request.getParameter("svg");
+        final String svg = request.getParameter("svg");
 
         // ensure the image markup has been included
-        if (rawSvg == null) {
+        if (svg == null) {
             // set the response status
             response.setContentType("text/plain");
             response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
@@ -59,9 +58,6 @@ public class DownloadSvg extends HttpServlet {
         }
 
         try {
-            // get the svg and decode it, +'s need to be converted
-            final String svg = URLDecoder.decode(rawSvg.replace("+", "%2B"), "UTF-8");
-
             if (logger.isDebugEnabled()) {
                 logger.debug(svg);
             }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ed53b46b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js
index 171b96f..b49a97b 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js
@@ -406,21 +406,19 @@ nf.Common = {
     }()),
     
     /**
-     * Creates a form inline in order to submit the specified params to the specified URL
-     * using the specified method.
+     * Creates a form inline in order to post the specified params to the specified URL.
      * 
-     * @param {string} method       The method to use
      * @param {string} url          The URL
      * @param {object} params       An object with the params to include in the submission
      */
-    submit: function (method, url, params) {
+    post: function (url, params) {
         // temporarily override beforeunload
         var previousBeforeUnload = window.onbeforeunload;
         window.onbeforeunload = null;
 
         // create a form for submission
         var form = $('<form></form>').attr({
-            'method': method,
+            'method': 'POST',
             'action': url,
             'style': 'display: none;'
         });

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ed53b46b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-lineage.js
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-lineage.js b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-lineage.js
index 03b08f0..583fe7e 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-lineage.js
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-lineage.js
@@ -1287,9 +1287,9 @@ nf.ProvenanceLineage = (function () {
                 svg = '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n' + svg;
 
                 // send to server to initiate download... client side only support is too browser specific at this point
-                nf.Common.submit('POST', './download-svg', {
+                nf.Common.post('./download-svg', {
                     'filename': 'provenance',
-                    'svg': encodeURIComponent(svg)
+                    'svg': svg
                 });
             });