Repository: knox
Updated Branches:
  refs/heads/v0.13.0 42ef7ac1a -> b9b0db2eb


KNOX-994 - Introducing a new variable  that enhances the  function, needed for 
Zeppelin / fix


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

Branch: refs/heads/v0.13.0
Commit: b9b0db2ebe7a5b7e1ddd58422ab750f0c9f49743
Parents: 42ef7ac
Author: Sandeep More <m...@apache.org>
Authored: Sat Aug 12 20:32:11 2017 -0400
Committer: Sandeep More <m...@apache.org>
Committed: Sat Aug 12 20:32:11 2017 -0400

----------------------------------------------------------------------
 .../rewrite/impl/html/HtmlPrefixDescriptor.java |  48 +++++++++
 .../rewrite/impl/html/HtmlPrefixProcessor.java  | 104 +++++++++++++++++++
 .../JavaScriptUrlRewriteStreamFilter.java       |   3 +-
 ...ter.rewrite.api.UrlRewriteFunctionDescriptor |   3 +-
 ...lter.rewrite.spi.UrlRewriteFunctionProcessor |   3 +-
 .../api/UrlRewriteServletFilterTest.java        |  42 +++++++-
 .../impl/html/HtmlPrefixProcessorTest.java      |  57 ++++++++++
 .../api/UrlRewriteServletFilterTest/rewrite.xml |   6 +-
 .../services/zeppelinui/0.6.0/rewrite.xml       |  61 ++++++++++-
 .../services/zeppelinui/0.6.0/service.xml       |   5 +
 10 files changed, 326 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/b9b0db2e/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixDescriptor.java
----------------------------------------------------------------------
diff --git 
a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixDescriptor.java
 
