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:28 UTC

[30/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/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessor.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessor.java
deleted file mode 100644
index c0a5639..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessor.java
+++ /dev/null
@@ -1,182 +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.gateway.filter.rewrite.ext.ScopedMatcher;
-import org.apache.hadoop.gateway.filter.rewrite.i18n.UrlRewriteMessages;
-import org.apache.hadoop.gateway.filter.rewrite.impl.UrlRewriteContextImpl;
-import org.apache.hadoop.gateway.filter.rewrite.impl.UrlRewriteFunctionProcessorFactory;
-import org.apache.hadoop.gateway.filter.rewrite.impl.UrlRewriteRuleProcessorHolder;
-import org.apache.hadoop.gateway.filter.rewrite.impl.UrlRewriteStepProcessorHolder;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteContext;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteFunctionProcessor;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepStatus;
-import org.apache.hadoop.gateway.i18n.messages.MessagesFactory;
-import org.apache.hadoop.gateway.util.urltemplate.Matcher;
-import org.apache.hadoop.gateway.util.urltemplate.Resolver;
-import org.apache.hadoop.gateway.util.urltemplate.Template;
-
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriter.Direction.IN;
-import static org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriter.Direction.OUT;
-
-public class UrlRewriteProcessor implements UrlRewriter {
-
-  private static final UrlRewriteMessages LOG = MessagesFactory.get( UrlRewriteMessages.class );
-
-  UrlRewriteEnvironment environment;
-  UrlRewriteRulesDescriptor descriptor;
-  Map<String,UrlRewriteRuleProcessorHolder> rules = new HashMap<>();
-  ScopedMatcher inbound = new ScopedMatcher();
-  ScopedMatcher outbound = new ScopedMatcher();
-  Map<String,UrlRewriteFunctionProcessor> functions = new HashMap<>();
-
-  public UrlRewriteProcessor() {
-  }
-
-  // Convert the descriptor into processors.
-  public void initialize( UrlRewriteEnvironment environment, UrlRewriteRulesDescriptor descriptor ) {
-    this.environment = environment;
-    this.descriptor = descriptor;
-    initializeFunctions( descriptor );
-    initializeRules( descriptor );
-  }
-
-  public UrlRewriteRulesDescriptor getConfig() {
-    return descriptor;
-  }
-
-  @SuppressWarnings("unchecked")
-  private void initializeFunctions( UrlRewriteRulesDescriptor rules ) {
-    for( String name : UrlRewriteFunctionDescriptorFactory.getNames() ) {
-      try {
-        UrlRewriteFunctionDescriptor descriptor = rules.getFunction( name );
-        UrlRewriteFunctionProcessor processor = UrlRewriteFunctionProcessorFactory.create( name, descriptor );
-        processor.initialize( environment, descriptor );
-        functions.put( name, processor );
-      } catch( Exception e ) {
-        // Ignore it and it won't be available as a function.
-        LOG.failedToInitializeRewriteFunctions( e );
-      }
-    }
-  }
-
-  private void initializeRules( UrlRewriteRulesDescriptor descriptor ) {
-    for( UrlRewriteRuleDescriptor ruleDescriptor : descriptor.getRules() ) {
-      try {
-        UrlRewriteRuleProcessorHolder ruleProcessor = new UrlRewriteRuleProcessorHolder();
-        ruleProcessor.initialize( environment, ruleDescriptor );
-        if( !rules.containsKey( ruleDescriptor.name() ) ) {
-          rules.put( ruleDescriptor.name(), ruleProcessor );
-        }
-        Template template = ruleDescriptor.template();
-        if( template != null ) {
-          EnumSet<Direction> directions = ruleDescriptor.directions();
-          if( directions == null || directions.isEmpty() ) {
-            inbound.add( template, ruleProcessor );
-            outbound.add( template, ruleProcessor );
-          } else if( directions.contains( IN ) ) {
-            inbound.add( template, ruleProcessor );
-          } else if ( directions.contains( OUT ) ) {
-            outbound.add( template, ruleProcessor );
-          }
-        }
-      } catch( Exception e ) {
-        LOG.failedToInitializeRewriteRules( e );
-      }
-    }
-  }
-
-  public void destroy() {
-    for( UrlRewriteStepProcessorHolder rule : rules.values() ) {
-      try {
-        rule.destroy();
-      } catch ( Exception e ) {
-        LOG.failedToDestroyRewriteStepProcessor( e );
-      }
-    }
-    for( UrlRewriteFunctionProcessor function : functions.values() ) {
-      try {
-        function.destroy();
-      } catch( Exception e ) {
-        LOG.failedToDestroyRewriteFunctionProcessor( e );
-      }
-    }
-  }
-
-  @Override
-  public Template rewrite( Resolver resolver, Template inputUri, Direction direction, String ruleName ) {
-    Template outputUri = inputUri;
-    String serviceRole = null;
-    if (resolver != null) {
-      List<String> serviceRoles = resolver.resolve("service.role");
-      if ( serviceRoles != null && !serviceRoles.isEmpty() ) {
-        serviceRole = serviceRoles.get(0);
-      }
-    }
-    UrlRewriteStepProcessorHolder stepHolder = null;
-    String effectiveRuleName = null;
-    if( ruleName == null || "*".equals( ruleName ) ) {
-      ruleName = null; // Used for logging later.
-      Matcher<UrlRewriteRuleProcessorHolder>.Match match = null;
-      switch( direction ) {
-        case IN:
-          match = inbound.match( outputUri, serviceRole );
-          break;
-        case OUT:
-          match = outbound.match( outputUri, serviceRole );
-          break;
-      }
-      if( match != null ) {
-        stepHolder = match.getValue();
-        effectiveRuleName = match.getValue().getRuleName();
-      }
-    } else if( !ruleName.isEmpty() ) {
-      stepHolder = rules.get( ruleName );
-      effectiveRuleName = ruleName;
-    }
-    if( stepHolder != null ) {
-      UrlRewriteContext context = new UrlRewriteContextImpl( environment, resolver, functions, direction, inputUri );
-      try {
-        UrlRewriteStepStatus stepStatus = stepHolder.process( context );
-        if( UrlRewriteStepStatus.SUCCESS == stepStatus ) {
-          outputUri = context.getCurrentUrl();
-          if( ruleName == null ) {
-            LOG.rewroteUrlViaImplicitRule( inputUri, direction, effectiveRuleName, outputUri );
-          } else {
-            LOG.rewroteUrlViaExplicitRule( inputUri, direction, effectiveRuleName, outputUri );
-          }
-        } else {
-          LOG.failedToRewriteUrl( inputUri, direction, effectiveRuleName, stepStatus );
-          outputUri = null;
-        }
-      } catch( Exception e ) {
-        LOG.failedToRewriteUrlDueToException( inputUri, direction, effectiveRuleName, e );
-        outputUri = null;
-      }
-    } else {
-      LOG.noRuleMatchingUrl( inputUri, direction );
-    }
-    return outputUri;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRuleDescriptor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRuleDescriptor.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRuleDescriptor.java
deleted file mode 100644
index 86d0585..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRuleDescriptor.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.apache.hadoop.gateway.util.urltemplate.Template;
-
-import java.net.URISyntaxException;
-import java.util.EnumSet;
-
-/**
- *  <rule name="..." pattern="..." dir="request" flow="and"><match></match></rule>
- */
-public interface UrlRewriteRuleDescriptor extends UrlRewriteFlowDescriptor<UrlRewriteRuleDescriptor> {
-
-  String name();
-
-  UrlRewriteStepDescriptor name( String name );
-
-  String scope();
-
-  UrlRewriteStepDescriptor scope( String scope );
-
-  EnumSet<UrlRewriter.Direction> directions();
-
-  UrlRewriteRuleDescriptor directions( String directions );
-
-  UrlRewriteRuleDescriptor directions( UrlRewriter.Direction... directions );
-
-  String pattern();
-
-  UrlRewriteRuleDescriptor pattern( String pattern ) throws URISyntaxException;
-
-  Template template();
-
-  UrlRewriteRuleDescriptor template( Template pattern );
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptor.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptor.java
deleted file mode 100644
index 461a272..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptor.java
+++ /dev/null
@@ -1,57 +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 java.util.List;
-
-/**
- * <rules><rule></rule></rules>
- */
-public interface UrlRewriteRulesDescriptor {
-
-  void addRules( UrlRewriteRulesDescriptor rules );
-
-  List<UrlRewriteFunctionDescriptor> getFunctions();
-
-  <T extends UrlRewriteFunctionDescriptor<?>> T getFunction( String name );
-
-  <T extends UrlRewriteFunctionDescriptor<?>> T addFunction( String name );
-
-
-  List<UrlRewriteRuleDescriptor> getRules();
-
-  UrlRewriteRuleDescriptor getRule( String name );
-
-  UrlRewriteRuleDescriptor newRule();
-
-  UrlRewriteRuleDescriptor addRule( String name );
-
-  void addRule( UrlRewriteRuleDescriptor rule );
-
-
-  List<UrlRewriteFilterDescriptor> getFilters();
-
-  UrlRewriteFilterDescriptor getFilter( String name );
-
-  UrlRewriteFilterDescriptor newFilter();
-
-  UrlRewriteFilterDescriptor addFilter( String name );
-
-  void addFilter( UrlRewriteFilterDescriptor filter );
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactory.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactory.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactory.java
deleted file mode 100644
index 08a94b4..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactory.java
+++ /dev/null
@@ -1,77 +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.gateway.filter.rewrite.i18n.UrlRewriteResources;
-import org.apache.hadoop.gateway.filter.rewrite.impl.UrlRewriteRulesDescriptorImpl;
-import org.apache.hadoop.gateway.filter.rewrite.impl.xml.XmlUrlRewriteRulesExporter;
-import org.apache.hadoop.gateway.filter.rewrite.impl.xml.XmlUrlRewriteRulesImporter;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteRulesExporter;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteRulesImporter;
-import org.apache.hadoop.gateway.i18n.messages.MessagesFactory;
-import org.apache.hadoop.gateway.i18n.resources.ResourcesFactory;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-public abstract class UrlRewriteRulesDescriptorFactory {
-
-  private static UrlRewriteResources RES = ResourcesFactory.get( UrlRewriteResources.class );
-
-  private static Map<String, UrlRewriteRulesImporter> IMPORTERS = loadImporters();
-  private static Map<String, UrlRewriteRulesExporter> EXPORTERS = loadExporters();
-
-  private UrlRewriteRulesDescriptorFactory() {
-  }
-
-  public static UrlRewriteRulesDescriptor create() {
-    return new UrlRewriteRulesDescriptorImpl();
-  }
-
-  public static UrlRewriteRulesDescriptor load( String format, Reader reader ) throws IOException {
-    UrlRewriteRulesImporter importer = IMPORTERS.get( format );
-    if( importer == null ) {
-      throw new IllegalArgumentException( RES.noImporterForFormat( format ) );
-    }
-    return importer.load( reader );
-  }
-
-  public static void store( UrlRewriteRulesDescriptor descriptor, String format, Writer writer ) throws IOException {
-    UrlRewriteRulesExporter exporter = EXPORTERS.get( format );
-    if( exporter == null ) {
-      throw new IllegalArgumentException( RES.noExporterForFormat( format ) );
-    }
-    exporter.store( descriptor, writer );
-  }
-
-  private static Map<String, UrlRewriteRulesImporter> loadImporters() {
-    Map<String, UrlRewriteRulesImporter> map = new ConcurrentHashMap<String, UrlRewriteRulesImporter>();
-    map.put( "xml", new XmlUrlRewriteRulesImporter() );
-    return map;
-  }
-
-  private static Map<String, UrlRewriteRulesExporter> loadExporters() {
-    Map<String, UrlRewriteRulesExporter> map = new ConcurrentHashMap<String, UrlRewriteRulesExporter>();
-    map.put( "xml", new XmlUrlRewriteRulesExporter() );
-    return map;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListener.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListener.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListener.java
deleted file mode 100644
index d673845..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListener.java
+++ /dev/null
@@ -1,106 +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 javax.servlet.ServletContext;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-
-import org.apache.hadoop.gateway.filter.rewrite.i18n.UrlRewriteMessages;
-import org.apache.hadoop.gateway.i18n.messages.MessagesFactory;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-public class UrlRewriteServletContextListener implements ServletContextListener {
-
-  public static final String PROCESSOR_ATTRIBUTE_NAME = UrlRewriteProcessor.class.getName();
-  public static final String DESCRIPTOR_LOCATION_INIT_PARAM_NAME = "rewriteDescriptorLocation";
-  public static final String DESCRIPTOR_DEFAULT_FILE_NAME = "rewrite.xml";
-  public static final String DESCRIPTOR_DEFAULT_LOCATION = "/WEB-INF/" + DESCRIPTOR_DEFAULT_FILE_NAME;
-  private static final UrlRewriteMessages LOG = MessagesFactory.get( UrlRewriteMessages.class );
-
-  @Override
-  public void contextInitialized( ServletContextEvent event ) {
-    UrlRewriteRulesDescriptor descriptor = null;
-    try {
-      URL url = locateDescriptor( event.getServletContext() );
-      descriptor = loadDescriptor( url );
-    } catch( IOException e ) {
-      throw new IllegalStateException( e );
-    }
-    ServletContext context = event.getServletContext();
-    UrlRewriteEnvironment environment = new UrlRewriteServletEnvironment( context );
-    UrlRewriteProcessor processor = new UrlRewriteProcessor();
-    processor.initialize( environment, descriptor );
-    event.getServletContext().setAttribute( PROCESSOR_ATTRIBUTE_NAME, processor );
-  }
-
-  @Override
-  public void contextDestroyed( ServletContextEvent event ) {
-    UrlRewriteProcessor processor =
-        (UrlRewriteProcessor)event.getServletContext().getAttribute( PROCESSOR_ATTRIBUTE_NAME );
-    event.getServletContext().removeAttribute( PROCESSOR_ATTRIBUTE_NAME );
-    if( processor != null ) {
-      processor.destroy();
-    }
-  }
-
-  public static UrlRewriter getUrlRewriter( ServletContext context ) {
-    return ((UrlRewriteProcessor)context.getAttribute( PROCESSOR_ATTRIBUTE_NAME ));
-  }
-
-  private static URL locateDescriptor( ServletContext context ) throws IOException {
-    String param = context.getInitParameter( DESCRIPTOR_LOCATION_INIT_PARAM_NAME );
-    if( param == null ) {
-      param = DESCRIPTOR_DEFAULT_LOCATION;
-    }
-    URL url;
-    try {
-      url = context.getResource( param );
-    } catch( MalformedURLException e ) {
-      // Ignore it and try using the value directly as a URL.
-      url = null;
-    }
-    if( url == null ) {
-      url = new URL( param );
-    }
-    if( url == null ) {
-      throw new FileNotFoundException( param );
-    }
-    return url;
-  }
-
-  private static UrlRewriteRulesDescriptor loadDescriptor( URL url ) throws IOException {
-    InputStream stream = url.openStream();
-    Reader reader = new InputStreamReader( stream, "UTF-8" );
-    UrlRewriteRulesDescriptor descriptor = UrlRewriteRulesDescriptorFactory.load( "xml", reader );
-    try {
-      reader.close();
-    } catch( IOException closeException ) {
-      LOG.failedToLoadRewriteRulesDescriptor( closeException );
-    }
-    return descriptor;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletEnvironment.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletEnvironment.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletEnvironment.java
deleted file mode 100644
index a5c38ec..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletEnvironment.java
+++ /dev/null
@@ -1,56 +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 javax.servlet.ServletContext;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.List;
-
-public class UrlRewriteServletEnvironment implements UrlRewriteEnvironment {
-
-  private ServletContext context;
-
-  public UrlRewriteServletEnvironment( ServletContext context ) {
-    this.context = context;
-  }
-
-  @Override
-  public URL getResource( String name ) throws MalformedURLException {
-    URL url = context.getResource( name );
-    return url;
-  }
-
-  @Override
-  public <T> T getAttribute( String name ) {
-    T attribute = (T)context.getAttribute( name );
-    return attribute;
-  }
-
-  @Override
-  public List<String> resolve( String name ) {
-    List<String> values = null;
-    String value = context.getInitParameter( name );
-    if( value != null ) {
-      values = Arrays.asList( value );
-    }
-    return values;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilter.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilter.java
deleted file mode 100644
index 74ac67a..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilter.java
+++ /dev/null
@@ -1,63 +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.gateway.filter.AbstractGatewayFilter;
-import org.apache.hadoop.gateway.filter.rewrite.impl.UrlRewriteRequest;
-import org.apache.hadoop.gateway.filter.rewrite.impl.UrlRewriteResponse;
-import org.apache.hadoop.gateway.util.MimeTypes;
-
-import javax.activation.MimeType;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- *
- */
-public class UrlRewriteServletFilter extends AbstractGatewayFilter {
-
-  public static final String REQUEST_URL_RULE_PARAM = "request.url";
-  public static final String REQUEST_HEADERS_FILTER_PARAM = "request.headers";
-  public static final String REQUEST_COOKIES_FILTER_PARAM = "request.cookies";
-  public static final String REQUEST_BODY_FILTER_PARAM = "request.body";
-  public static final String RESPONSE_HEADERS_FILTER_PARAM = "response.headers";
-  public static final String RESPONSE_COOKIES_FILTER_PARAM = "response.cookies";
-  public static final String RESPONSE_BODY_FILTER_PARAM = "response.body";
-
-  public static final MimeType HEADERS_MIME_TYPE = MimeTypes.create( "application/x-http-headers", null );
-  public static final MimeType COOKIES_MIME_TYPE = MimeTypes.create( "application/x-http-cookies", null );
-
-  @Override
-  public void init( FilterConfig filterConfig ) throws ServletException {
-    super.init( filterConfig );
-  }
-
-  @Override
-  protected void doFilter( HttpServletRequest request, HttpServletResponse response, FilterChain chain )
-      throws IOException, ServletException {
-    FilterConfig config = getConfig();
-    UrlRewriteRequest rewriteRequest = new UrlRewriteRequest( config, request );
-    UrlRewriteResponse rewriteResponse = new UrlRewriteResponse( config, rewriteRequest, response );
-    chain.doFilter( rewriteRequest, rewriteResponse );
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteStepDescriptor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteStepDescriptor.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteStepDescriptor.java
deleted file mode 100644
index 4bc115e..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteStepDescriptor.java
+++ /dev/null
@@ -1,26 +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;
-
-public interface UrlRewriteStepDescriptor<T> {
-
-  String type();
-
-  T type( String type );
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteStepDescriptorFactory.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteStepDescriptorFactory.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteStepDescriptorFactory.java
deleted file mode 100644
index 9c30c3f..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteStepDescriptorFactory.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 java.util.HashMap;
-import java.util.Map;
-import java.util.ServiceLoader;
-import java.util.Set;
-
-public abstract class UrlRewriteStepDescriptorFactory {
-
-  private static Map<String,Class<? extends UrlRewriteStepDescriptor>> MAP = loadStepDescriptors();
-
-  private UrlRewriteStepDescriptorFactory() {
-  }
-
-  @SuppressWarnings("unchecked")
-  public static <T extends UrlRewriteStepDescriptor<?>> T create( String type ) {
-    try {
-      Class<? extends UrlRewriteStepDescriptor> descriptorClass = MAP.get( type );
-      return (T)descriptorClass.newInstance();
-    } catch( InstantiationException e ) {
-      throw new IllegalArgumentException( type );
-    } catch( IllegalAccessException e ) {
-      throw new IllegalArgumentException( type );
-    }
-  }
-
-  private static Map<String,Class<? extends UrlRewriteStepDescriptor>> loadStepDescriptors() {
-    Map<String,Class<? extends UrlRewriteStepDescriptor>> map
-        = new HashMap<>();
-    ServiceLoader<? extends UrlRewriteStepDescriptor> descriptors
-        = ServiceLoader.load( UrlRewriteStepDescriptor.class );
-    for( UrlRewriteStepDescriptor descriptor : descriptors ) {
-      String descriptorType = descriptor.type();
-      Class<? extends UrlRewriteStepDescriptor> descriptorClass = descriptor.getClass() ;
-      map.put( descriptorType, descriptorClass );
-    }
-    return map;
-  }
-
-  public static Set<String> getTypes() {
-    return MAP.keySet();
-  }
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteStepFlow.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteStepFlow.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteStepFlow.java
deleted file mode 100644
index 787e3fd..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteStepFlow.java
+++ /dev/null
@@ -1,20 +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;
-
-public enum UrlRewriteStepFlow { ALL, AND, OR }

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteStreamFilterFactory.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteStreamFilterFactory.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteStreamFilterFactory.java
deleted file mode 100644
index cd7c439..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteStreamFilterFactory.java
+++ /dev/null
@@ -1,115 +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.gateway.filter.rewrite.spi.UrlRewriteStreamFilter;
-import org.apache.hadoop.gateway.util.MimeTypes;
-import org.apache.hadoop.gateway.util.urltemplate.Resolver;
-
-import javax.activation.MimeType;
-import javax.activation.MimeTypeParseException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.ServiceLoader;
-
-public abstract class UrlRewriteStreamFilterFactory {
-
-  private static final String DEFAULT_CHARACTER_ENCODING = "ISO-8859-1";
-
-  private static final Map<String,Map<String,UrlRewriteStreamFilter>> MAP = loadFactories();
-
-  private UrlRewriteStreamFilterFactory() {
-  }
-
-  public static InputStream create(
-      MimeType type,
-      String name,
-      InputStream stream,
-      UrlRewriter rewriter,
-      Resolver resolver,
-      UrlRewriter.Direction direction,
-      UrlRewriteFilterContentDescriptor config )
-          throws IOException {
-    InputStream filteredStream = null;
-    Map<String,UrlRewriteStreamFilter> nameMap = getNameMap( type );
-    UrlRewriteStreamFilter filter = getFilter( nameMap, name );
-    String charset = MimeTypes.getCharset( type, DEFAULT_CHARACTER_ENCODING );
-    if( filter != null ) {
-      filteredStream = filter.filter( stream, charset, rewriter, resolver, direction, config );
-    }
-    return filteredStream;
-  }
-
-  private static Map<String,Map<String,UrlRewriteStreamFilter>> loadFactories() {
-    Map<String,Map<String,UrlRewriteStreamFilter>> typeMap = new HashMap<>();
-    ServiceLoader<UrlRewriteStreamFilter> filters = ServiceLoader.load( UrlRewriteStreamFilter.class );
-    for( UrlRewriteStreamFilter filter : filters ) {
-      String[] types = filter.getTypes();
-      for( String type: types ) {
-        Map<String,UrlRewriteStreamFilter> nameMap = typeMap.get( type );
-        if( nameMap == null ) {
-          nameMap = new LinkedHashMap<String,UrlRewriteStreamFilter>();
-          typeMap.put( type, nameMap );
-        }
-        for( String name: filter.getNames() ) {
-          nameMap.put( name, filter );
-        }
-      }
-    }
-    return typeMap;
-  }
-
-  private static Map<String,UrlRewriteStreamFilter> getNameMap( MimeType type ) {
-    if( type == null ) {
-      type = new MimeType();
-    }
-    Map<String,UrlRewriteStreamFilter> nameMap = MAP.get( type.getBaseType() );
-    try {
-      if( nameMap == null ) {
-        type.setPrimaryType( "*" );
-        nameMap = MAP.get( type.getBaseType() );
-        if( nameMap == null ) {
-          type.setSubType( "*" );
-          nameMap = MAP.get( type.getBaseType() );
-          if( nameMap == null ) {
-            nameMap = MAP.get( null );
-          }
-        }
-      }
-    } catch( MimeTypeParseException e ) {
-      throw new IllegalArgumentException( type.toString(), e );
-    }
-    return nameMap;
-  }
-
-  private static UrlRewriteStreamFilter getFilter( Map<String,UrlRewriteStreamFilter> map, String name ) {
-    UrlRewriteStreamFilter filter = null;
-    if( map != null ) {
-      if( name == null && !map.isEmpty() ) {
-        filter = map.values().iterator().next();
-      } else {
-        filter = map.get( name );
-      }
-    }
-    return filter;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriter.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriter.java
deleted file mode 100644
index 76106f0..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriter.java
+++ /dev/null
@@ -1,31 +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.gateway.util.urltemplate.Resolver;
-import org.apache.hadoop.gateway.util.urltemplate.Template;
-
-public interface UrlRewriter {
-
-  enum Direction { IN, OUT }
-
-  UrlRewriteRulesDescriptor getConfig();
-
-  Template rewrite( Resolver resolver, Template uri, Direction direction, String ruleName );
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/ScopedMatcher.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/ScopedMatcher.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/ScopedMatcher.java
deleted file mode 100644
index 7f4ef63..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/ScopedMatcher.java
+++ /dev/null
@@ -1,129 +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.filter.rewrite.ext;
-
-import org.apache.hadoop.gateway.filter.rewrite.impl.UrlRewriteRuleProcessorHolder;
-import org.apache.hadoop.gateway.util.urltemplate.Matcher;
-import org.apache.hadoop.gateway.util.urltemplate.Template;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A simple extension to the matcher that takes into account scopes for rules along with the templates themselves.
- * This matcher maintains a list of matchers and delegates to an appropriate matcher based on scope information for the
- * associated rules.
- */
-public class ScopedMatcher extends Matcher<UrlRewriteRuleProcessorHolder> {
-
-  public static final String GLOBAL_SCOPE = "GLOBAL";
-
-  private List<Matcher<UrlRewriteRuleProcessorHolder>> matchers;
-
-  public ScopedMatcher() {
-    super();
-    matchers = new ArrayList<>();
-    matchers.add(new Matcher<UrlRewriteRuleProcessorHolder>());
-  }
-
-  @Override
-  public UrlRewriteRuleProcessorHolder get(Template template) {
-    return super.get(template);
-  }
-
-  @Override
-  public void add(Template template, UrlRewriteRuleProcessorHolder value) {
-    Matcher<UrlRewriteRuleProcessorHolder> matcher = getMatcher(template, value);
-    matcher.add( template, value );
-  }
-
-  @Override
-  public Match match(Template input) {
-    return match(input, null);
-  }
-
-  public Match match(Template input, String scope) {
-    List<Match> matches = new ArrayList<>();
-    for (Matcher<UrlRewriteRuleProcessorHolder> matcher : matchers) {
-      Match match = matcher.match(input);
-      if (match != null) {
-        matches.add(match);
-      }
-    }
-    if (matches.size() == 0) {
-      return null;
-    }
-    if (matches.size() == 1) {
-      return getMatch(matches, scope);
-    }
-    return findBestMatch(matches, scope);
-  }
-
-  private Match findBestMatch(List<Match> matches, String scope) {
-    if (scope != null) {
-      //when multiple matches are found, find the first one that matches in scope
-      for ( Match match : matches ) {
-        String matchedScope = match.getValue().getScope();
-        if ( matchedScope != null && matchedScope.equals(scope) ) {
-          return match;
-        }
-      }
-    }
-    //since no scope match was found return the first global scopeed match
-    for ( Match match : matches ) {
-      String matchedScope = match.getValue().getScope();
-      if ( matchedScope != null && matchedScope.equals(GLOBAL_SCOPE) ) {
-        return match;
-      }
-    }
-    //return the first match from the list
-    return getMatch(matches, scope);
-  }
-
-  private Match getMatch(List<Match> matches, String scope) {
-    Match match = matches.get(0);
-    String matchedScope = match.getValue().getScope();
-    if (matchedScope != null && scope != null && !matchedScope.equals(scope) && !matchedScope.equals(GLOBAL_SCOPE)) {
-      return null;
-    }
-    return match;
-  }
-
-  /**
-   * Returns a matcher for a given template and processor holder. This method takes into account different scopes in
-   * addition to template values. If a matcher exists for a template but the scope is different, a new matcher is
-   * created and returned.
-   * @param template the template for which a matcher is needed
-   * @param holder the rule holder that goes along with the template.
-   * @return a matcher
-   */
-  private Matcher<UrlRewriteRuleProcessorHolder> getMatcher(Template template, UrlRewriteRuleProcessorHolder holder) {
-    for (Matcher<UrlRewriteRuleProcessorHolder> matcher : matchers) {
-      UrlRewriteRuleProcessorHolder matchersHolder = matcher.get(template);
-      if (matchersHolder == null) {
-        return matcher;
-      } else if (holder.getScope() == null && matchersHolder.getScope() == null) {
-        return matcher;
-      }
-    }
-    Matcher<UrlRewriteRuleProcessorHolder> matcher = new Matcher<>();
-    matchers.add(matcher);
-    return matcher;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteActionDescriptor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteActionDescriptor.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteActionDescriptor.java
deleted file mode 100644
index ab50e55..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteActionDescriptor.java
+++ /dev/null
@@ -1,32 +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.ext;
-
-import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteStepDescriptor;
-
-public interface UrlRewriteActionDescriptor extends UrlRewriteStepDescriptor<UrlRewriteActionDescriptor> {
-
-  String operation();
-
-  UrlRewriteActionDescriptor operation( String operation );
-
-  String parameter();
-
-  UrlRewriteActionDescriptor parameter( String parameter );
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteActionRewriteDescriptorExt.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteActionRewriteDescriptorExt.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteActionRewriteDescriptorExt.java
deleted file mode 100644
index 1a5cf4a..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteActionRewriteDescriptorExt.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.ext;
-
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteActionDescriptorBase;
-
-public class UrlRewriteActionRewriteDescriptorExt
-    extends UrlRewriteActionDescriptorBase
-    implements UrlRewriteActionDescriptor {
-
-  public UrlRewriteActionRewriteDescriptorExt() {
-    super( "rewrite" );
-  }
-
-  public String template() {
-    return parameter();
-  }
-
-  public UrlRewriteActionRewriteDescriptorExt template( String template ) {
-    parameter( template );
-    return this;
-  }
-
-  public void setTemplate( String template ) {
-    parameter( template );
-  }
-
-  @Override
-  public String getParam() {
-    return null;
-  }
-
-  public String getTemplate() {
-    return parameter();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteActionRewriteProcessorExt.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteActionRewriteProcessorExt.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteActionRewriteProcessorExt.java
deleted file mode 100644
index a2bcb1b..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteActionRewriteProcessorExt.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.ext;
-
-import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteEnvironment;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteContext;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepStatus;
-import org.apache.hadoop.gateway.util.urltemplate.Expander;
-import org.apache.hadoop.gateway.util.urltemplate.Parser;
-import org.apache.hadoop.gateway.util.urltemplate.Template;
-
-public class UrlRewriteActionRewriteProcessorExt
-    implements UrlRewriteStepProcessor<UrlRewriteActionRewriteDescriptorExt> {
-
-  private Template template;
-  private Expander expander;
-
-  @Override
-  public String getType() {
-    return "rewrite";
-  }
-
-  @Override
-  public void initialize( UrlRewriteEnvironment environment, UrlRewriteActionRewriteDescriptorExt descriptor ) throws Exception {
-    this.expander = new Expander();
-    if ( descriptor.parameter() != null ) {
-      this.template = Parser.parseTemplate( descriptor.parameter() );
-    } else {
-      this.template = Parser.parseTemplate( "" );
-    }
-  }
-
-  @Override
-  public UrlRewriteStepStatus process( UrlRewriteContext context ) throws Exception {
-    Template rewritten = expander.expandToTemplate( template, context.getParameters(), context.getEvaluator() );
-    context.setCurrentUrl( rewritten );
-    return UrlRewriteStepStatus.SUCCESS;
-  }
-
-  @Override
-  public void destroy() {
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteCheckDescriptor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteCheckDescriptor.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteCheckDescriptor.java
deleted file mode 100644
index 00e8c97..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteCheckDescriptor.java
+++ /dev/null
@@ -1,36 +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.ext;
-
-import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteFlowDescriptor;
-
-public interface UrlRewriteCheckDescriptor extends UrlRewriteFlowDescriptor<UrlRewriteCheckDescriptor> {
-
-  String operation();
-
-  UrlRewriteCheckDescriptor operation( String operation );
-
-  String input();
-
-  UrlRewriteCheckDescriptor input( String input );
-
-  String value();
-
-  UrlRewriteCheckDescriptor value( String value );
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteCheckDescriptorExt.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteCheckDescriptorExt.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteCheckDescriptorExt.java
deleted file mode 100644
index b7630b7..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteCheckDescriptorExt.java
+++ /dev/null
@@ -1,99 +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.ext;
-
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteFlowDescriptorBase;
-
-public class UrlRewriteCheckDescriptorExt
-    extends UrlRewriteFlowDescriptorBase<UrlRewriteCheckDescriptor>
-    implements UrlRewriteCheckDescriptor {
-
-  private String operation;
-  private String input;
-  private String value;
-
-  public UrlRewriteCheckDescriptorExt() {
-    super( "check" );
-  }
-
-  @Override
-  public String operation() {
-    return operation;
-  }
-
-  @Override
-  public UrlRewriteCheckDescriptor operation( String operation ) {
-    this.operation = operation;
-    return this;
-  }
-
-  public void setOperation( String operation ) {
-    operation( operation );
-  }
-
-  public void setOper( String operation ) {
-    operation( operation );
-  }
-
-  public void setOp( String operation ) {
-    operation( operation );
-  }
-
-  public String getOper() {
-    return operation();
-  }
-
-  @Override
-  public String input() {
-    return input;
-  }
-
-  @Override
-  public UrlRewriteCheckDescriptor input( String input ) {
-    this.input = input;
-    return this;
-  }
-
-  public void setInput( String input ) {
-    input( input );
-  }
-
-  public String getInput() {
-    return input();
-  }
-
-  @Override
-  public String value() {
-    return value;
-  }
-
-  @Override
-  public UrlRewriteCheckDescriptor value( String value ) {
-    this.value = value;
-    return this;
-  }
-
-  public void setValue( String value ) {
-    value( value );
-  }
-
-  public String getValue() {
-    return value();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteCheckProcessorExt.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteCheckProcessorExt.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteCheckProcessorExt.java
deleted file mode 100644
index aafd3bb..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteCheckProcessorExt.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
- *
- *     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.ext;
-
-import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteEnvironment;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteContext;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepStatus;
-
-public class UrlRewriteCheckProcessorExt implements UrlRewriteStepProcessor<UrlRewriteCheckDescriptor> {
-
-  @Override
-  public String getType() {
-    return "check";
-  }
-
-  @Override
-  public void initialize( UrlRewriteEnvironment environment, UrlRewriteCheckDescriptor descriptor ) throws Exception {
-  }
-
-  @Override
-  public UrlRewriteStepStatus process( UrlRewriteContext context ) throws Exception {
-    return UrlRewriteStepStatus.FAILURE;
-  }
-
-  @Override
-  public void destroy() {
-  }
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteControlDescriptor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteControlDescriptor.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteControlDescriptor.java
deleted file mode 100644
index c6ef973..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteControlDescriptor.java
+++ /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.
- */
-package org.apache.hadoop.gateway.filter.rewrite.ext;
-
-import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteFlowDescriptor;
-
-public interface UrlRewriteControlDescriptor extends UrlRewriteFlowDescriptor<UrlRewriteControlDescriptor> {
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteControlDescriptorExt.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteControlDescriptorExt.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteControlDescriptorExt.java
deleted file mode 100644
index 0a23364..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteControlDescriptorExt.java
+++ /dev/null
@@ -1,30 +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.ext;
-
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteFlowDescriptorBase;
-
-public class UrlRewriteControlDescriptorExt
-    extends UrlRewriteFlowDescriptorBase<UrlRewriteControlDescriptor>
-    implements UrlRewriteControlDescriptor {
-
-  public UrlRewriteControlDescriptorExt() {
-    super( "control" );
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteControlProcessorExt.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteControlProcessorExt.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteControlProcessorExt.java
deleted file mode 100644
index c43994b..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteControlProcessorExt.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
- *
- *     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.ext;
-
-import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteEnvironment;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteContext;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepStatus;
-
-public class UrlRewriteControlProcessorExt implements UrlRewriteStepProcessor<UrlRewriteControlDescriptor> {
-
-  @Override
-  public String getType() {
-    return "control";
-  }
-
-  @Override
-  public void initialize( UrlRewriteEnvironment environment, UrlRewriteControlDescriptor descriptor ) throws Exception {
-  }
-
-  @Override
-  public UrlRewriteStepStatus process( UrlRewriteContext context ) throws Exception {
-    return UrlRewriteStepStatus.FAILURE;
-  }
-
-  @Override
-  public void destroy() {
-  }
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteMatchDescriptor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteMatchDescriptor.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteMatchDescriptor.java
deleted file mode 100644
index 3d133c1..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteMatchDescriptor.java
+++ /dev/null
@@ -1,39 +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.ext;
-
-import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteFlowDescriptor;
-import org.apache.hadoop.gateway.util.urltemplate.Template;
-
-import java.net.URISyntaxException;
-
-public interface UrlRewriteMatchDescriptor extends UrlRewriteFlowDescriptor<UrlRewriteMatchDescriptor> {
-
-  String operation();
-
-  UrlRewriteMatchDescriptor operation( String operation );
-
-  String pattern();
-
-  UrlRewriteMatchDescriptor pattern( String pattern ) throws URISyntaxException;
-
-  Template template();
-
-  UrlRewriteMatchDescriptor template( Template pattern );
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteMatchDescriptorExt.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteMatchDescriptorExt.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteMatchDescriptorExt.java
deleted file mode 100644
index a8e1130..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteMatchDescriptorExt.java
+++ /dev/null
@@ -1,110 +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.ext;
-
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteFlowDescriptorBase;
-import org.apache.hadoop.gateway.util.urltemplate.Parser;
-import org.apache.hadoop.gateway.util.urltemplate.Template;
-
-import java.net.URISyntaxException;
-
-public class UrlRewriteMatchDescriptorExt
-    extends UrlRewriteFlowDescriptorBase<UrlRewriteMatchDescriptor>
-    implements UrlRewriteMatchDescriptor {
-
-  private String operation;
-  private String pattern;
-  private Template template;
-
-  public UrlRewriteMatchDescriptorExt() {
-    super( "match" );
-  }
-
-  @Override
-  public String operation() {
-    return operation;
-  }
-
-  public String getOperation() {
-    return operation;
-  }
-
-  @Override
-  public UrlRewriteMatchDescriptor operation( String operation ) {
-    this.operation = operation;
-    return this;
-  }
-
-  public void setOperation( String operation ) {
-    operation( operation );
-  }
-
-  public void setOper( String operation ) {
-    operation( operation );
-  }
-
-  public void setOp( String operation ) {
-    operation( operation );
-  }
-
-  public String getOper() {
-    return operation();
-  }
-
-  @Override
-  public String pattern() {
-    return pattern;
-  }
-
-  @Override
-  public UrlRewriteMatchDescriptor pattern( String pattern ) throws URISyntaxException {
-    this.pattern = pattern;
-    this.template = Parser.parseTemplate( pattern );
-    return this;
-  }
-
-  public void setUrl( String pattern ) throws URISyntaxException {
-    pattern( pattern );
-  }
-
-  public void setPattern( String pattern ) throws URISyntaxException {
-    pattern( pattern );
-  }
-
-  public String getPattern() {
-    return pattern;
-  }
-
-  @Override
-  public Template template() {
-    return template;
-  }
-
-  @Override
-  public UrlRewriteMatchDescriptor template( Template template ) {
-    this.template = template;
-    // The template is now optional for rules.
-    if( template == null ) {
-      this.pattern = null;
-    } else {
-      this.pattern = template.toString();
-    }
-    return this;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteMatchProcessorExt.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteMatchProcessorExt.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteMatchProcessorExt.java
deleted file mode 100644
index 04f919a..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/ext/UrlRewriteMatchProcessorExt.java
+++ /dev/null
@@ -1,66 +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.ext;
-
-import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteEnvironment;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteContext;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepStatus;
-import org.apache.hadoop.gateway.util.urltemplate.Matcher;
-import org.apache.hadoop.gateway.util.urltemplate.Template;
-
-public class UrlRewriteMatchProcessorExt implements UrlRewriteStepProcessor<UrlRewriteMatchDescriptor> {
-
-  //private UrlRewriteMatchDescriptor descriptor;
-  private Matcher<Void> matcher;
-
-  @Override
-  public String getType() {
-    return "match";
-  }
-
-  @Override
-  public void initialize( UrlRewriteEnvironment environment, UrlRewriteMatchDescriptor descriptor ) throws Exception {
-    Template template = descriptor.template();
-    if( template == null ) {
-      this.matcher = null;
-    } else {
-      this.matcher = new Matcher<Void>( descriptor.template(), null );
-    }
-  }
-
-  @Override
-  public UrlRewriteStepStatus process( UrlRewriteContext context ) throws Exception {
-    UrlRewriteStepStatus status = UrlRewriteStepStatus.SUCCESS;
-    if( matcher != null ) {
-      status = UrlRewriteStepStatus.FAILURE;
-      Matcher.Match match = matcher.match( context.getCurrentUrl() );
-      if( match != null ) {
-        context.addParameters( match.getParams() );
-        status = UrlRewriteStepStatus.SUCCESS;
-      }
-    }
-    return status;
-  }
-
-  @Override
-  public void destroy() {
-    matcher = null;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/i18n/UrlRewriteMessages.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/i18n/UrlRewriteMessages.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/i18n/UrlRewriteMessages.java
deleted file mode 100644
index 4f304bc..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/i18n/UrlRewriteMessages.java
+++ /dev/null
@@ -1,87 +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.i18n;
-
-import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriter;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepStatus;
-import org.apache.hadoop.gateway.i18n.messages.Message;
-import org.apache.hadoop.gateway.i18n.messages.MessageLevel;
-import org.apache.hadoop.gateway.i18n.messages.Messages;
-import org.apache.hadoop.gateway.i18n.messages.StackTrace;
-import org.apache.hadoop.gateway.util.urltemplate.Template;
-
-@Messages(logger="org.apache.hadoop.gateway")
-public interface UrlRewriteMessages {
-
-  @Message( level = MessageLevel.DEBUG, text = "Failed to parse value as URL: {0}" )
-  void failedToParseValueForUrlRewrite( String value );
-
-  @Message( level = MessageLevel.ERROR, text = "Failed to write the rules descriptor: {0}" )
-  void failedToWriteRulesDescriptor( @StackTrace( level = MessageLevel.DEBUG ) Exception e );
-
-  @Message( level = MessageLevel.DEBUG, text = "Failed to filter attribute {0}: {1}" )
-  void failedToFilterAttribute( String attributeName, @StackTrace( level = MessageLevel.DEBUG ) Exception e );
-
-  @Message( level = MessageLevel.ERROR, text = "Failed to load rewrite rules descriptor: {0}" )
-  void failedToLoadRewriteRulesDescriptor( @StackTrace( level = MessageLevel.DEBUG ) Exception e );
-
-  @Message( level = MessageLevel.ERROR, text = "Failed to initialize rewrite rules: {0}" )
-  void failedToInitializeRewriteRules( @StackTrace( level = MessageLevel.DEBUG ) Exception e );
-
-  @Message( level = MessageLevel.ERROR, text = "Failed to initialize rewrite functions: {0}" )
-  void failedToInitializeRewriteFunctions( @StackTrace( level = MessageLevel.DEBUG ) Exception e );
-
-  @Message( level = MessageLevel.ERROR, text = "Failed to destroy rewrite rule processor: {0}" )
-  void failedToDestroyRewriteStepProcessor( @StackTrace(level = MessageLevel.DEBUG) Exception e );
-
-  @Message( level = MessageLevel.ERROR, text = "Failed to destroy rewrite function processor: {0}" )
-  void failedToDestroyRewriteFunctionProcessor( @StackTrace( level = MessageLevel.DEBUG ) Exception e );
-
-  @Message( level = MessageLevel.ERROR, text = "Failed to filter value {0}, rule {1}" )
-  void failedToFilterValue( String value, String rule );
-
-  @Message( level = MessageLevel.ERROR, text = "Failed to filter value {0}, rule {1}: {2}" )
-  void failedToFilterValue( String value, String rule, @StackTrace( level = MessageLevel.DEBUG ) Exception e );
-
-  @Message( level = MessageLevel.ERROR, text = "Failed to filter field name {0}: {1}" )
-  void failedToFilterFieldName( String fieldName, @StackTrace( level = MessageLevel.DEBUG ) Exception e );
-
-  @Message( level = MessageLevel.ERROR, text = "Rewrite function {0} failed: {1}" )
-  void failedToInvokeRewriteFunction( String functionName, @StackTrace( level = MessageLevel.DEBUG ) Exception e );
-
-  @Message( level = MessageLevel.ERROR, text = "Failed to find values by parameter name {0}: {1}" )
-  void failedToFindValuesByParameter( String parameterName, @StackTrace( level = MessageLevel.DEBUG ) Exception e );
-
-  @Message( level = MessageLevel.DEBUG, text = "Rewrote URL: {0}, direction: {1} via implicit rule: {2} to URL: {3}" )
-  void rewroteUrlViaImplicitRule( Template inputUri, UrlRewriter.Direction direction, String ruleName, Template outputUri );
-
-  @Message( level = MessageLevel.DEBUG, text = "Rewrote URL: {0}, direction: {1} via explicit rule: {2} to URL: {3}" )
-  void rewroteUrlViaExplicitRule( Template inputUri, UrlRewriter.Direction direction, String ruleName, Template outputUri );
-
-  @Message( level = MessageLevel.ERROR, text = "Failed to rewrite URL: {0}, direction: {1} via rule: {2}, status: {3}" )
-  void failedToRewriteUrl( Template inputUri, UrlRewriter.Direction direction, String ruleName, UrlRewriteStepStatus stepStatus );
-
-  @Message( level = MessageLevel.ERROR, text = "Failed to rewrite URL: {0}, direction: {1}, rule: {2}" )
-  void failedToRewriteUrlDueToException( Template inputUri, UrlRewriter.Direction direction, String ruleName, @StackTrace(level = MessageLevel.DEBUG) Exception exception );
-
-  @Message( level = MessageLevel.TRACE, text = "No rule matching URL: {0}, direction: {1}" )
-  void noRuleMatchingUrl( Template inputUri, UrlRewriter.Direction direction );
-
-  @Message( level = MessageLevel.TRACE, text = "Failed to decode query string: {0}" )
-  void failedToDecodeQueryString( String queryString, @StackTrace(level = MessageLevel.TRACE) Exception exception );
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/i18n/UrlRewriteResources.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/i18n/UrlRewriteResources.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/i18n/UrlRewriteResources.java
deleted file mode 100644
index e406902..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/i18n/UrlRewriteResources.java
+++ /dev/null
@@ -1,41 +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.i18n;
-
-import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteFilterPathDescriptor;
-import org.apache.hadoop.gateway.i18n.resources.Resource;
-import org.apache.hadoop.gateway.i18n.resources.Resources;
-
-@Resources
-public interface UrlRewriteResources {
-
-  @Resource( text="No importer for descriptor format {0}" )
-  String noImporterForFormat( String format );
-
-  @Resource( text="No exporter for descriptor format {0}" )
-  String noExporterForFormat( String format );
-
-  @Resource( text="Unexpected selector type {0}" )
-  String unexpectedRewritePathSelector( UrlRewriteFilterPathDescriptor selector );
-
-  @Resource( text="Unexpected selected node type {0}" )
-  String unexpectedSelectedNodeType( Object node );
-
-  @Resource( text="Invalid frontend rewrite function parameter {0}" )
-  String invalidFrontendFunctionParameter( String parameter );
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/af9b0c3d/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/CookieScopeResponseWrapper.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/CookieScopeResponseWrapper.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/CookieScopeResponseWrapper.java
deleted file mode 100644
index 6360f33..0000000
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/CookieScopeResponseWrapper.java
+++ /dev/null
@@ -1,59 +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.filter.rewrite.impl;
-
-import org.apache.hadoop.gateway.filter.GatewayResponseWrapper;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.OutputStream;
-
-public class CookieScopeResponseWrapper extends GatewayResponseWrapper {
-
-    private static final String SET_COOKIE = "Set-Cookie";
-
-    private static final String COOKIE_PATH = "Path=/";
-
-    private final String scopePath;
-
-    public CookieScopeResponseWrapper(HttpServletResponse response, String gatewayPath) {
-        super(response);
-        this.scopePath = COOKIE_PATH + gatewayPath + "/";
-    }
-
-    @Override
-    public void addHeader(String name, String value) {
-        if (SET_COOKIE.equals(name)) {
-            String updatedCookie;
-            if (value.contains(COOKIE_PATH)) {
-                updatedCookie = value.replace(COOKIE_PATH, scopePath);
-            } else {
-                // append the scope path
-                updatedCookie = String.format("%s %s;", value, scopePath);
-            }
-            super.addHeader(name, updatedCookie);
-        } else {
-            super.addHeader(name, value);
-        }
-    }
-
-    @Override
-    public OutputStream getRawOutputStream() throws IOException {
-        return getResponse().getOutputStream();
-    }
-}