You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by mo...@apache.org on 2017/09/01 13:17:12 UTC
[14/64] [partial] knox git commit: KNOX-998 - Refactoring save 1
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/noop.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/noop.xml b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/noop.xml
deleted file mode 100644
index a716582..0000000
--- a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/noop.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?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.
--->
-<rules/>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/simple.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/simple.xml b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/simple.xml
deleted file mode 100644
index 729a2d4..0000000
--- a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/simple.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?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.
--->
-<rules>
-</rules>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest/rewrite.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest/rewrite.xml b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest/rewrite.xml
deleted file mode 100644
index 2e1d5af..0000000
--- a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest/rewrite.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<!--
- 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.
--->
-<rules>
-</rules>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/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
deleted file mode 100644
index 3b77eb3..0000000
--- a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest/rewrite.xml
+++ /dev/null
@@ -1,109 +0,0 @@
-<!--
- 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.
--->
-<rules>
-
- <rule name="test-rule-1" url="{scheme=*}://{host=*}:{port=*}/{path=**}">
- <rewrite template="{scheme}://{host}:{port}/test-output-path-1"/>
- </rule>
-
- <rule name="test-rule-2" url="{scheme=*}://{host=*}:{port=*}/{path=**}">
- <rewrite template="{scheme}://{host}:{port}/test-output-path-2"/>
- </rule>
-
- <rule name="test-rule-username">
- <match pattern="*://{host}:{port}/{path=**}?{**}"/>
- <rewrite template="test-output-scheme://{host}:{port}/test-output-path/{path=**}?user.name={$username}?{**}?test-output-query-name=test-output-query-value"/>
- </rule>
-
- <rule name="test-rule-scvreg-all">
- <match pattern="{*}://{*}:{*}/{**}?{**}"/>
- <rewrite template="{$serviceScheme[NAMENODE]}://{$serviceHost[NAMENODE]:{$servicePort[NAMENOCE]}/{$servicePath[NAMENODE]}"/>
- </rule>
-
- <rule name="test-rule-scvreg-url">
- <match pattern="{*}://{*}:{*}/{**}?{**}"/>
- <rewrite template="{$serviceScheme[NAMENODE]}://{$serviceHost[NAMENODE]:{$servicePort[NAMENOCE]}/{$servicePath[NAMENODE]}"/>
- </rule>
-
- <rule name="test-rule-scvreg-addr">
- <match pattern="{*}://{*}:{*}/{**}?{**}"/>
- <rewrite template="{$serviceUrl[NAMENODE]}"/>
- </rule>
-
- <rule name="test-rule-scvreg-addr">
- <match pattern="{*}://{*}:{*}/{**}?{**}"/>
- <rewrite template="test-protocol://{$serviceAddr[NAMENODE]}/test-path"/>
- </rule>
-
- <rule name="test-rule-html-attribute">
- <rewrite template="http://someotherhost/stylesheets/pretty.css"/>
- </rule>
-
- <rule name="test-rule-html-import-attribute">
- <rewrite template="{$import[", url]}/stylesheets/pretty.css";"/>
- </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[',url]}/zeppelin/components/{**}?{**}"/>
- </rule>
-
- <filter name="test-filter-1">
- <content type="application/json">
- <apply path="$.url" rule="test-rule-1"/>
- </content>
- <content type="*/xml">
- <apply path="/root/@url" rule="test-rule-1"/>
- <apply path="/root/url" rule="test-rule-1"/>
- </content>
- </filter>
-
- <filter name="test-filter-2">
- <content type="application/x-http-headers">
- <apply path="Location" rule="test-rule-2"/>
- </content>
- <content type="application/x-www-form-urlencoded">
- <apply path="url" rule="test-rule-2"/>
- </content>
- <content type="application/json">
- <apply path="$.url" rule="test-rule-2"/>
- </content>
- <content type="*/xml">
- <apply path="/root/@url" rule="test-rule-2"/>
- <apply path="/root/url" rule="test-rule-2"/>
- </content>
- </filter>
-
- <filter name="test-filter-3">
- <content type="*/xml">
- <apply path="$.url" rule="test-rule-2"/>
- </content>
- </filter>
-
- <filter name="test-filter-4">
- <content type="*/html">
- <apply path="pretty.css" rule="test-rule-html-attribute"/>
- </content>
- </filter>
-
- <filter name="test-filter-5">
- <content type="*/html">
- <apply path="(@import)+ .*css.*" rule="test-rule-html-import-attribute"/>
- </content>
- </filter>
-
-</rules>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest/rewrite.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest/rewrite.xml b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest/rewrite.xml
deleted file mode 100644
index c55eb77..0000000
--- a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest/rewrite.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<!--
- 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.
--->
-<rules>
-
- <rule name="test-rule-frontend-url">
- <rewrite template="{$frontend[url]}"/>
- </rule>
-
- <rule name="test-rule-frontend-scheme">
- <rewrite template="{$frontend[scheme]}"/>
- </rule>
-
- <rule name="test-rule-frontend-host">
- <rewrite template="{$frontend[host]}"/>
- </rule>
-
- <rule name="test-rule-frontend-port">
- <rewrite template="{$frontend[port]}"/>
- </rule>
-
- <rule name="test-rule-frontend-addr">
- <rewrite template="{$frontend[addr]}"/>
- </rule>
-
- <rule name="test-rule-frontend-address">
- <rewrite template="{$frontend[address]}"/>
- </rule>
-
- <rule name="test-rule-frontend-path">
- <rewrite template="{$frontend[path]}"/>
- </rule>
-
- <rule name="test-rule-frontend-topology">
- <rewrite template="{$frontend[topology]}"/>
- </rule>
-
- <filter name="test-filter">
- <content type="application/json">
- <apply path="$.url" rule="test-rule-frontend-url"/>
- <apply path="$.scheme" rule="test-rule-frontend-scheme"/>
- <apply path="$.host" rule="test-rule-frontend-host"/>
- <apply path="$.port" rule="test-rule-frontend-port"/>
- <apply path="$.addr" rule="test-rule-frontend-addr"/>
- <apply path="$.address" rule="test-rule-frontend-address"/>
- <apply path="$.path" rule="test-rule-frontend-path"/>
- <apply path="$.topology" rule="test-rule-frontend-topology"/>
- </content>
- </filter>
-
-</rules>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest/test-input-body.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest/test-input-body.json b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest/test-input-body.json
deleted file mode 100644
index ef625d3..0000000
--- a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest/test-input-body.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "url":"test-input-url",
- "scheme":"test-input-scheme",
- "host":"test-input-host",
- "port":"test-input-port",
- "addr":"test-input-addr",
- "address":"test-input-address",
- "path":"test-input-path",
- "topology":"test-input-topology"
-}
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/array.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/array.json b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/array.json
deleted file mode 100644
index d42309d..0000000
--- a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/array.json
+++ /dev/null
@@ -1,4 +0,0 @@
-[
- { "obj1-fld1" : "obj1-val1" },
- { "obj2-fld1" : "obj2-val1" }
-]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/complex.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/complex.json b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/complex.json
deleted file mode 100644
index b9fcf6b..0000000
--- a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/complex.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "test-str": "text",
- "test-int": 42,
- "test-flt": 3.1415927,
- "test-bool": true,
- "test-null": null,
- "test-obj-empty": {},
- "test-ary-empty": [],
- "test-obj-simple": { "obj-inner-name" : "obj-inner-value" },
- "test-ary-simple": [ "ary-inner-value" ],
- "test-obj-nest": { "nested-name": { "obj-inner-name" : "obj-inner-value" } },
- "test-ary-nest": [["nested-value"]],
- "test-ary-obj": [ { "obj-inner-name": "obj-inner-value" } ],
- "test-ary-multi": [ "text", 3.14, { "obj-inner-name": "obj-inner-value" }, [ "arry-inner-value" ] ],
- "test-obj-multi": { "val":"text", "obj": { "obj-inner-name": "obj-inner-value" }, "ary": [ "arry-inner-value" ] }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/dotted-field-name.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/dotted-field-name.json b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/dotted-field-name.json
deleted file mode 100644
index bb18642..0000000
--- a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/dotted-field-name.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "testField": "testField value",
- "test_field": "test_field value",
- "test-field": "test-field value",
- "test.field": "test.field value"
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/empty-array-value.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/empty-array-value.json b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/empty-array-value.json
deleted file mode 100644
index a7f5fb8..0000000
--- a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/empty-array-value.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "empty-array" : []
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/empty-object-value.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/empty-object-value.json b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/empty-object-value.json
deleted file mode 100644
index 414f014..0000000
--- a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/empty-object-value.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "empty-object" : {}
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/properties.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/properties.json b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/properties.json
deleted file mode 100644
index 841e95d..0000000
--- a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/properties.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{ "properties" :
- [
- { "property" :
- { "property-name" : "test-name-1",
- "property-value" : "test-value-1"
- }
- },
- { "property" :
- { "property-name" : "test-name-2",
- "property-value" : "test-value-2"
- }
- },
- { "property" :
- { "property-name" : "test-name-3",
- "property-value" : "test-value-3"
- }
- }
- ]
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/simple-values.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/simple-values.json b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/simple-values.json
deleted file mode 100644
index dd38059..0000000
--- a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/simple-values.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "test-str": "text",
- "test-int": 42,
- "test-flt": 3.1415927,
- "test-bool": true,
- "test-null": null
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest/properties-attributes.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest/properties-attributes.xml b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest/properties-attributes.xml
deleted file mode 100644
index ae308d4..0000000
--- a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest/properties-attributes.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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.
--->
-<properties>
- <property name="test-name-1" value="test-value-1"/>
- <property name="test-name-2" value="test-value-2"/>
- <property name="test-name-3" value="test-value-3"/>
-</properties>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest/properties-elements.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest/properties-elements.xml b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest/properties-elements.xml
deleted file mode 100644
index cb27162..0000000
--- a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest/properties-elements.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-<properties>
- <property>
- <name>test-name-1</name>
- <value>test-value-1</value>
- </property>
- <property>
- <name>test-name-2</name>
- <value>test-value-2</value>
- </property>
- <property>
- <name>test-name-3</name>
- <value>test-value-3</value>
- </property>
-</properties>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest/rewrite-with-same-rules-different-scope.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest/rewrite-with-same-rules-different-scope.xml b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest/rewrite-with-same-rules-different-scope.xml
new file mode 100644
index 0000000..6c27476
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest/rewrite-with-same-rules-different-scope.xml
@@ -0,0 +1,54 @@
+<!--
+ 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.
+-->
+<rules>
+
+ <rule name="test-rule-1" dir="OUT" pattern="*://*:*/**?**">
+ <match pattern="*://{host}:{port}/{path=**}?{**}" />
+ <rewrite template="output-mock-scheme-1://output-mock-host-1:{port}/{path=**}" />
+ </rule>
+
+ <rule name="service-1/test-rule-2" dir="OUT" pattern="*://*:*/**?**">
+ <match pattern="*://{host}:{port}/{path=**}?{**}" />
+ <rewrite template="output-mock-scheme-2://output-mock-host-2:{port}/{path=**}" />
+ </rule>
+
+ <rule name="test-rule-3" dir="OUT" pattern="*://*:*/no-query">
+ <match pattern="{scheme}://{host}:{port}/{path=**}" />
+ <rewrite template="{scheme}://output-mock-host-3:{port}/{path=**}" />
+ </rule>
+
+ <rule name="service-2/test-rule-4" dir="OUT" pattern="*://*:*/no-query">
+ <match pattern="{scheme}://{host}:{port}/{path=**}" />
+ <rewrite template="{scheme}://output-mock-host-4:{port}/{path=**}" />
+ </rule>
+
+ <rule name="service-1/test-rule-5" dir="OUT" pattern="*://*:*/no-query">
+ <match pattern="{scheme}://{host}:{port}/{path=**}" />
+ <rewrite template="{scheme}://output-mock-host-5:{port}/{path=**}" />
+ </rule>
+
+ <rule name="test-rule-6" dir="IN" pattern="*://*:*/**?**">
+ <match pattern="*://{host}:{port}/{path=**}?{**}" />
+ <rewrite template="input-mock-scheme-1://input-mock-host-1:{port}/{path=**}" />
+ </rule>
+
+ <rule name="service-2/test-rule-7" dir="IN" pattern="*://*:*/**?**">
+ <match pattern="*://{host}:{port}/{path=**}?{**}" />
+ <rewrite template="input-mock-scheme-2://input-mock-host-2:{port}/{path=**}" />
+ </rule>
+
+</rules>
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest/rewrite-with-same-rules.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest/rewrite-with-same-rules.xml b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest/rewrite-with-same-rules.xml
new file mode 100644
index 0000000..e3be214
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest/rewrite-with-same-rules.xml
@@ -0,0 +1,39 @@
+<!--
+ 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.
+-->
+<rules>
+
+ <rule name="test-rule-1" dir="OUT" pattern="*://*:*/**?**">
+ <match pattern="*://{host}:{port}/{path=**}?{**}" />
+ <rewrite template="output-mock-scheme-1://output-mock-host-1:{port}/{path=**}" />
+ </rule>
+
+ <rule name="test-rule-2" dir="OUT" pattern="*://*:*/**?**">
+ <match pattern="*://{host}:{port}/{path=**}?{**}" />
+ <rewrite template="output-mock-scheme-2://output-mock-host-2:{port}/{path=**}" />
+ </rule>
+
+ <rule name="test-rule-3" dir="OUT" pattern="*://*:*/no-query">
+ <match pattern="{scheme}://{host}:{port}/{path=**}" />
+ <rewrite template="{scheme}://output-mock-host-3:{port}/{path=**}" />
+ </rule>
+
+ <rule name="test-rule-4" dir="OUT" pattern="*://*:*/no-query">
+ <match pattern="{scheme}://{host}:{port}/{path=**}" />
+ <rewrite template="{scheme}://output-mock-host-4:{port}/{path=**}" />
+ </rule>
+
+</rules>
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest/rewrite.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest/rewrite.xml b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest/rewrite.xml
new file mode 100644
index 0000000..84836d5
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest/rewrite.xml
@@ -0,0 +1,36 @@
+<!--
+ 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.
+-->
+<rules>
+ <rule name="test-rule-1" url="{scheme=*}://{host=*}:{port=*}/{path=**}">
+ <rewrite param="{scheme}://{host}:{port}/test-output-path"/>
+ </rule>
+
+ <rule dir="OUT" name="test-rule-2">
+ <match pattern="*://*:*/{path=**}?{**}"/>
+ <rewrite template="test-scheme-output://test-host-output:777/test-path-output/{path}?{**}"/>
+ </rule>
+
+ <rule name="test-rule-with-complex-flow" flow="OR">
+ <match pattern="*://*:*/~/{path=**}?{**}">
+ <rewrite template="test-scheme-output://test-host-output:777/test-path-output/test-home/{path}?{**}"/>
+ </match>
+ <match pattern="*://*:*/{path=**}?{**}">
+ <rewrite template="test-scheme-output://test-host-output:42/test-path-output/{path}?{**}"/>
+ </match>
+ </rule>
+
+</rules>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/empty.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/empty.xml b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/empty.xml
new file mode 100644
index 0000000..1e2850e
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/empty.xml
@@ -0,0 +1,16 @@
+<!--
+ 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.
+-->
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/filter-complete.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/filter-complete.xml b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/filter-complete.xml
new file mode 100644
index 0000000..54789c5
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/filter-complete.xml
@@ -0,0 +1,33 @@
+<?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.
+-->
+<rules>
+ <filter name="test-filter-name-1">
+ <content type="test-content-type-1/test-content-subtype-1">
+ <apply path="test-apply-path-1" rule="test-apply-rule-1"/>
+ <scope path="test-scope-path-1">
+ <apply path="test-apply-path-2" rule="test-apply-rule-2"/>
+ </scope>
+ <buffer path="test-buffer-path-1">
+ <apply path="test-apply-path-3" rule="test-apply-rule-3"/>
+ <detect path="test-detect-path-1" value="test-detect-value-1">
+ <apply path="test-apply-path-4" rule="test-apply-rule-4"/>
+ </detect>
+ </buffer>
+ </content>
+ </filter>
+</rules>
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/filter-sample.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/filter-sample.xml b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/filter-sample.xml
new file mode 100644
index 0000000..60da1d3
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/filter-sample.xml
@@ -0,0 +1,37 @@
+<?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.
+-->
+<rules>
+ <filter name="WEBHDFS/request">
+ <content type="http/header">
+ <apply target="Location" rule="{rewrite-rule-name}"/>
+ <apply>...</apply>
+ </content>
+ <content type="http/cookie">
+ <apply target="hadoop.auth" rule="{rewrite-rule-name}"/>
+ </content>
+ <content type="*/json" name="{filter-impl-name}">
+ <select node="/config/property">
+ <choice source="name" pattern="YarnNodeManager ">
+ <apply target="value[2]" rule="{rewrite-rule-name}"/>
+ <apply target="value[3]" rule="{rewrite-rule-name}"/>
+ </choice>
+ <choice>...</choice>
+ </select>
+ </content>
+ </filter>
+</rules>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/filter-simple.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/filter-simple.xml b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/filter-simple.xml
new file mode 100644
index 0000000..f31de77
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/filter-simple.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<rules>
+ <filter name="test-filter-1">
+ <content type="test-content-type-1/test-content-subtype-1">
+ <apply path="test-apply-path-1" rule="test-apply-rule-1"/>
+ </content>
+ </filter>
+</rules>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/invalid.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/invalid.xml b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/invalid.xml
new file mode 100644
index 0000000..6508f3f
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/invalid.xml
@@ -0,0 +1,18 @@
+<?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.
+-->
+</invalid>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/noop.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/noop.xml b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/noop.xml
new file mode 100644
index 0000000..a716582
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/noop.xml
@@ -0,0 +1,18 @@
+<?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.
+-->
+<rules/>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/simple.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/simple.xml b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/simple.xml
new file mode 100644
index 0000000..729a2d4
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest/simple.xml
@@ -0,0 +1,19 @@
+<?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.
+-->
+<rules>
+</rules>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest/rewrite.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest/rewrite.xml b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest/rewrite.xml
new file mode 100644
index 0000000..2e1d5af
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest/rewrite.xml
@@ -0,0 +1,18 @@
+<!--
+ 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.
+-->
+<rules>
+</rules>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest/rewrite.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest/rewrite.xml b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest/rewrite.xml
new file mode 100644
index 0000000..3b77eb3
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest/rewrite.xml
@@ -0,0 +1,109 @@
+<!--
+ 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.
+-->
+<rules>
+
+ <rule name="test-rule-1" url="{scheme=*}://{host=*}:{port=*}/{path=**}">
+ <rewrite template="{scheme}://{host}:{port}/test-output-path-1"/>
+ </rule>
+
+ <rule name="test-rule-2" url="{scheme=*}://{host=*}:{port=*}/{path=**}">
+ <rewrite template="{scheme}://{host}:{port}/test-output-path-2"/>
+ </rule>
+
+ <rule name="test-rule-username">
+ <match pattern="*://{host}:{port}/{path=**}?{**}"/>
+ <rewrite template="test-output-scheme://{host}:{port}/test-output-path/{path=**}?user.name={$username}?{**}?test-output-query-name=test-output-query-value"/>
+ </rule>
+
+ <rule name="test-rule-scvreg-all">
+ <match pattern="{*}://{*}:{*}/{**}?{**}"/>
+ <rewrite template="{$serviceScheme[NAMENODE]}://{$serviceHost[NAMENODE]:{$servicePort[NAMENOCE]}/{$servicePath[NAMENODE]}"/>
+ </rule>
+
+ <rule name="test-rule-scvreg-url">
+ <match pattern="{*}://{*}:{*}/{**}?{**}"/>
+ <rewrite template="{$serviceScheme[NAMENODE]}://{$serviceHost[NAMENODE]:{$servicePort[NAMENOCE]}/{$servicePath[NAMENODE]}"/>
+ </rule>
+
+ <rule name="test-rule-scvreg-addr">
+ <match pattern="{*}://{*}:{*}/{**}?{**}"/>
+ <rewrite template="{$serviceUrl[NAMENODE]}"/>
+ </rule>
+
+ <rule name="test-rule-scvreg-addr">
+ <match pattern="{*}://{*}:{*}/{**}?{**}"/>
+ <rewrite template="test-protocol://{$serviceAddr[NAMENODE]}/test-path"/>
+ </rule>
+
+ <rule name="test-rule-html-attribute">
+ <rewrite template="http://someotherhost/stylesheets/pretty.css"/>
+ </rule>
+
+ <rule name="test-rule-html-import-attribute">
+ <rewrite template="{$import[", url]}/stylesheets/pretty.css";"/>
+ </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[',url]}/zeppelin/components/{**}?{**}"/>
+ </rule>
+
+ <filter name="test-filter-1">
+ <content type="application/json">
+ <apply path="$.url" rule="test-rule-1"/>
+ </content>
+ <content type="*/xml">
+ <apply path="/root/@url" rule="test-rule-1"/>
+ <apply path="/root/url" rule="test-rule-1"/>
+ </content>
+ </filter>
+
+ <filter name="test-filter-2">
+ <content type="application/x-http-headers">
+ <apply path="Location" rule="test-rule-2"/>
+ </content>
+ <content type="application/x-www-form-urlencoded">
+ <apply path="url" rule="test-rule-2"/>
+ </content>
+ <content type="application/json">
+ <apply path="$.url" rule="test-rule-2"/>
+ </content>
+ <content type="*/xml">
+ <apply path="/root/@url" rule="test-rule-2"/>
+ <apply path="/root/url" rule="test-rule-2"/>
+ </content>
+ </filter>
+
+ <filter name="test-filter-3">
+ <content type="*/xml">
+ <apply path="$.url" rule="test-rule-2"/>
+ </content>
+ </filter>
+
+ <filter name="test-filter-4">
+ <content type="*/html">
+ <apply path="pretty.css" rule="test-rule-html-attribute"/>
+ </content>
+ </filter>
+
+ <filter name="test-filter-5">
+ <content type="*/html">
+ <apply path="(@import)+ .*css.*" rule="test-rule-html-import-attribute"/>
+ </content>
+ </filter>
+
+</rules>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest/rewrite.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest/rewrite.xml b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest/rewrite.xml
new file mode 100644
index 0000000..c55eb77
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest/rewrite.xml
@@ -0,0 +1,64 @@
+<!--
+ 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.
+-->
+<rules>
+
+ <rule name="test-rule-frontend-url">
+ <rewrite template="{$frontend[url]}"/>
+ </rule>
+
+ <rule name="test-rule-frontend-scheme">
+ <rewrite template="{$frontend[scheme]}"/>
+ </rule>
+
+ <rule name="test-rule-frontend-host">
+ <rewrite template="{$frontend[host]}"/>
+ </rule>
+
+ <rule name="test-rule-frontend-port">
+ <rewrite template="{$frontend[port]}"/>
+ </rule>
+
+ <rule name="test-rule-frontend-addr">
+ <rewrite template="{$frontend[addr]}"/>
+ </rule>
+
+ <rule name="test-rule-frontend-address">
+ <rewrite template="{$frontend[address]}"/>
+ </rule>
+
+ <rule name="test-rule-frontend-path">
+ <rewrite template="{$frontend[path]}"/>
+ </rule>
+
+ <rule name="test-rule-frontend-topology">
+ <rewrite template="{$frontend[topology]}"/>
+ </rule>
+
+ <filter name="test-filter">
+ <content type="application/json">
+ <apply path="$.url" rule="test-rule-frontend-url"/>
+ <apply path="$.scheme" rule="test-rule-frontend-scheme"/>
+ <apply path="$.host" rule="test-rule-frontend-host"/>
+ <apply path="$.port" rule="test-rule-frontend-port"/>
+ <apply path="$.addr" rule="test-rule-frontend-addr"/>
+ <apply path="$.address" rule="test-rule-frontend-address"/>
+ <apply path="$.path" rule="test-rule-frontend-path"/>
+ <apply path="$.topology" rule="test-rule-frontend-topology"/>
+ </content>
+ </filter>
+
+</rules>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest/test-input-body.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest/test-input-body.json b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest/test-input-body.json
new file mode 100644
index 0000000..ef625d3
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest/test-input-body.json
@@ -0,0 +1,10 @@
+{
+ "url":"test-input-url",
+ "scheme":"test-input-scheme",
+ "host":"test-input-host",
+ "port":"test-input-port",
+ "addr":"test-input-addr",
+ "address":"test-input-address",
+ "path":"test-input-path",
+ "topology":"test-input-topology"
+}
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/array.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/array.json b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/array.json
new file mode 100644
index 0000000..d42309d
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/array.json
@@ -0,0 +1,4 @@
+[
+ { "obj1-fld1" : "obj1-val1" },
+ { "obj2-fld1" : "obj2-val1" }
+]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/complex.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/complex.json b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/complex.json
new file mode 100644
index 0000000..b9fcf6b
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/complex.json
@@ -0,0 +1,16 @@
+{
+ "test-str": "text",
+ "test-int": 42,
+ "test-flt": 3.1415927,
+ "test-bool": true,
+ "test-null": null,
+ "test-obj-empty": {},
+ "test-ary-empty": [],
+ "test-obj-simple": { "obj-inner-name" : "obj-inner-value" },
+ "test-ary-simple": [ "ary-inner-value" ],
+ "test-obj-nest": { "nested-name": { "obj-inner-name" : "obj-inner-value" } },
+ "test-ary-nest": [["nested-value"]],
+ "test-ary-obj": [ { "obj-inner-name": "obj-inner-value" } ],
+ "test-ary-multi": [ "text", 3.14, { "obj-inner-name": "obj-inner-value" }, [ "arry-inner-value" ] ],
+ "test-obj-multi": { "val":"text", "obj": { "obj-inner-name": "obj-inner-value" }, "ary": [ "arry-inner-value" ] }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/dotted-field-name.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/dotted-field-name.json b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/dotted-field-name.json
new file mode 100644
index 0000000..bb18642
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/dotted-field-name.json
@@ -0,0 +1,6 @@
+{
+ "testField": "testField value",
+ "test_field": "test_field value",
+ "test-field": "test-field value",
+ "test.field": "test.field value"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/empty-array-value.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/empty-array-value.json b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/empty-array-value.json
new file mode 100644
index 0000000..a7f5fb8
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/empty-array-value.json
@@ -0,0 +1,3 @@
+{
+ "empty-array" : []
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/empty-object-value.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/empty-object-value.json b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/empty-object-value.json
new file mode 100644
index 0000000..414f014
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/empty-object-value.json
@@ -0,0 +1,3 @@
+{
+ "empty-object" : {}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/properties.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/properties.json b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/properties.json
new file mode 100644
index 0000000..841e95d
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/properties.json
@@ -0,0 +1,19 @@
+{ "properties" :
+ [
+ { "property" :
+ { "property-name" : "test-name-1",
+ "property-value" : "test-value-1"
+ }
+ },
+ { "property" :
+ { "property-name" : "test-name-2",
+ "property-value" : "test-value-2"
+ }
+ },
+ { "property" :
+ { "property-name" : "test-name-3",
+ "property-value" : "test-value-3"
+ }
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/simple-values.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/simple-values.json b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/simple-values.json
new file mode 100644
index 0000000..dd38059
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/simple-values.json
@@ -0,0 +1,7 @@
+{
+ "test-str": "text",
+ "test-int": 42,
+ "test-flt": 3.1415927,
+ "test-bool": true,
+ "test-null": null
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest/properties-attributes.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest/properties-attributes.xml b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest/properties-attributes.xml
new file mode 100644
index 0000000..ae308d4
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest/properties-attributes.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+<properties>
+ <property name="test-name-1" value="test-value-1"/>
+ <property name="test-name-2" value="test-value-2"/>
+ <property name="test-name-3" value="test-value-3"/>
+</properties>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest/properties-elements.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest/properties-elements.xml b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest/properties-elements.xml
new file mode 100644
index 0000000..cb27162
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest/properties-elements.xml
@@ -0,0 +1,31 @@
+<?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.
+-->
+<properties>
+ <property>
+ <name>test-name-1</name>
+ <value>test-value-1</value>
+ </property>
+ <property>
+ <name>test-name-2</name>
+ <value>test-value-2</value>
+ </property>
+ <property>
+ <name>test-name-3</name>
+ <value>test-value-3</value>
+ </property>
+</properties>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-security-authc-anon/src/main/java/org/apache/hadoop/gateway/deploy/AnonymousAuthDeploymentContributor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-authc-anon/src/main/java/org/apache/hadoop/gateway/deploy/AnonymousAuthDeploymentContributor.java b/gateway-provider-security-authc-anon/src/main/java/org/apache/hadoop/gateway/deploy/AnonymousAuthDeploymentContributor.java
deleted file mode 100755
index b49643d..0000000
--- a/gateway-provider-security-authc-anon/src/main/java/org/apache/hadoop/gateway/deploy/AnonymousAuthDeploymentContributor.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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.
- */
-package org.apache.hadoop.gateway.deploy;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.hadoop.gateway.descriptor.FilterParamDescriptor;
-import org.apache.hadoop.gateway.descriptor.ResourceDescriptor;
-import org.apache.hadoop.gateway.topology.Provider;
-import org.apache.hadoop.gateway.topology.Service;
-
-public class AnonymousAuthDeploymentContributor extends ProviderDeploymentContributorBase {
-
- private static final String ROLE = "authentication";
- private static final String NAME = "Anonymous";
-
- private static final String FILTER_CLASSNAME = "org.apache.hadoop.gateway.filter.AnonymousAuthFilter";
-
- @Override
- public String getRole() {
- return ROLE;
- }
-
- @Override
- public String getName() {
- return NAME;
- }
-
- @Override
- public void initializeContribution(DeploymentContext context) {
- super.initializeContribution(context);
- }
-
- @Override
- public void contributeFilter(DeploymentContext context, Provider provider, Service service,
- ResourceDescriptor resource, List<FilterParamDescriptor> params) {
- // blindly add all the provider params as filter init params
- if (params == null) {
- params = new ArrayList<>();
- }
- Map<String, String> providerParams = provider.getParams();
- for(Entry<String, String> entry : providerParams.entrySet()) {
- params.add( resource.createFilterParam().name( entry.getKey().toLowerCase() ).value( entry.getValue() ) );
- }
- resource.addFilter().name( getName() ).role( getRole() ).impl(FILTER_CLASSNAME).params( params );
- }
-}
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-security-authc-anon/src/main/java/org/apache/hadoop/gateway/filter/AnonymousAuthFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-authc-anon/src/main/java/org/apache/hadoop/gateway/filter/AnonymousAuthFilter.java b/gateway-provider-security-authc-anon/src/main/java/org/apache/hadoop/gateway/filter/AnonymousAuthFilter.java
deleted file mode 100755
index 59b64fd..0000000
--- a/gateway-provider-security-authc-anon/src/main/java/org/apache/hadoop/gateway/filter/AnonymousAuthFilter.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * 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.
- */
-package org.apache.hadoop.gateway.filter;
-
-import org.apache.hadoop.gateway.audit.api.Action;
-import org.apache.hadoop.gateway.audit.api.ActionOutcome;
-import org.apache.hadoop.gateway.audit.api.AuditService;
-import org.apache.hadoop.gateway.audit.api.AuditServiceFactory;
-import org.apache.hadoop.gateway.audit.api.Auditor;
-import org.apache.hadoop.gateway.audit.api.ResourceType;
-import org.apache.hadoop.gateway.audit.log4j.audit.AuditConstants;
-import org.apache.hadoop.gateway.security.PrimaryPrincipal;
-
-import java.io.IOException;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import javax.security.auth.Subject;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-public class AnonymousAuthFilter implements Filter {
- private static AuditService auditService = AuditServiceFactory.getAuditService();
- private static Auditor auditor = auditService.getAuditor(
- AuditConstants.DEFAULT_AUDITOR_NAME, AuditConstants.KNOX_SERVICE_NAME,
- AuditConstants.KNOX_COMPONENT_NAME );
-
- @Override
- public void init(FilterConfig filterConfig) throws ServletException {
-
- }
-
- @Override
- public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
- HttpServletRequest httpRequest = (HttpServletRequest)request;
- String principal = httpRequest.getRemoteUser();
- if (principal == null) {
- principal = "anonymous";
- }
- Subject subject = new Subject();
- subject.getPrincipals().add(new PrimaryPrincipal(principal));
- auditService.getContext().setUsername( principal ); //KM: Audit Fix
- String sourceUri = (String)request.getAttribute( AbstractGatewayFilter.SOURCE_REQUEST_CONTEXT_URL_ATTRIBUTE_NAME );
- auditor.audit( Action.AUTHENTICATION , sourceUri, ResourceType.URI, ActionOutcome.SUCCESS );
- continueWithEstablishedSecurityContext(subject, (HttpServletRequest)request, (HttpServletResponse)response, filterChain);
- }
-
- private void continueWithEstablishedSecurityContext(Subject subject, final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) throws IOException, ServletException {
- try {
- Subject.doAs(
- subject,
- new PrivilegedExceptionAction<Object>() {
- @Override
- public Object run() throws Exception {
- chain.doFilter(request, response);
- return null;
- }
- }
- );
- }
- catch (PrivilegedActionException e) {
- Throwable t = e.getCause();
- if (t instanceof IOException) {
- throw (IOException) t;
- }
- else if (t instanceof ServletException) {
- throw (ServletException) t;
- }
- else {
- throw new ServletException(t);
- }
- }
- }
-
-
- @Override
- public void destroy() {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-security-authc-anon/src/main/java/org/apache/knox/gateway/deploy/AnonymousAuthDeploymentContributor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-authc-anon/src/main/java/org/apache/knox/gateway/deploy/AnonymousAuthDeploymentContributor.java b/gateway-provider-security-authc-anon/src/main/java/org/apache/knox/gateway/deploy/AnonymousAuthDeploymentContributor.java
new file mode 100755
index 0000000..e0c0609
--- /dev/null
+++ b/gateway-provider-security-authc-anon/src/main/java/org/apache/knox/gateway/deploy/AnonymousAuthDeploymentContributor.java
@@ -0,0 +1,65 @@
+/**
+ * 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.
+ */
+package org.apache.knox.gateway.deploy;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.knox.gateway.descriptor.FilterParamDescriptor;
+import org.apache.knox.gateway.descriptor.ResourceDescriptor;
+import org.apache.knox.gateway.topology.Provider;
+import org.apache.knox.gateway.topology.Service;
+
+public class AnonymousAuthDeploymentContributor extends ProviderDeploymentContributorBase {
+
+ private static final String ROLE = "authentication";
+ private static final String NAME = "Anonymous";
+
+ private static final String FILTER_CLASSNAME = "AnonymousAuthFilter";
+
+ @Override
+ public String getRole() {
+ return ROLE;
+ }
+
+ @Override
+ public String getName() {
+ return NAME;
+ }
+
+ @Override
+ public void initializeContribution(DeploymentContext context) {
+ super.initializeContribution(context);
+ }
+
+ @Override
+ public void contributeFilter(DeploymentContext context, Provider provider, Service service,
+ ResourceDescriptor resource, List<FilterParamDescriptor> params) {
+ // blindly add all the provider params as filter init params
+ if (params == null) {
+ params = new ArrayList<>();
+ }
+ Map<String, String> providerParams = provider.getParams();
+ for(Entry<String, String> entry : providerParams.entrySet()) {
+ params.add( resource.createFilterParam().name( entry.getKey().toLowerCase() ).value( entry.getValue() ) );
+ }
+ resource.addFilter().name( getName() ).role( getRole() ).impl(FILTER_CLASSNAME).params( params );
+ }
+}
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-security-authc-anon/src/main/java/org/apache/knox/gateway/filter/AnonymousAuthFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-authc-anon/src/main/java/org/apache/knox/gateway/filter/AnonymousAuthFilter.java b/gateway-provider-security-authc-anon/src/main/java/org/apache/knox/gateway/filter/AnonymousAuthFilter.java
new file mode 100755
index 0000000..0d002dd
--- /dev/null
+++ b/gateway-provider-security-authc-anon/src/main/java/org/apache/knox/gateway/filter/AnonymousAuthFilter.java
@@ -0,0 +1,101 @@
+/**
+ * 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.
+ */
+package org.apache.knox.gateway.filter;
+
+import org.apache.knox.gateway.audit.api.Action;
+import org.apache.knox.gateway.audit.api.ActionOutcome;
+import org.apache.knox.gateway.audit.api.AuditService;
+import org.apache.knox.gateway.audit.api.AuditServiceFactory;
+import org.apache.knox.gateway.audit.api.Auditor;
+import org.apache.knox.gateway.audit.api.ResourceType;
+import org.apache.knox.gateway.audit.log4j.audit.AuditConstants;
+import org.apache.knox.gateway.security.PrimaryPrincipal;
+
+import java.io.IOException;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+import javax.security.auth.Subject;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class AnonymousAuthFilter implements Filter {
+ private static AuditService auditService = AuditServiceFactory.getAuditService();
+ private static Auditor auditor = auditService.getAuditor(
+ AuditConstants.DEFAULT_AUDITOR_NAME, AuditConstants.KNOX_SERVICE_NAME,
+ AuditConstants.KNOX_COMPONENT_NAME );
+
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+
+ }
+
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
+ HttpServletRequest httpRequest = (HttpServletRequest)request;
+ String principal = httpRequest.getRemoteUser();
+ if (principal == null) {
+ principal = "anonymous";
+ }
+ Subject subject = new Subject();
+ subject.getPrincipals().add(new PrimaryPrincipal(principal));
+ auditService.getContext().setUsername( principal ); //KM: Audit Fix
+ String sourceUri = (String)request.getAttribute( AbstractGatewayFilter.SOURCE_REQUEST_CONTEXT_URL_ATTRIBUTE_NAME );
+ auditor.audit( Action.AUTHENTICATION , sourceUri, ResourceType.URI, ActionOutcome.SUCCESS );
+ continueWithEstablishedSecurityContext(subject, (HttpServletRequest)request, (HttpServletResponse)response, filterChain);
+ }
+
+ private void continueWithEstablishedSecurityContext(Subject subject, final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) throws IOException, ServletException {
+ try {
+ Subject.doAs(
+ subject,
+ new PrivilegedExceptionAction<Object>() {
+ @Override
+ public Object run() throws Exception {
+ chain.doFilter(request, response);
+ return null;
+ }
+ }
+ );
+ }
+ catch (PrivilegedActionException e) {
+ Throwable t = e.getCause();
+ if (t instanceof IOException) {
+ throw (IOException) t;
+ }
+ else if (t instanceof ServletException) {
+ throw (ServletException) t;
+ }
+ else {
+ throw new ServletException(t);
+ }
+ }
+ }
+
+
+ @Override
+ public void destroy() {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-security-authc-anon/src/main/resources/META-INF/services/org.apache.hadoop.gateway.deploy.ProviderDeploymentContributor
----------------------------------------------------------------------
diff --git a/gateway-provider-security-authc-anon/src/main/resources/META-INF/services/org.apache.hadoop.gateway.deploy.ProviderDeploymentContributor b/gateway-provider-security-authc-anon/src/main/resources/META-INF/services/org.apache.hadoop.gateway.deploy.ProviderDeploymentContributor
deleted file mode 100755
index 99f1edf..0000000
--- a/gateway-provider-security-authc-anon/src/main/resources/META-INF/services/org.apache.hadoop.gateway.deploy.ProviderDeploymentContributor
+++ /dev/null
@@ -1,19 +0,0 @@
-##########################################################################
-# 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.
-##########################################################################
-
-org.apache.hadoop.gateway.deploy.AnonymousAuthDeploymentContributor
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-security-authc-anon/src/main/resources/META-INF/services/org.apache.knox.gateway.deploy.ProviderDeploymentContributor
----------------------------------------------------------------------
diff --git a/gateway-provider-security-authc-anon/src/main/resources/META-INF/services/org.apache.knox.gateway.deploy.ProviderDeploymentContributor b/gateway-provider-security-authc-anon/src/main/resources/META-INF/services/org.apache.knox.gateway.deploy.ProviderDeploymentContributor
new file mode 100755
index 0000000..df2b225
--- /dev/null
+++ b/gateway-provider-security-authc-anon/src/main/resources/META-INF/services/org.apache.knox.gateway.deploy.ProviderDeploymentContributor
@@ -0,0 +1,19 @@
+##########################################################################
+# 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.
+##########################################################################
+
+org.apache.knox.gateway.deploy.AnonymousAuthDeploymentContributor
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-security-authc-anon/src/test/java/org/apache/hadoop/gateway/deploy/AnonymousAuthDeploymentContributorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-authc-anon/src/test/java/org/apache/hadoop/gateway/deploy/AnonymousAuthDeploymentContributorTest.java b/gateway-provider-security-authc-anon/src/test/java/org/apache/hadoop/gateway/deploy/AnonymousAuthDeploymentContributorTest.java
deleted file mode 100644
index 38e25a8..0000000
--- a/gateway-provider-security-authc-anon/src/test/java/org/apache/hadoop/gateway/deploy/AnonymousAuthDeploymentContributorTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.deploy;
-
-import org.junit.Test;
-
-import java.util.Iterator;
-import java.util.ServiceLoader;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.fail;
-
-public class AnonymousAuthDeploymentContributorTest {
-
- @Test
- public void testServiceLoader() throws Exception {
- ServiceLoader loader = ServiceLoader.load( ProviderDeploymentContributor.class );
- Iterator iterator = loader.iterator();
- assertThat( "Service iterator empty.", iterator.hasNext() );
- while( iterator.hasNext() ) {
- Object object = iterator.next();
- if( object instanceof AnonymousAuthDeploymentContributor ) {
- return;
- }
- }
- fail( "Failed to find " + AnonymousAuthDeploymentContributor.class.getName() + " via service loader." );
- }
-
-}