http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e05c9fd2/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/WEB-INF/jsp/hexview.jsp ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/WEB-INF/jsp/hexview.jsp b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/WEB-INF/jsp/hexview.jsp new file mode 100644 index 0000000..c6e7f38 --- /dev/null +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/WEB-INF/jsp/hexview.jsp @@ -0,0 +1,32 @@ +<%-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--%> +<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %> +<link rel="stylesheet" href="js/hexview/hexview.default.css" type="text/css" /> +<script type="text/javascript" src="../nifi/js/jquery/jquery-2.1.1.min.js"></script> +<script type="text/javascript" src="js/hexview/hexview.js"></script> + +<div id="hexview-content" class="hexviewwindow" title=""> + ${content} + <form id="hexviewwindow_params"> + <input type="hidden" name="highlights" value="" /> + <input type="hidden" name="row_width" value="16" /> + <input type="hidden" name="word_size" value="1" /> + <input type="hidden" name="hide_0x" value="1" /> + <input type="hidden" name="caption" value="" /> + </form> +</div> +<div id="trancation-message">Showing up to 1.5kb</div> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e05c9fd2/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/WEB-INF/jsp/no-viewer.jsp ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/WEB-INF/jsp/no-viewer.jsp b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/WEB-INF/jsp/no-viewer.jsp new file mode 100644 index 0000000..8eddbe2 --- /dev/null +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/WEB-INF/jsp/no-viewer.jsp @@ -0,0 +1,20 @@ +<%-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--%> +<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %> +<div id="no-viewer"> + No viewer is registered for this content type. +</div> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e05c9fd2/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/WEB-INF/web.xml b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..77f0853 --- /dev/null +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> + <display-name>nifi-content-viewer</display-name> + <servlet> + <servlet-name>ContentViewerController</servlet-name> + <servlet-class>org.apache.nifi.web.ContentViewerController</servlet-class> + </servlet> + <servlet-mapping> + <servlet-name>ContentViewerController</servlet-name> + <url-pattern></url-pattern> + </servlet-mapping> +</web-app> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e05c9fd2/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/css/main.css ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/css/main.css b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/css/main.css new file mode 100644 index 0000000..a66198d --- /dev/null +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/css/main.css @@ -0,0 +1,113 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +* { + margin: 0; + padding: 0; +} + +#view-as-label { + position: absolute; + top: 72px; + left: 144px; + line-height: 24px; + font-size: 12px; +} + +#view-as { + position: absolute; + top: 72px; + left: 200px; + width: 80px; + height: 18px; +} + +#content-filename { + position: absolute; + top: 58px; + right: 50px; + line-height: 24px; + font-size: 12px; +} + +#content-type { + position: absolute; + top: 75px; + right: 50px; + line-height: 24px; + font-size: 12px; +} + +.content-label { + font-weight: bold; + margin-right: 8px; +} + +.pointer { + cursor: pointer; +} + +.hidden { + display: none; +} + +/* hex viewer */ + +#hexview-content { + position: absolute; + right: 50px; + bottom: 50px; + left: 100px; + top: 100px; + border: 1px solid #aaa; + overflow: auto; + background-color: #fff; +} + +#hexview-content table.hexviewerwindow_table { + border: none; + margin-left: 0; + background-color: #fff; +} + +#hexview-content td { + padding: 2px; +} + +#trancation-message { + position: absolute; + left: 100px; + bottom: 35px; + color: #666; + font-style: italic; + font-size: 11px; +} + +/* no viewer */ + +#no-viewer { + position: absolute; + right: 50px; + bottom: 50px; + left: 100px; + top: 100px; + border: 1px solid #aaa; + overflow: auto; + background-color: #fff; + font-style: italic; + padding: 5px; + font-size: 13px; +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e05c9fd2/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/js/hexview/LICENSE ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/js/hexview/LICENSE b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/js/hexview/LICENSE new file mode 100644 index 0000000..95e1332 --- /dev/null +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/js/hexview/LICENSE @@ -0,0 +1,32 @@ + +HexViewJS License +----------------- + +HexViewJS is written by Nick McVeity <[email protected]> and is +licensed under the terms of the MIT license reproduced below. + +======================================================================== + +Copyright (c) 2010 Nick McVeity <[email protected]> + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +======================================================================== + http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e05c9fd2/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/js/hexview/hexview.default.css ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/js/hexview/hexview.default.css b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/js/hexview/hexview.default.css new file mode 100644 index 0000000..581161e --- /dev/null +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/js/hexview/hexview.default.css @@ -0,0 +1,10 @@ +.hexviewerwindow { font-family: monospace; background-color: #F2F2F2;} +div.hexviewerwindow { padding: 20px; } +.hexviewerwindow_table { border-collapse:collapse; border: 5px solid grey; margin-left: 16px; caption-side:bottom; } +.hexviewerwindow_offset {background: #A9D0F5; padding-right: 8px; } +.hexviewerwindow_visual {background: #A9F5F2; padding-left: 8px; } +.hexviewerwindow_code {} +.hexviewerwindow_code_hi {background: #F4FA58; } +.hexviewerwindow_border_start {border-left: solid #E0E0E0 1px; } +.hexviewerwindow_border_middle {border-bottom: solid #E0E0E0 1px; border-top: solid #E0E0E0 1px;} +.hexviewerwindow_border_end {border-right: solid #E0E0E0 1px; border-top: solid #E0E0E0 1px; } http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e05c9fd2/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/js/hexview/hexview.js ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/js/hexview/hexview.js b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/js/hexview/hexview.js new file mode 100644 index 0000000..7c461d5 --- /dev/null +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/webapp/js/hexview/hexview.js @@ -0,0 +1,199 @@ +$(document).ready(function () { + var HEX = '0123456789ABCDEF'; + + function dec2_to_hex(dec) + { + if (dec < 0) + dec = 0; + + if (dec > 255) + dec = 255; + + return HEX.charAt(Math.floor(dec / 16)) + HEX.charAt(dec % 16); + } + + function dec_to_hex8(dec) + { + var str = ""; + + for (var i = 3; i >= 0; i--) + { + str += dec2_to_hex((dec >> (i*8)) & 255); + } + + return str; + } + + function remove_whitespace(str) + { + return str.replace(/\n/g, "") + .replace(/\t/g, "") + .replace(/ /g, "") + .replace(/\r/g, ""); + } + + var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + + function base64_decode(encoded) + { + var decoded = ""; + + for (var i = 0; i < encoded.length; i += 4) + { + var ch0 = encoded.charAt(i+0); + var ch1 = encoded.charAt(i+1); + var ch2 = encoded.charAt(i+2); + var ch3 = encoded.charAt(i+3); + + var index0 = BASE64_CHARS.indexOf(ch0); + var index1 = BASE64_CHARS.indexOf(ch1); + var index2 = BASE64_CHARS.indexOf(ch2); + var index3 = BASE64_CHARS.indexOf(ch3); + + decoded += String.fromCharCode((index0 << 2) | (index1 >> 4)); + decoded += String.fromCharCode(((index1 & 15) << 4) | (index2 >> 2)); + + // skip the base64 padding as those weren't present in the actual bytes + var token = String.fromCharCode(((index2 & 3) << 6) | index3); + if (index3 !== 64 || token !== '@') { + decoded += token; + } + } + + return decoded; + } + + function markup_hexviewwindow(div, index) + { + var entityMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '/': '/' + }; + + function escapeHtml(string) { + if (string === null || typeof string === 'undefined') { + return ''; + } else { + return String(string).replace(/[&<>"'\/]/g, function (s) { + return entityMap[s]; + }); + } + } + + var bin_data = base64_decode(remove_whitespace(div.text())); + var line_data; + var title = div.attr("title"); + + var highlights_str = $("form#hexviewwindow_params input[name='highlights']", div).attr("value").split(','); + var highlights = []; + + for (var i = 0; i < highlights_str.length; i++) + { + highlights.push(highlights_str[i].split(":")); + } + + var params = title.split(':'); + var step = parseInt($("form#hexviewwindow_params input[name='row_width']", div).attr("value")); + var word_size = parseInt($("form#hexviewwindow_params input[name='word_size']", div).attr("value")); + var hide_0x = parseInt($("form#hexviewwindow_params input[name='hide_0x']", div).attr("value")); + var decimal_offset = parseInt($("form#hexviewwindow_params input[name='decimal_offset']", div).attr("value")); + var start_byte_1 = parseInt($("form#hexviewwindow_params input[name='start_byte_1']", div).attr("value")); + var caption = $("form#hexviewwindow_params input[name='caption']", div).attr("value"); + + div.text(""); + div.append("<table></table>"); + + var offset = (start_byte_1 ? 1 : 0); + + function apply_highlights(index) + { + for (var j = 0; j < highlights.length; j++) + { + if ((index >= highlights[j][0]) && (index <= highlights[j][1])) + { + if (index === highlights[j][0]) + { + $("table tr td:last", div).addClass("hexviewerwindow_border_start"); + } + + if (index === highlights[j][1]) + { + $("table tr td:last", div).addClass("hexviewerwindow_border_end"); + } + + $("table tr td:last", div).addClass("hexviewerwindow_code_hi hexviewerwindow_border_middle"); + $("table tr td:last", div).attr("style", "background-color: " + highlights[j][2] + ";"); + $("table tr td:last", div).attr("title", highlights[j][3]); + + runlen += 1; + } + else + { + $("table tr td:last", div).addClass("hexviewerwindow_code"); + } + } + } + + if (caption) + $("table", div).append("<caption>" + escapeHtml(caption) + "</caption>"); + + while (bin_data.length > 0) + { + line_data = bin_data.slice(0, step); + bin_data = bin_data.slice(step); + + $("table", div).addClass("hexviewerwindow_table"); + $("table", div).append("<tr></tr>").addClass("hexviewerwindow"); + $("table tr:last", div).append("<td>" + (decimal_offset ? ("00000000"+offset).slice(-8) : "0x" + dec_to_hex8(offset)) + "</td>"); + $("table tr td:last", div).addClass("hexviewerwindow_offset"); + + var runlen = 0; + + for (var i = 0; i < line_data.length; i += word_size) + { + var num = ""; + + for (var j = 0; j < word_size; j++) + { + num += dec2_to_hex(line_data.charCodeAt(i+j)); + } + + $("table tr:last", div).append("<td>" + (hide_0x ? "" : "0x") + num + "</td>"); + + apply_highlights(offset+i); + } + + var text = ""; + + for (var i = 0; i < line_data.length; i++) + { + var cc = line_data.charCodeAt(i); + + if ((cc >= 32) && (cc <= 126)) + { + text = text + line_data.charAt(i); + } + else + { + text = text + "."; + } + } + + if (line_data.length < step) + $("table tr td:last", div).attr("colspan", Math.floor((step - line_data.length) / word_size) + 1); + + offset += step; + + $("table tr:last", div).append("<td>" + escapeHtml(text) + "</td>"); + $("table tr td:last", div).addClass("hexviewerwindow_visual"); + } + } + + $("div.hexviewwindow").each(function (index) { + markup_hexviewwindow($(this), index); + }); +}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e05c9fd2/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/web.xml b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/web.xml index eff7b8d..d0a5e39 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/web.xml +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/web.xml @@ -115,6 +115,17 @@ <url-pattern>/bulletin-board</url-pattern> </servlet-mapping> + <!-- servlet to support message page --> + + <servlet> + <servlet-name>MessagePage</servlet-name> + <jsp-file>/WEB-INF/pages/message-page.jsp</jsp-file> + </servlet> + <servlet-mapping> + <servlet-name>MessagePage</servlet-name> + <url-pattern>/message</url-pattern> + </servlet-mapping> + <!-- servlet to support image downloading --> <servlet> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e05c9fd2/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/codemirror/addon/fold/foldgutter.css ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/codemirror/addon/fold/foldgutter.css b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/codemirror/addon/fold/foldgutter.css new file mode 100644 index 0000000..ad19ae2 --- /dev/null +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/codemirror/addon/fold/foldgutter.css @@ -0,0 +1,20 @@ +.CodeMirror-foldmarker { + color: blue; + text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px; + font-family: arial; + line-height: .3; + cursor: pointer; +} +.CodeMirror-foldgutter { + width: .7em; +} +.CodeMirror-foldgutter-open, +.CodeMirror-foldgutter-folded { + cursor: pointer; +} +.CodeMirror-foldgutter-open:after { + content: "\25BE"; +} +.CodeMirror-foldgutter-folded:after { + content: "\25B8"; +}
