knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject [21/64] [partial] knox git commit: KNOX-998 - Refactoring save 1
Date Fri, 01 Sep 2017 13:17:19 GMT
http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/spi/UrlRewriteStreamFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/spi/UrlRewriteStreamFilter.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/spi/UrlRewriteStreamFilter.java
new file mode 100644
index 0000000..48e8282
--- /dev/null
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/spi/UrlRewriteStreamFilter.java
@@ -0,0 +1,43 @@
+/**
+ * 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.rewrite.spi;
+
+import org.apache.knox.gateway.filter.rewrite.api.UrlRewriteFilterContentDescriptor;
+import org.apache.knox.gateway.filter.rewrite.api.UrlRewriter;
+import org.apache.knox.gateway.util.urltemplate.Resolver;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+// The rewriter will try to find either a stream or reader createFilter for the mime/type and name.
+public interface UrlRewriteStreamFilter {
+
+  String[] getTypes();
+
+  String[] getNames();
+
+  InputStream filter(
+      InputStream stream,
+      String encoding,
+      UrlRewriter rewriter,
+      Resolver resolver,
+      UrlRewriter.Direction direction,
+      UrlRewriteFilterContentDescriptor config )
+          throws IOException;
+
+}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.deploy.ProviderDeploymentContributor
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.deploy.ProviderDeploymentContributor b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.deploy.ProviderDeploymentContributor
deleted file mode 100644
index b17abbb..0000000
--- a/gateway-provider-rewrite/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.filter.rewrite.impl.UrlRewriteDeploymentContributor
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/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
deleted file mode 100644
index 7a086ca..0000000
--- a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteFunctionDescriptor
+++ /dev/null
@@ -1,21 +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.filter.rewrite.api.FrontendFunctionDescriptor
-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/af9b0c3d/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteStepDescriptor
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteStepDescriptor b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteStepDescriptor
deleted file mode 100644
index 158a9f6..0000000
--- a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteStepDescriptor
+++ /dev/null
@@ -1,22 +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.filter.rewrite.ext.UrlRewriteMatchDescriptorExt
-org.apache.hadoop.gateway.filter.rewrite.ext.UrlRewriteCheckDescriptorExt
-org.apache.hadoop.gateway.filter.rewrite.ext.UrlRewriteControlDescriptorExt
-org.apache.hadoop.gateway.filter.rewrite.ext.UrlRewriteActionRewriteDescriptorExt

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/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
deleted file mode 100644
index 23c11a7..0000000
--- a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteFunctionProcessor
+++ /dev/null
@@ -1,21 +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.filter.rewrite.impl.FrontendFunctionProcessor
-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/af9b0c3d/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor
deleted file mode 100644
index 9c7931d..0000000
--- a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor
+++ /dev/null
@@ -1,23 +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.filter.rewrite.impl.UrlRewriteRuleProcessorImpl
-org.apache.hadoop.gateway.filter.rewrite.ext.UrlRewriteMatchProcessorExt
-org.apache.hadoop.gateway.filter.rewrite.ext.UrlRewriteCheckProcessorExt
-org.apache.hadoop.gateway.filter.rewrite.ext.UrlRewriteControlProcessorExt
-org.apache.hadoop.gateway.filter.rewrite.ext.UrlRewriteActionRewriteProcessorExt

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStreamFilter
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStreamFilter b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStreamFilter
deleted file mode 100644
index 06d4eb6..0000000
--- a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStreamFilter
+++ /dev/null
@@ -1,24 +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.filter.rewrite.impl.json.JsonUrlRewriteStreamFilter
-org.apache.hadoop.gateway.filter.rewrite.impl.xml.XmlUrlRewriteStreamFilter
-org.apache.hadoop.gateway.filter.rewrite.impl.html.HtmlUrlRewriteStreamFilter
-org.apache.hadoop.gateway.filter.rewrite.impl.form.FormUrlRewriteStreamFilter
-org.apache.hadoop.gateway.filter.rewrite.impl.noop.NoOpUrlRewriteStreamFilter
-org.apache.hadoop.gateway.filter.rewrite.impl.javascript.JavaScriptUrlRewriteStreamFilter
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.deploy.ProviderDeploymentContributor
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.deploy.ProviderDeploymentContributor b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.deploy.ProviderDeploymentContributor
new file mode 100644
index 0000000..dd88d81
--- /dev/null
+++ b/gateway-provider-rewrite/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.filter.rewrite.impl.UrlRewriteDeploymentContributor
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.api.UrlRewriteFunctionDescriptor
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.api.UrlRewriteFunctionDescriptor b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.api.UrlRewriteFunctionDescriptor
new file mode 100644
index 0000000..3b67183
--- /dev/null
+++ b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.api.UrlRewriteFunctionDescriptor
@@ -0,0 +1,21 @@
+##########################################################################
+# 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.filter.rewrite.api.FrontendFunctionDescriptor
+org.apache.knox.gateway.filter.rewrite.impl.html.HtmlImportFunctionDescriptor
+org.apache.knox.gateway.filter.rewrite.impl.html.HtmlPrefixDescriptor
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.api.UrlRewriteStepDescriptor
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.api.UrlRewriteStepDescriptor b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.api.UrlRewriteStepDescriptor
new file mode 100644
index 0000000..be275cc
--- /dev/null
+++ b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.api.UrlRewriteStepDescriptor
@@ -0,0 +1,22 @@
+##########################################################################
+# 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.filter.rewrite.ext.UrlRewriteMatchDescriptorExt
+org.apache.knox.gateway.filter.rewrite.ext.UrlRewriteCheckDescriptorExt
+org.apache.knox.gateway.filter.rewrite.ext.UrlRewriteControlDescriptorExt
+org.apache.knox.gateway.filter.rewrite.ext.UrlRewriteActionRewriteDescriptorExt

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteFunctionProcessor
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteFunctionProcessor b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteFunctionProcessor
new file mode 100644
index 0000000..099f40d
--- /dev/null
+++ b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteFunctionProcessor
@@ -0,0 +1,21 @@
+##########################################################################
+# 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.filter.rewrite.impl.FrontendFunctionProcessor
+org.apache.knox.gateway.filter.rewrite.impl.html.HtmlImportFunctionProcessor
+org.apache.knox.gateway.filter.rewrite.impl.html.HtmlPrefixProcessor
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteStepProcessor
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteStepProcessor b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteStepProcessor
new file mode 100644
index 0000000..fb26555
--- /dev/null
+++ b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteStepProcessor
@@ -0,0 +1,23 @@
+##########################################################################
+# 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.filter.rewrite.impl.UrlRewriteRuleProcessorImpl
+org.apache.knox.gateway.filter.rewrite.ext.UrlRewriteMatchProcessorExt
+org.apache.knox.gateway.filter.rewrite.ext.UrlRewriteCheckProcessorExt
+org.apache.knox.gateway.filter.rewrite.ext.UrlRewriteControlProcessorExt
+org.apache.knox.gateway.filter.rewrite.ext.UrlRewriteActionRewriteProcessorExt

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteStreamFilter
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteStreamFilter b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteStreamFilter
new file mode 100644
index 0000000..0d347e1
--- /dev/null
+++ b/gateway-provider-rewrite/src/main/resources/META-INF/services/org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteStreamFilter
@@ -0,0 +1,24 @@
+##########################################################################
+# 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.filter.rewrite.impl.json.JsonUrlRewriteStreamFilter
+org.apache.knox.gateway.filter.rewrite.impl.xml.XmlUrlRewriteStreamFilter
+org.apache.knox.gateway.filter.rewrite.impl.html.HtmlUrlRewriteStreamFilter
+org.apache.knox.gateway.filter.rewrite.impl.form.FormUrlRewriteStreamFilter
+org.apache.knox.gateway.filter.rewrite.impl.noop.NoOpUrlRewriteStreamFilter
+org.apache.knox.gateway.filter.rewrite.impl.javascript.JavaScriptUrlRewriteStreamFilter
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/FrontendFunctionDescriptorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/FrontendFunctionDescriptorTest.java b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/FrontendFunctionDescriptorTest.java
deleted file mode 100644
index dfb439e..0000000
--- a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/FrontendFunctionDescriptorTest.java
+++ /dev/null
@@ -1,52 +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.rewrite.api;
-
-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 FrontendFunctionDescriptorTest {
-
-  @SuppressWarnings("rawtypes")
-  @Test
-  public void testServiceLoader() throws Exception {
-    ServiceLoader loader = ServiceLoader.load( UrlRewriteFunctionDescriptor.class );
-    Iterator iterator = loader.iterator();
-    assertThat( "Service iterator empty.", iterator.hasNext() );
-    while( iterator.hasNext() ) {
-      Object object = iterator.next();
-      if( object instanceof FrontendFunctionDescriptor ) {
-        return;
-      }
-    }
-    fail( "Failed to find " + FrontendFunctionDescriptor.class.getName() + " via service loader." );
-  }
-
-  @Test
-  public void testName() throws Exception {
-    FrontendFunctionDescriptor descriptor = new FrontendFunctionDescriptor();
-    assertThat( descriptor.name(), is( "frontend" ) );
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessorTest.java b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessorTest.java
deleted file mode 100644
index 410f60b..0000000
--- a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessorTest.java
+++ /dev/null
@@ -1,412 +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.rewrite.api;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.hadoop.gateway.util.urltemplate.Expander;
-import org.apache.hadoop.gateway.util.urltemplate.Matcher;
-import org.apache.hadoop.gateway.util.urltemplate.Parser;
-import org.apache.hadoop.gateway.util.urltemplate.Template;
-import org.easymock.EasyMock;
-import org.junit.Test;
-
-public class UrlRewriteProcessorTest {
-
-  private static URL getTestResourceUrl( String name ) throws FileNotFoundException {
-    name = UrlRewriteProcessorTest.class.getName().replaceAll( "\\.", "/" ) + "/" + name;
-    URL url = ClassLoader.getSystemResource( name );
-    if( url == null ) {
-      throw new FileNotFoundException( name );
-    }
-    return url;
-  }
-
-  private static InputStream getTestResourceStream( String name ) throws IOException {
-    URL url = getTestResourceUrl( name );
-    InputStream stream = url.openStream();
-    return stream;
-  }
-
-  private static Reader getTestResourceReader( String name, String charset ) throws IOException {
-    return new InputStreamReader( getTestResourceStream( name ), charset );
-  }
-
-  @Test
-  public void testBasicPathRewrite() throws IOException, URISyntaxException {
-    UrlRewriteEnvironment environment = EasyMock.createNiceMock( UrlRewriteEnvironment.class );
-    HttpServletRequest request = EasyMock.createNiceMock( HttpServletRequest.class );
-    HttpServletResponse response = EasyMock.createNiceMock( HttpServletResponse.class );
-    EasyMock.replay( environment, request, response );
-
-    UrlRewriteProcessor processor = new UrlRewriteProcessor();
-    UrlRewriteRulesDescriptor config = UrlRewriteRulesDescriptorFactory.load(
-        "xml", getTestResourceReader( "rewrite.xml", "UTF-8" ) );
-    processor.initialize( environment, config );
-
-    Template inputUrl = Parser.parseLiteral( "test-scheme://test-host:1/test-input-path" );
-    Template outputUrl = processor.rewrite( null, inputUrl, UrlRewriter.Direction.IN, null );
-
-    assertThat( "Expect rewrite to produce a new URL",
-        outputUrl, notNullValue() );
-    assertThat(
-        "Expect rewrite to contain the correct path.",
-        outputUrl.toString(), is( "test-scheme://test-host:1/test-output-path" ) );
-    processor.destroy();
-  }
-
-  @Test
-  public void testMultipleIdenticalRewriteOutputRules() throws IOException, URISyntaxException {
-    UrlRewriteEnvironment environment = EasyMock.createNiceMock( UrlRewriteEnvironment.class );
-    HttpServletRequest request = EasyMock.createNiceMock( HttpServletRequest.class );
-    HttpServletResponse response = EasyMock.createNiceMock( HttpServletResponse.class );
-    EasyMock.replay( environment, request, response );
-
-    UrlRewriteProcessor processor = new UrlRewriteProcessor();
-    UrlRewriteRulesDescriptor config = UrlRewriteRulesDescriptorFactory.load(
-        "xml", getTestResourceReader( "rewrite-with-same-rules.xml", "UTF-8" ) );
-    processor.initialize( environment, config );
-
-    Template inputUrl = Parser.parseLiteral( "scheme://input-mock-host:42/test-input-path" );
-    Template outputUrl = processor.rewrite( null, inputUrl, UrlRewriter.Direction.OUT, null );
-
-    assertThat( "Expect rewrite to produce a new URL",
-        outputUrl, notNullValue() );
-    // Should always pick the first one.
-    assertThat(
-        "Expect rewrite to contain the correct path.",
-        outputUrl.toString(), is( "output-mock-scheme-1://output-mock-host-1:42/test-input-path" ) );
-
-    inputUrl = Parser.parseLiteral( "mock-scheme://input-mock-host:42/no-query" );
-    outputUrl = processor.rewrite( null, inputUrl, UrlRewriter.Direction.OUT, null );
-
-    assertThat(
-        "Expect rewrite to contain the correct path.",
-        outputUrl.toString(), is( "mock-scheme://output-mock-host-3:42/no-query" ) );
-
-    outputUrl = processor.rewrite( null, inputUrl, UrlRewriter.Direction.OUT, "test-rule-4" );
-
-    assertThat(
-        "Expect rewrite to contain the correct path.",
-        outputUrl.toString(), is( "mock-scheme://output-mock-host-4:42/no-query" ) );
-
-    processor.destroy();
-  }
-
-  @Test
-  public void testIdenticalRewriteOutputRulesWithScopes() throws IOException, URISyntaxException {
-    UrlRewriteEnvironment environment = EasyMock.createNiceMock( UrlRewriteEnvironment.class );
-    HttpServletRequest request = EasyMock.createNiceMock( HttpServletRequest.class );
-    HttpServletResponse response = EasyMock.createNiceMock( HttpServletResponse.class );
-    ArrayList<String> roles = new ArrayList<>();
-    roles.add("service-1");
-    EasyMock.expect(environment.resolve("service.role")).andReturn(roles).anyTimes();
-    EasyMock.replay( environment, request, response );
-
-    UrlRewriteProcessor processor = new UrlRewriteProcessor();
-    UrlRewriteRulesDescriptor config = UrlRewriteRulesDescriptorFactory.load(
-        "xml", getTestResourceReader( "rewrite-with-same-rules-different-scope.xml", "UTF-8" ) );
-    processor.initialize( environment, config );
-
-    Template inputUrl = Parser.parseLiteral( "scheme://input-mock-host:42/test-input-path" );
-    Template outputUrl = processor.rewrite( environment, inputUrl, UrlRewriter.Direction.OUT, null );
-
-    assertThat( "Expect rewrite to produce a new URL",
-        outputUrl, notNullValue() );
-    assertThat(
-        "Expect rewrite to contain the correct path.",
-        outputUrl.toString(), is( "output-mock-scheme-2://output-mock-host-2:42/test-input-path" ) );
-
-    inputUrl = Parser.parseLiteral( "mock-scheme://input-mock-host:42/no-query" );
-    outputUrl = processor.rewrite( environment, inputUrl, UrlRewriter.Direction.OUT, null );
-
-    roles.remove(0);
-    roles.add("service-2");
-
-    assertThat(
-        "Expect rewrite to contain the correct path.",
-        outputUrl.toString(), is( "mock-scheme://output-mock-host-5:42/no-query" ) );
-
-    outputUrl = processor.rewrite( environment, inputUrl, UrlRewriter.Direction.OUT, "service-2/test-rule-4" );
-
-    //no scope information should pick the first one
-    assertThat(
-        "Expect rewrite to contain the correct path.",
-        outputUrl.toString(), is( "mock-scheme://output-mock-host-4:42/no-query" ) );
-
-    outputUrl = processor.rewrite( null, inputUrl, UrlRewriter.Direction.OUT, "service-2/test-rule-4" );
-
-    assertThat(
-        "Expect rewrite to contain the correct path.",
-        outputUrl.toString(), is( "mock-scheme://output-mock-host-4:42/no-query" ) );
-
-    //Test the IN direction
-    inputUrl = Parser.parseLiteral( "scheme://input-mock-host:42/test-input-path" );
-    outputUrl = processor.rewrite( environment, inputUrl, UrlRewriter.Direction.IN, null );
-
-    assertThat( "Expect rewrite to produce a new URL",
-        outputUrl, notNullValue() );
-    assertThat(
-        "Expect rewrite to contain the correct path.",
-        outputUrl.toString(), is( "input-mock-scheme-2://input-mock-host-2:42/test-input-path" ) );
-
-    processor.destroy();
-  }
-
-  @Test
-  public void testRewriteViaRuleNameWithAmbiguousRules() throws IOException, URISyntaxException {
-    UrlRewriteEnvironment environment = EasyMock.createNiceMock( UrlRewriteEnvironment.class );
-    HttpServletRequest request = EasyMock.createNiceMock( HttpServletRequest.class );
-    HttpServletResponse response = EasyMock.createNiceMock( HttpServletResponse.class );
-    EasyMock.replay( environment, request, response );
-
-    UrlRewriteProcessor processor = new UrlRewriteProcessor();
-    UrlRewriteRulesDescriptor config = UrlRewriteRulesDescriptorFactory.load(
-        "xml", getTestResourceReader( "rewrite-with-same-rules.xml", "UTF-8" ) );
-    processor.initialize( environment, config );
-
-    Template inputUrl = Parser.parseLiteral( "input-mock-scheme-1://input-mock-host-1:42/test-input-path" );
-    Template outputUrl = processor.rewrite( null, inputUrl, UrlRewriter.Direction.OUT, "test-rule-2" );
-
-    assertThat( "Expect rewrite to produce a new URL",
-        outputUrl, notNullValue() );
-    assertThat(
-        "Expect rewrite to contain the correct path.",
-        outputUrl.toString(), is( "output-mock-scheme-2://output-mock-host-2:42/test-input-path" ) );
-
-    outputUrl = processor.rewrite( null, inputUrl, UrlRewriter.Direction.OUT, "test-rule-1" );
-
-    assertThat( "Expect rewrite to produce a new URL",
-        outputUrl, notNullValue() );
-    assertThat(
-        "Expect rewrite to contain the correct path.",
-        outputUrl.toString(), is( "output-mock-scheme-1://output-mock-host-1:42/test-input-path" ) );
-
-    processor.destroy();
-  }
-
-  @Test
-  public void testRewriteViaRuleWithComplexFlow() throws Exception {
-    UrlRewriteEnvironment environment = EasyMock.createNiceMock( UrlRewriteEnvironment.class );
-    HttpServletRequest request = EasyMock.createNiceMock( HttpServletRequest.class );
-    HttpServletResponse response = EasyMock.createNiceMock( HttpServletResponse.class );
-    EasyMock.replay( environment, request, response );
-
-    UrlRewriteProcessor processor = new UrlRewriteProcessor();
-    UrlRewriteRulesDescriptor config = UrlRewriteRulesDescriptorFactory.load(
-        "xml", getTestResourceReader( "rewrite.xml", "UTF-8" ) );
-    processor.initialize( environment, config );
-
-    Template inputUrl;
-    Template outputUrl;
-
-    inputUrl = Parser.parseLiteral( "test-scheme://test-host:777/test-path" );
-    outputUrl = processor.rewrite( null, inputUrl, UrlRewriter.Direction.IN, "test-rule-with-complex-flow" );
-    assertThat(
-        "Expect rewrite to contain the correct path.",
-        outputUrl.toString(), is( "test-scheme-output://test-host-output:42/test-path-output/test-path" ) );
-
-    inputUrl = Parser.parseLiteral( "test-scheme://test-host:42/~/test-path" );
-    outputUrl = processor.rewrite( null, inputUrl, UrlRewriter.Direction.IN, "test-rule-with-complex-flow" );
-    assertThat(
-        "Expect rewrite to contain the correct path.",
-        outputUrl.toString(), is( "test-scheme-output://test-host-output:777/test-path-output/test-home/test-path" ) );
-
-    processor.destroy();
-  }
-
-  @Test
-  public void testRewriteViaRuleWithWildcardTemplateAndOptionalQuery() throws Exception {
-    UrlRewriteEnvironment environment = EasyMock.createNiceMock( UrlRewriteEnvironment.class );
-    HttpServletRequest request = EasyMock.createNiceMock( HttpServletRequest.class );
-    HttpServletResponse response = EasyMock.createNiceMock( HttpServletResponse.class );
-    EasyMock.replay( environment, request, response );
-
-    UrlRewriteProcessor processor = new UrlRewriteProcessor();
-    UrlRewriteRulesDescriptor config = UrlRewriteRulesDescriptorFactory.load(
-        "xml", getTestResourceReader( "rewrite.xml", "UTF-8" ) );
-    processor.initialize( environment, config );
-
-    Template inputUrl;
-    Template outputUrl;
-
-    inputUrl = Parser.parseLiteral( "test-scheme-input://test-host-input:42/test-path-input-one/test-path-input-two?test-query-name=test-query-value" );
-    outputUrl = processor.rewrite( null, inputUrl, UrlRewriter.Direction.OUT, "test-rule-2" );
-
-    assertThat(
-        "Expect rewrite to contain the correct path and query.",
-        outputUrl.toString(), is( "test-scheme-output://test-host-output:777/test-path-output/test-path-input-one/test-path-input-two?test-query-name=test-query-value" ) );
-
-    inputUrl = Parser.parseLiteral( "test-scheme-input://test-host-input:42/test-path-input-one/test-path-input-two" );
-    outputUrl = processor.rewrite( null, inputUrl, UrlRewriter.Direction.OUT, "test-rule-2" );
-
-    assertThat(
-        "Expect rewrite to contain the correct path.",
-        outputUrl.toString(), is( "test-scheme-output://test-host-output:777/test-path-output/test-path-input-one/test-path-input-two" ) );
-
-    processor.destroy();
-  }
-
-  /**
-   * Tests the rewrite pattern used for re-writing Solr urls passed through Knox.
-   * 
-   * @throws Exception
-   */
-  @Test
-  public void testSolrRewrite() throws Exception {
-    URI inputUri, outputUri;
-    Matcher<Void> matcher;
-    Matcher<Void>.Match match;
-    Template input, pattern, template;
-
-    inputUri = new URI(
-        "https://hortonworks.sandbox.hdp.24.test:8443/gateway/sandbox/solr/TestCollection/select?q=*.*&wt=json&indent=true");
-
-    input = Parser.parseLiteral(inputUri.toString());
-    pattern = Parser.parseTemplate("*://*:*/**/solr/{collection=**}/{query=**}?{**}");
-    template = Parser.parseTemplate("http://sandbox.hortonworks.com/solr/{collection=**}/{query=**}?{**}");
-
-    matcher = new Matcher<Void>();
-    matcher.add(pattern, null);
-    match = matcher.match(input);
-
-    outputUri = Expander.expand(template, match.getParams(), null);
-
-    final String reWrittenScheme = outputUri.getScheme();
-    assertEquals("http", reWrittenScheme);
-
-    final String reWrittenHost = outputUri.getHost();
-    assertEquals("sandbox.hortonworks.com", reWrittenHost);
-
-    final String reWrittenPath = outputUri.getPath();
-    assertEquals("/solr/TestCollection/select", reWrittenPath);
-
-    // Whole thing is (non-deterministicly ordered around the &s):
-    // "q=*.*&wt=json&indent=true"
-    final String reWrittenQuery = outputUri.getQuery();
-
-    // Check individual parameters are present, and have the right value.
-    final Map<String, String> reWrittenParams = mapUrlParameters(reWrittenQuery);
-    assertTrue(reWrittenParams.containsKey("q"));
-    assertEquals("*.*", reWrittenParams.get("q"));
-    assertTrue(reWrittenParams.containsKey("wt"));
-    assertEquals("json", reWrittenParams.get("wt"));
-    assertEquals("true", reWrittenParams.get("indent"));
-  }
-
-
-  @Test
-  public void testSolrRewriteDefaultPort() throws Exception {
-    URI inputUri, outputUri;
-    Matcher<Void> matcher;
-    Matcher<Void>.Match match;
-    Template input, pattern, template;
-
-    inputUri = new URI(
-                "https://hortonworks.sandbox.hdp.24.test/gateway/sandbox/solr/TestCollection/select?q=*.*&wt=json&indent=true");
-
-    input = Parser.parseLiteral(inputUri.toString());
-    pattern = Parser.parseTemplate("*://*:*/**/solr/{collection=**}/{query=**}?{**}");
-    template = Parser.parseTemplate("http://sandbox.hortonworks.com/solr/{collection=**}/{query=**}?{**}");
-
-    matcher = new Matcher<Void>();
-    matcher.add(pattern, null);
-    match = matcher.match(input);
-
-    outputUri = Expander.expand(template, match.getParams(), null);
-
-    final String reWrittenScheme = outputUri.getScheme();
-    assertEquals("http", reWrittenScheme);
-
-    final String reWrittenHost = outputUri.getHost();
-    assertEquals("sandbox.hortonworks.com", reWrittenHost);
-
-    final String reWrittenPath = outputUri.getPath();
-    assertEquals("/solr/TestCollection/select", reWrittenPath);
-
-    // Whole thing is (non-deterministicly ordered around the &s):
-    // "q=*.*&wt=json&indent=true"
-    final String reWrittenQuery = outputUri.getQuery();
-
-    // Check individual parameters are present, and have the right value.
-    final Map<String, String> reWrittenParams = mapUrlParameters(reWrittenQuery);
-    assertTrue(reWrittenParams.containsKey("q"));
-    assertEquals("*.*", reWrittenParams.get("q"));
-    assertTrue(reWrittenParams.containsKey("wt"));
-    assertEquals("json", reWrittenParams.get("wt"));
-    assertEquals("true", reWrittenParams.get("indent"));
-  }
-
-
-  /**
-   * Turn a string containing URL parameters, e.g.
-   * 
-   * <pre>
-   * a=b&c=d&e=f
-   * </pre>
-   * 
-   * into a map such as
-   * <table>
-   * <tr>
-   * <th>Key</th>
-   * <th>Value</th>
-   * </tr>
-   * <tr>
-   * <td>a</td>
-   * <td>b</td>
-   * </tr>
-   * <tr>
-   * <td>c</td>
-   * <td>d</td>
-   * </tr>
-   * </table>
-   * 
-   * @param urlParameters the URL parameter string. Expected to contain something of the form
-   *        "a=b&c=d" etc (i.e. Key=Value separated by &).
-   * @return a map, with the key-values pairs representing the URL parameters.
-   */
-  private Map<String, String> mapUrlParameters(String urlParameters) {
-    final Map<String, String> map = new HashMap<>();
-    for (String pair : urlParameters.split("&")) {
-      String[] kv = pair.split("=");
-      map.put(kv[0], kv[1]);
-    }
-    return map;
-  }
-
-  
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest.java b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest.java
deleted file mode 100644
index fe3f71e..0000000
--- a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest.java
+++ /dev/null
@@ -1,253 +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.rewrite.api;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.hamcrest.Matchers;
-import org.junit.Test;
-import org.xmlmatchers.transform.XmlConverters;
-
-import javax.xml.transform.Source;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.net.URL;
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.CoreMatchers.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-import static org.xmlmatchers.XmlMatchers.hasXPath;
-
-public class UrlRewriteRulesDescriptorFactoryTest {
-
-  @Test
-  public void testCreate() throws Exception {
-    UrlRewriteRulesDescriptor descriptor = UrlRewriteRulesDescriptorFactory.create();
-    assertThat( descriptor, notNullValue() );
-    assertThat( descriptor.getRules(), notNullValue() );
-    assertThat( descriptor.getRules().isEmpty(), is( true ) );
-
-    UrlRewriteRuleDescriptor rule = descriptor.newRule();
-    assertThat( rule, notNullValue() );
-    assertThat( descriptor.getRules().isEmpty(), is( true ) );
-    rule.name( "first" );
-    descriptor.addRule( rule );
-    assertThat( descriptor.getRules().size(), is( 1 ) );
-    assertThat( descriptor.getRule( "first" ), sameInstance( rule ) );
-
-    rule = descriptor.addRule( "second" );
-    assertThat( descriptor.getRules().size(), is( 2 ) );
-  }
-
-  private static URL getTestResourceUrl( String name ) throws FileNotFoundException {
-    name = UrlRewriteRulesDescriptorFactoryTest.class.getName().replaceAll( "\\.", "/" ) + "/" + name;
-    URL url = ClassLoader.getSystemResource( name );
-    if( url == null ) {
-      throw new FileNotFoundException( name );
-    }
-    return url;
-  }
-
-  private static InputStream getTestResourceStream( String name ) throws IOException {
-    URL url = getTestResourceUrl( name );
-    InputStream stream = url.openStream();
-    return stream;
-  }
-
-  private static Reader getTestResourceReader( String name, String charset ) throws IOException {
-    return new InputStreamReader( getTestResourceStream( name ), charset );
-  }
-
-  @Test
-  public void testLoadMissingFile() throws IOException {
-    try {
-      UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "missing.xml", "UTF-8" ) );
-      fail( "Should have thrown a FileNotFoundException." );
-    } catch ( FileNotFoundException e ) {
-      assertThat( e.getMessage(), containsString( "missing.xml" ) );
-    }
-  }
-
-  @Test
-  public void testLoadEmptyFile() throws IOException {
-    Logger logger = org.apache.log4j.LogManager.getLogger( "org.apache.commons.digester3.Digester" );
-    Level level = logger.getLevel();
-    try {
-      logger.setLevel( org.apache.log4j.Level.OFF );
-      UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "empty.xml", "UTF-8" ) );
-      fail( "Should have thrown an IOException." );
-    } catch ( IOException e ) {
-      // Expected.
-    } catch ( Throwable t ) {
-      fail( "Should have thrown an IOException." );
-    } finally {
-      logger.setLevel( level );
-    }
-  }
-
-  @Test
-  public void testLoadInvalidFile() throws IOException {
-    Logger logger = org.apache.log4j.LogManager.getLogger( "org.apache.commons.digester3.Digester" );
-    Level level = logger.getLevel();
-    try {
-      logger.setLevel( org.apache.log4j.Level.OFF );
-      UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "invalid.xml", "UTF-8" ) );
-      fail( "Should have thrown an IOException." );
-    } catch ( IOException e ) {
-      // Expected.
-    } catch ( Throwable t ) {
-      fail( "Should have thrown an IOException." );
-    } finally {
-      logger.setLevel( level );
-    }
-  }
-
-  @Test
-  public void testLoadNoopFile() throws IOException {
-    UrlRewriteRulesDescriptor config =
-        UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "noop.xml", "UTF-8" ) );
-    assertThat( "Rules should be an empty list.", config.getRules().isEmpty(), Matchers.is( true ) );
-  }
-
-  @Test
-  public void testLoadSimpleFile() throws IOException {
-    UrlRewriteRulesDescriptor config =
-        UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "simple.xml", "UTF-8" ) );
-    assertThat( "Failed to load simple config file.", config, notNullValue() );
-  }
-
-  @Test
-  public void testLoadSimpleFilterFile() throws IOException {
-    UrlRewriteRulesDescriptor config =
-        UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "filter-simple.xml", "UTF-8" ) );
-    List<UrlRewriteFilterDescriptor> filters = config.getFilters();
-    assertThat( filters.size(), is( 1 ) );
-    UrlRewriteFilterDescriptor filter = config.getFilter( "test-filter-1" );
-    assertThat( filter, notNullValue() );
-    assertThat( config.getFilters().get(0), sameInstance( filter ) );
-  }
-
-  @Test
-  public void testLoadStoreCompleteFilterFile() throws IOException {
-    UrlRewriteRulesDescriptor config =
-        UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "filter-complete.xml", "UTF-8" ) );
-
-    List<UrlRewriteFilterDescriptor> filters = config.getFilters();
-    assertThat( filters.size(), is( 1 ) );
-
-    UrlRewriteFilterDescriptor filter = config.getFilter( "test-filter-name-1" );
-    assertThat( filter, notNullValue() );
-    assertThat( config.getFilters().get(0), sameInstance( filter ) );
-    assertThat( filter.name(), is( "test-filter-name-1" ) );
-
-    UrlRewriteFilterContentDescriptor content = filter.getContent( "test-content-type-1/test-content-subtype-1" );
-    assertThat( content, notNullValue() );
-    assertThat( content.type(), is( "test-content-type-1/test-content-subtype-1" ) );
-
-    List<UrlRewriteFilterPathDescriptor> selectors = content.getSelectors();
-    assertThat( selectors, notNullValue() );
-    assertThat( selectors.size(), is( 3 ) );
-
-    UrlRewriteFilterApplyDescriptor apply = (UrlRewriteFilterApplyDescriptor)selectors.get( 0 );
-    assertThat( apply, notNullValue() );
-    assertThat( apply.path(), is( "test-apply-path-1" ) );
-    assertThat( apply.rule(), is( "test-apply-rule-1" ) );
-    assertThat( apply.compiledPath(), nullValue() );
-
-    UrlRewriteFilterScopeDescriptor scope = (UrlRewriteFilterScopeDescriptor)selectors.get( 1 );
-    assertThat( scope, notNullValue() );
-    assertThat( scope.path(), is( "test-scope-path-1" ) );
-    assertThat( scope.compiledPath(), nullValue() );
-    List<UrlRewriteFilterPathDescriptor> scopeSelectors = scope.getSelectors();
-    assertThat( scopeSelectors, notNullValue() );
-    assertThat( scopeSelectors.size(), is( 1 ) );
-    UrlRewriteFilterApplyDescriptor scopeApply = (UrlRewriteFilterApplyDescriptor)scopeSelectors.get( 0 );
-    assertThat( scopeApply, notNullValue() );
-    assertThat( scopeApply.path(), is( "test-apply-path-2" ) );
-    assertThat( scopeApply.compiledPath(), nullValue() );
-    assertThat( scopeApply.rule(), is( "test-apply-rule-2" ) );
-
-    UrlRewriteFilterBufferDescriptor buffer = (UrlRewriteFilterBufferDescriptor)selectors.get( 2 );
-    assertThat( buffer, notNullValue() );
-    assertThat( buffer.path(), is( "test-buffer-path-1" ) );
-    assertThat( buffer.compiledPath(), nullValue() );
-    List<UrlRewriteFilterPathDescriptor> bufferSelectors = buffer.getSelectors();
-    assertThat( bufferSelectors, notNullValue() );
-    assertThat( bufferSelectors.size(), is( 2 ) );
-    UrlRewriteFilterApplyDescriptor bufferApply = (UrlRewriteFilterApplyDescriptor)bufferSelectors.get( 0 );
-    assertThat( bufferApply, notNullValue() );
-    assertThat( bufferApply.path(), is( "test-apply-path-3" ) );
-    assertThat( bufferApply.compiledPath(), nullValue() );
-    assertThat( bufferApply.rule(), is( "test-apply-rule-3" ) );
-    UrlRewriteFilterDetectDescriptor bufferDetect = (UrlRewriteFilterDetectDescriptor)bufferSelectors.get( 1 );
-    assertThat( bufferDetect, notNullValue() );
-    assertThat( bufferDetect.value(), is( "test-detect-value-1" ) );
-    assertThat( bufferDetect.compiledValue(), nullValue() );
-    List<UrlRewriteFilterPathDescriptor> detectSelectors = bufferDetect.getSelectors();
-    assertThat( detectSelectors, notNullValue() );
-    assertThat( detectSelectors.size(), is( 1 ) );
-    UrlRewriteFilterApplyDescriptor detectApply = (UrlRewriteFilterApplyDescriptor)detectSelectors.get( 0 );
-    assertThat( detectApply, notNullValue() );
-    assertThat( detectApply.path(), is( "test-apply-path-4" ) );
-    assertThat( detectApply.compiledPath(), nullValue() );
-    assertThat( detectApply.rule(), is( "test-apply-rule-4" ) );
-
-    StringWriter writer = new StringWriter();
-    UrlRewriteRulesDescriptorFactory.store( config, "xml", writer );
-    Source xml = XmlConverters.the( writer.toString() );
-
-    assertThat( xml, notNullValue() );
-    assertThat( xml, hasXPath( "/" ) );
-    assertThat( xml, hasXPath( "/rules" ) );
-    assertThat( xml, hasXPath( "/rules/filter" ) );
-    assertThat( xml, hasXPath( "/rules/filter/@name", equalTo( "test-filter-name-1" ) ) );
-    assertThat( xml, hasXPath( "/rules/filter/content" ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/@type", equalTo( "test-content-type-1/test-content-subtype-1" ) ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/apply" ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/apply/@path", equalTo( "test-apply-path-1" ) ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/apply/@rule", equalTo( "test-apply-rule-1" ) ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/scope" ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/scope/@path", equalTo( "test-scope-path-1" ) ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/scope/apply" ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/scope/apply/@path", equalTo( "test-apply-path-2" ) ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/scope/apply/@rule", equalTo( "test-apply-rule-2" ) ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/buffer" ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/buffer/@path", equalTo( "test-buffer-path-1" ) ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/buffer/apply" ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/buffer/apply/@path", equalTo( "test-apply-path-3" ) ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/buffer/apply/@rule", equalTo( "test-apply-rule-3" ) ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/buffer/detect" ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/buffer/detect/@path", equalTo( "test-detect-path-1" ) ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/buffer/detect/@value", equalTo( "test-detect-value-1" ) ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/buffer/detect/apply" ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/buffer/detect/apply/@path", equalTo( "test-apply-path-4" ) ) );
-    assertThat( xml, hasXPath( "/rules/filter/content/buffer/detect/apply/@rule", equalTo( "test-apply-rule-4" ) ) );
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest.java b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest.java
deleted file mode 100644
index a7b8481..0000000
--- a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest.java
+++ /dev/null
@@ -1,91 +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.rewrite.api;
-
-import org.apache.hadoop.test.mock.MockInteraction;
-import org.apache.hadoop.test.mock.MockServlet;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.http.HttpTester;
-import org.eclipse.jetty.servlet.ServletTester;
-import org.eclipse.jetty.util.ArrayQueue;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import javax.servlet.DispatcherType;
-import java.net.URL;
-import java.util.EnumSet;
-
-import static org.junit.Assert.fail;
-
-public class UrlRewriteServletContextListenerTest {
-
-  private ServletTester server;
-  private HttpTester.Request request;
-  private HttpTester.Response response;
-  private ArrayQueue<MockInteraction> interactions;
-  private MockInteraction interaction;
-
-  private static URL getTestResource( String name ) {
-    name = UrlRewriteServletFilterTest.class.getName().replaceAll( "\\.", "/" ) + "/" + name;
-    URL url = ClassLoader.getSystemResource( name );
-    return url;
-  }
-
-  @Before
-  public void setUp() throws Exception {
-    String descriptorUrl = getTestResource( "rewrite.xml" ).toExternalForm();
-
-    server = new ServletTester();
-    server.setContextPath( "/" );
-    server.getContext().addEventListener( new UrlRewriteServletContextListener() );
-    server.getContext().setInitParameter(
-        UrlRewriteServletContextListener.DESCRIPTOR_LOCATION_INIT_PARAM_NAME, descriptorUrl );
-
-    FilterHolder filter = server.addFilter( UrlRewriteServletFilter.class, "/*", EnumSet.of( DispatcherType.REQUEST ) );
-    filter.setFilter( new UrlRewriteServletFilter() );
-
-    interactions = new ArrayQueue<MockInteraction>();
-
-    ServletHolder servlet = server.addServlet( MockServlet.class, "/" );
-    servlet.setServlet( new MockServlet( "mock-servlet", interactions ) );
-    servlet.setInitParameter(
-        UrlRewriteServletContextListener.DESCRIPTOR_LOCATION_INIT_PARAM_NAME,
-        getTestResource( "rewrite.xml" ).toExternalForm() );
-
-    server.start();
-
-    interaction = new MockInteraction();
-    request = HttpTester.newRequest();
-    response = null;
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    server.stop();
-  }
-
-//  @Test
-//  @Ignore("TODO")
-//  public void testProvider() throws Exception {
-//    fail( "TODO" );
-//  }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletEnvironmentTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletEnvironmentTest.java b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletEnvironmentTest.java
deleted file mode 100644
index 4900805..0000000
--- a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletEnvironmentTest.java
+++ /dev/null
@@ -1,60 +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.rewrite.api;
-
-import org.easymock.EasyMock;
-import org.junit.Test;
-
-import javax.servlet.ServletContext;
-
-import java.net.URL;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
-
-public class UrlRewriteServletEnvironmentTest {
-
-  @Test
-  public void testGetResource() throws Exception {
-    ServletContext context = EasyMock.createNiceMock( ServletContext.class );
-    EasyMock.expect( context.getResource( "test-resource-name" ) ).andReturn( new URL( "http:/test-resource-value" ) ).anyTimes();
-    EasyMock.replay( context );
-    UrlRewriteServletEnvironment env = new UrlRewriteServletEnvironment( context );
-    assertThat( env.getResource( "test-resource-name" ), is( new URL( "http:/test-resource-value" ) ) );
-  }
-
-  @Test
-  public void testGetAttribute() throws Exception {
-    ServletContext context = EasyMock.createNiceMock( ServletContext.class );
-    EasyMock.expect(  context.getAttribute( "test-attribute-name" ) ).andReturn( "test-attribute-value" ).anyTimes();
-    EasyMock.replay( context );
-    UrlRewriteServletEnvironment env = new UrlRewriteServletEnvironment( context );
-    assertThat( (String)env.getAttribute( "test-attribute-name" ), is( "test-attribute-value" ) );
-  }
-
-  @Test
-  public void testResolve() throws Exception {
-    ServletContext context = EasyMock.createNiceMock( ServletContext.class );
-    EasyMock.expect( context.getInitParameter( "test-parameter-name" ) ).andReturn( "test-parameter-value" );
-    EasyMock.replay( context );
-    UrlRewriteServletEnvironment env = new UrlRewriteServletEnvironment( context );
-    assertThat( env.resolve( "test-parameter-name" ), contains( "test-parameter-value" ) );
-  }
-
-}


Mime
View raw message