b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixDescriptor.java
new file mode 100644
index 0000000..f0386a1
--- /dev/null
+++ 
b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixDescriptor.java
@@ -0,0 +1,48 @@
+package org.apache.hadoop.gateway.filter.rewrite.impl.html;
+
+import 
org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteFunctionDescriptor;
+
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+
+/**
+ * {@link UrlRewriteFunctionDescriptor} for the variable {@link
+ * HtmlPrefixDescriptor#FUNCTION_NAME}
+ *
+ * @since 0.14.0
+ */
+public class HtmlPrefixDescriptor
+    implements UrlRewriteFunctionDescriptor<HtmlPrefixDescriptor> {
+
+  /**
+   * variable name used in rewrite.xml
+   */
+  public static final String FUNCTION_NAME = "prefix";
+
+  /**
+   * Create an instance
+   */
+  public HtmlPrefixDescriptor() {
+    super();
+  }
+
+  @Override
+  public String name() {
+    return FUNCTION_NAME;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/knox/blob/b9b0db2e/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixProcessor.java
----------------------------------------------------------------------
diff --git 
a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixProcessor.java
 
b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixProcessor.java
new file mode 100644
index 0000000..8ded069
--- /dev/null
+++ 
b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixProcessor.java
@@ -0,0 +1,104 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+package org.apache.hadoop.gateway.filter.rewrite.impl.html;
+
+import org.apache.hadoop.gateway.filter.rewrite.api.FrontendFunctionDescriptor;
+import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteEnvironment;
+import 
org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteFunctionDescriptor;
+import 
org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteFunctionDescriptorFactory;
+import 
org.apache.hadoop.gateway.filter.rewrite.impl.UrlRewriteFunctionProcessorFactory;
+import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteContext;
+import 
org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteFunctionProcessor;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This function enhances the 'frontend' function with the ability to add a
+ * prefix to the rewritten frontend portion along with the literals
+ * provided as an argument.
+ * <p>
+ * <div ng-include 
src=\"'components/navbar/navbar.html?v=1498928142479'\"></div>
+ * <p>
+ * and needs to be rewritten to something like
+ * <p>
+ * <div ng-include 
src=\"'http://localhost:8443/sandbox/service/components/navbar/navbar.html?v=1498928142479'\"></div>
+ * <p>
+ * The rewrite rule could then contain the $prefix function that would delegate
+ * to the frontend function.
+ * <p>
+ * The parameter to the function would be the symbol used as a prefix.
+ */
+
+public class HtmlPrefixProcessor
+    implements UrlRewriteFunctionProcessor<HtmlPrefixDescriptor> {
+
+  private UrlRewriteFunctionProcessor frontend;
+
+  /**
+   * Create an instance
+   */
+  public HtmlPrefixProcessor() {
+    super();
+  }
+
+  @Override
+  public void initialize(final UrlRewriteEnvironment environment,
+      final HtmlPrefixDescriptor descriptor) throws Exception {
+
+    final UrlRewriteFunctionDescriptor frontendDescriptor = 
UrlRewriteFunctionDescriptorFactory
+        .create(FrontendFunctionDescriptor.FUNCTION_NAME);
+
+    frontend = UrlRewriteFunctionProcessorFactory
+        .create(FrontendFunctionDescriptor.FUNCTION_NAME, frontendDescriptor);
+
+    frontend.initialize(environment, frontendDescriptor);
+  }
+
+  @Override
+  public String name() {
+    return HtmlPrefixDescriptor.FUNCTION_NAME;
+  }
+
+  @Override
+  public void destroy() throws Exception {
+    frontend.destroy();
+  }
+
+  @Override
+  public List<String> resolve(UrlRewriteContext context,
+      List<String> parameters) throws Exception {
+    String prefix = "";
+
+    if ((parameters != null) && (parameters.size() > 1)) {
+      prefix = parameters.get(0);
+      parameters = parameters.subList(1, parameters.size());
+    }
+
+    final List<String> frontendValues = frontend.resolve(context, parameters);
+
+    final StringBuffer buffer = new StringBuffer();
+    buffer.append(prefix);
+    if (frontendValues != null && frontendValues.size() > 0) {
+      for (final String value : frontendValues) {
+        buffer.append(value);
+      }
+    }
+
+    return Arrays.asList(buffer.toString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/knox/blob/b9b0db2e/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/javascript/JavaScriptUrlRewriteStreamFilter.java
----------------------------------------------------------------------
diff --git 
a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/javascript/JavaScriptUrlRewriteStreamFilter.java
 
b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/javascript/JavaScriptUrlRewriteStreamFilter.java
index d8865f4..41f141b 100644
--- 
a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/javascript/JavaScriptUrlRewriteStreamFilter.java
+++ 
b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/javascript/JavaScriptUrlRewriteStreamFilter.java
@@ -29,7 +29,7 @@ import java.io.InputStreamReader;
 
 public class JavaScriptUrlRewriteStreamFilter implements 
UrlRewriteStreamFilter {
 
-  private static String[] TYPES = new String[]{ "application/javascritp", 
"text/javascript", "*/javascript",
+  private static String[] TYPES = new String[]{ "application/javascript", 
"text/javascript", "*/javascript",
       "application/x-javascript", "text/x-javascript", "*/x-javascript" };
   private static String[] NAMES = new String[]{ null };
 
@@ -52,6 +52,7 @@ public class JavaScriptUrlRewriteStreamFilter implements 
UrlRewriteStreamFilter
       UrlRewriter.Direction direction,
       UrlRewriteFilterContentDescriptor config )
           throws IOException {
+
     if ( config != null ) {
       return new ReaderInputStream(
           new JavaScriptUrlRewriteFilterReader(

http://git-wip-us.apache.org/repos/asf/knox/blob/b9b0db2e/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteFunctionDescriptor
----------------------------------------------------------------------
diff --git 
a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteFunctionDescriptor
 
b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteFunctionDescriptor
index e5ccde7..7a086ca 100644
--- 
a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteFunctionDescriptor
+++ 
b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteFunctionDescriptor
@@ -17,4 +17,5 @@
 ##########################################################################
 
 org.apache.hadoop.gateway.filter.rewrite.api.FrontendFunctionDescriptor
-org.apache.hadoop.gateway.filter.rewrite.impl.html.HtmlImportFunctionDescriptor
\ No newline at end of file
+org.apache.hadoop.gateway.filter.rewrite.impl.html.HtmlImportFunctionDescriptor
+org.apache.hadoop.gateway.filter.rewrite.impl.html.HtmlPrefixDescriptor
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/b9b0db2e/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteFunctionProcessor
----------------------------------------------------------------------
diff --git 
a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteFunctionProcessor
 
b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteFunctionProcessor
index 16731b8..23c11a7 100644
--- 
a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteFunctionProcessor
+++ 
b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteFunctionProcessor
@@ -17,4 +17,5 @@
 ##########################################################################
 
 org.apache.hadoop.gateway.filter.rewrite.impl.FrontendFunctionProcessor
-org.apache.hadoop.gateway.filter.rewrite.impl.html.HtmlImportFunctionProcessor
\ No newline at end of file
+org.apache.hadoop.gateway.filter.rewrite.impl.html.HtmlImportFunctionProcessor
+org.apache.hadoop.gateway.filter.rewrite.impl.html.HtmlPrefixProcessor
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/b9b0db2e/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
----------------------------------------------------------------------
diff --git 
a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
 
b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
index 82824a4..55ef322 100644
--- 
a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
+++ 
b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
@@ -806,7 +806,47 @@ public class UrlRewriteServletFilterTest {
 //    assertThat( the( content ), hasXPath( "//style/text()", equalTo( 
"@import \\\"http://0.0.0.0:0/stylesheets/pretty.css\\\";"; ) ) );
     assertThat(content, anyOf( is(responseHtmlOne), is(responseHtmlTwo)));
   }
-  
+
+  /**
+   * Test the prefix function
+   * @see KNOX-994
+   * @since 0.14.0
+   */
+  @Test
+  public void testResponseHtmlBodyRewritePrefixFunctionTestPrefix() throws 
Exception {
+
+    Map<String,String> initParams = new HashMap<>();
+    initParams.put( "response.body", "test-filter-6" );
+    setUp( initParams );
+
+    String responseHtml = "<html><div 
src=\"'components/navbar/navbar.html?v=1496201914075\"></div></html>";
+    String responseHtmlOne = "<html><div 
src=\"'http://0.0.0.0:0/zeppelin/components/navbar/navbar.html?v=1496201914075\";></div></html>";
+
+    // Setup the server side request/response interaction.
+    interaction.expect()
+        .method( "GET" )
+        .requestUrl( "http://mock-host:42/test-output-path-1"; );
+    interaction.respond()
+        .contentType( "application/html" )
+        .content( responseHtml, Charset.forName( "UTF-8" ) )
+        .status( 200 );
+    interactions.add( interaction );
+    request.setMethod( "GET" );
+    request.setURI( "/test-input-path" );
+    request.setHeader( "Host", "mock-host:42" );
+    request.setHeader( "Content-Type", "application/html" );
+
+    // Execute the request.
+    response = TestUtils.execute( server, request );
+
+    assertThat( response.getStatus(), is( 200 ) );
+    String content = response.getContent();
+
+    assertThat(content,  is(responseHtmlOne));
+
+  }
+
+
   /**
    * See KNOX-791
    * @since 0.11.0

http://git-wip-us.apache.org/repos/asf/knox/blob/b9b0db2e/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixProcessorTest.java
----------------------------------------------------------------------
diff --git 
a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixProcessorTest.java
 
b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixProcessorTest.java
new file mode 100644
index 0000000..3954fd3
--- /dev/null
+++ 
b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixProcessorTest.java
@@ -0,0 +1,57 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+package org.apache.hadoop.gateway.filter.rewrite.impl.html;
+
+import 
org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteFunctionProcessor;
+import org.junit.Test;
+
+import java.util.Iterator;
+import java.util.ServiceLoader;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.fail;
+
+public class HtmlPrefixProcessorTest {
+
+  public HtmlPrefixProcessorTest() {
+    super();
+  }
+
+  @SuppressWarnings("rawtypes")
+  @Test
+  public void testServiceLoader() throws Exception {
+    ServiceLoader loader = ServiceLoader.load( 
UrlRewriteFunctionProcessor.class );
+    Iterator iterator = loader.iterator();
+    assertThat( "Service iterator empty.", iterator.hasNext() );
+    while( iterator.hasNext() ) {
+      Object object = iterator.next();
+      if( object instanceof HtmlPrefixProcessor) {
+        return;
+      }
+    }
+    fail( "Failed to find " + HtmlPrefixProcessor.class.getName() + " via 
service loader." );
+  }
+
+  @Test
+  public void testName() throws Exception {
+    HtmlPrefixProcessor processor = new HtmlPrefixProcessor();
+    assertThat( processor.name(), is( "prefix" ) );
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/knox/blob/b9b0db2e/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest/rewrite.xml
----------------------------------------------------------------------
diff --git 
a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest/rewrite.xml
 
b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest/rewrite.xml
index b979545..3b77eb3 100644
--- 
a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest/rewrite.xml
+++ 
b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest/rewrite.xml
@@ -57,6 +57,11 @@
         <rewrite template="{$import[&quot;, 
url]}/stylesheets/pretty.css&quot;;"/>
     </rule>
 
+    <!-- HTML Prefix attribute tests, since 0.14.0 -->
+    <rule dir="OUT" name="test-rule-html-prefix-attribute-prefix/1" 
pattern="'components/{**}?{**}">
+        <rewrite 
template="{$prefix[&#39;,url]}/zeppelin/components/{**}?{**}"/>
+    </rule>
+
     <filter name="test-filter-1">
         <content type="application/json">
             <apply path="$.url" rule="test-rule-1"/>
@@ -101,5 +106,4 @@
         </content>
     </filter>
 
-
 </rules>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/b9b0db2e/gateway-service-definitions/src/main/resources/services/zeppelinui/0.6.0/rewrite.xml
----------------------------------------------------------------------
diff --git 
a/gateway-service-definitions/src/main/resources/services/zeppelinui/0.6.0/rewrite.xml
 
b/gateway-service-definitions/src/main/resources/services/zeppelinui/0.6.0/rewrite.xml
index 77e0621..7259aba 100644
--- 
a/gateway-service-definitions/src/main/resources/services/zeppelinui/0.6.0/rewrite.xml
+++ 
b/gateway-service-definitions/src/main/resources/services/zeppelinui/0.6.0/rewrite.xml
@@ -115,9 +115,68 @@
   <rule dir="OUT" name="ZEPPELINUI/zeppelin/outbound/javascript" 
pattern="components/{**}">
     <rewrite template="{$frontend[path]}/zeppelin/components/{**}"/>
   </rule>
-
+    
   <rule dir="OUT" name="ZEPPELINUI/zeppelin/outbound/javascript" 
pattern="{path=app**}">
     <rewrite template="{$frontend[path]}/zeppelin/{path=app**}"/>
   </rule>
+  
+  <rule dir="OUT" 
name="ZEPPELINUI/zeppelin/outbound/javascript/component/tick" 
pattern="'components/{**}">
+    <rewrite template="{$prefix[&#39;,url]}/zeppelin/components/{**}"/>
+  </rule>
+  
+  <rule dir="OUT" 
name="ZEPPELINUI/zeppelin/outbound/javascript/component/tick" 
pattern="'app/{**}">
+    <rewrite template="{$prefix[&#39;,url]}/zeppelin/app/{**}"/>
+  </rule>
+
+  <!-- Filters -->
+  <rule dir="OUT" 
name="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/home" >
+    <rewrite template="{$frontend[path]}/zeppelin/app/home/home.html"/>
+  </rule>
+  
+  <rule dir="OUT" 
name="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/notebook" >
+    <rewrite template="{$frontend[path]}/zeppelin/app/notebook/notebook.html"/>
+  </rule>
+  
+  <rule dir="OUT" 
name="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/jobmanager" >
+    <rewrite 
template="{$frontend[path]}/zeppelin/app/jobmanager/jobmanager.html"/>
+  </rule>
+  
+  <rule dir="OUT" 
name="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/interpreter" >
+    <rewrite 
template="{$frontend[path]}/zeppelin/app/interpreter/interpreter.html"/>
+  </rule>
+  
+  <rule dir="OUT" 
name="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/notebookRepos" >
+    <rewrite 
template="{$frontend[path]}/zeppelin/app/notebook-repository/notebook-repository.html"/>
+  </rule>
+  
+  <rule dir="OUT" 
name="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/credential" >
+    <rewrite 
template="{$frontend[path]}/zeppelin/app/credential/credential.html"/>
+  </rule>
+  
+  <rule dir="OUT" 
name="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/helium" >
+    <rewrite template="{$frontend[path]}/zeppelin/app/helium/helium.html"/>
+  </rule>
+  
+  <rule dir="OUT" 
name="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/configuration" >
+    <rewrite 
template="{$frontend[path]}/zeppelin/app/configuration/configuration.html"/>
+  </rule>
+  
+  <rule dir="OUT" 
name="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/searchTerm" >
+    <rewrite 
template="{$frontend[path]}/zeppelin/app/search/result-list.html"/>
+  </rule>
+  
+  <filter name="ZEPPELINUI/zeppelin/outbound/javascript/filter">
+          <content type="application/javascript">
+              <apply path="app/home/home.html" 
rule="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/home"/>
+              <apply path="app/notebook/notebook.html" 
rule="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/notebook"/>
+              <apply path="app/jobmanager/jobmanager.html" 
rule="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/jobmanager"/>
+              <apply path="app/interpreter/interpreter.html" 
rule="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/interpreter"/>
+              <apply path="app/notebook-repository/notebook-repository.html" 
rule="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/notebookRepos"/>
+              <apply path="app/credential/credential.html" 
rule="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/credential"/>
+              <apply path="app/helium/helium.html" 
rule="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/helium"/>
+              <apply path="app/configuration/configuration.html" 
rule="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/configuration"/>
+              <apply path="app/search/result-list.html" 
rule="ZEPPELINUI/zeppelin/outbound/javascript/filter/app/searchTerm"/>
+          </content>
+  </filter>
 
 </rules>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/b9b0db2e/gateway-service-definitions/src/main/resources/services/zeppelinui/0.6.0/service.xml
----------------------------------------------------------------------
diff --git 
a/gateway-service-definitions/src/main/resources/services/zeppelinui/0.6.0/service.xml
 
b/gateway-service-definitions/src/main/resources/services/zeppelinui/0.6.0/service.xml
index 7702e25..4b692fe 100644
--- 
a/gateway-service-definitions/src/main/resources/services/zeppelinui/0.6.0/service.xml
+++ 
b/gateway-service-definitions/src/main/resources/services/zeppelinui/0.6.0/service.xml
@@ -23,6 +23,11 @@
     <policy role="authorization"/>
   </policies>
   <routes>
+    <!-- Filter -->
+    <route path="/zeppelin/scripts/**">
+      <rewrite apply="ZEPPELINUI/zeppelin/outbound/javascript/filter" 
to="response.body"/>
+    </route>
+
     <route path="/zeppelin/">
       <rewrite apply="ZEPPELINUI/zeppelin/inbound/root" to="request.url"/>
     </route>

Reply via email to