Package org.apache.hadoop.gateway.filter.rewrite.api

Examples of org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteRulesDescriptor.addRule()


        .directions( "inbound" )
        .pattern( "*://*:*/**" + NAMENODE_EXTERNAL_PATH + "/?{**}" );
    rewrite = rule.addStep( "rewrite" );
    rewrite.template( service.getUrl().toExternalForm() + "/?{**}" );

    rule = rules.addRule( getRole() + "/" + getName() + "/namenode/file/inbound" )
        .directions( "inbound" )
        .pattern( "*://*:*/**" + NAMENODE_EXTERNAL_PATH + "/{path=**}?{**}" );
    rewrite = rule.addStep( "rewrite" );
    rewrite.template( service.getUrl().toExternalForm() + "/{path=**}?{**}" );

View Full Code Here


        .directions( "inbound" )
        .pattern( "*://*:*/**" + NAMENODE_EXTERNAL_PATH + "/{path=**}?{**}" );
    rewrite = rule.addStep( "rewrite" );
    rewrite.template( service.getUrl().toExternalForm() + "/{path=**}?{**}" );

    rule = rules.addRule( getRole() + "/" + getName() + "/datanode/inbound" )
        .directions( "inbound" )
        .pattern( "*://*:*/**" + DATANODE_EXTERNAL_PATH + "/{path=**}?**" );
    //TODO: If the input type is wrong it throws a NPE.
    rule.addStep( "decode-query" );
    match = rule.addStep( "match" );
View Full Code Here

    match = rule.addStep( "match" );
    match.pattern( "*://*:*/**" + DATANODE_EXTERNAL_PATH + "/{path=**}?{host}&{port}&{**}" );
    rewrite = rule.addStep( "rewrite" );
    rewrite.template( "http://{host}:{port}/{path=**}?{**}" );

    rule = rules.addRule( getRole() + "/" + getName() + "/datanode/outbound" )
        .directions( "outbound" )
        .pattern( "*://*:*/**?**" );
    match = rule.addStep( "match" );
    match.pattern( "*://{host}:{port}/{path=**}?{**}" );
    rewrite = rule.addStep( "rewrite" );
View Full Code Here

    @Override
    public void end( String namespace, String name ) throws Exception {
      Digester digester = getDigester();
      UrlRewriteRuleDescriptor rule = digester.pop();
      UrlRewriteRulesDescriptor rules = digester.peek();
      rules.addRule( rule );
    }
  }

  private class StepFactory extends FactoryRule {
    @Override
View Full Code Here

  }

  @Test
  public void testSingleNamedRule() throws IOException {
    UrlRewriteRulesDescriptor rules = UrlRewriteRulesDescriptorFactory.create();
    rules.addRule( "first" );

    StringWriter writer = new StringWriter();
    UrlRewriteRulesDescriptorFactory.store( rules, "xml", writer );

    String str = writer.toString();
View Full Code Here

  }

  @Test
  public void testMatchStep() throws Exception {
    UrlRewriteRulesDescriptor rules = UrlRewriteRulesDescriptorFactory.create();
    UrlRewriteRuleDescriptor rule = rules.addRule( "test-rule" ).pattern("test-pattern-rule");
    UrlRewriteMatchDescriptor match = rule.addStep( "match" );
    match.operation("test-operation").pattern( "test-pattern-step" ).flow( "all" );

    StringWriter writer = new StringWriter();
    UrlRewriteRulesDescriptorFactory.store( rules, "xml", writer );
View Full Code Here

  }

  @Test
  public void testControlStep() throws Exception {
    UrlRewriteRulesDescriptor rules = UrlRewriteRulesDescriptorFactory.create();
    UrlRewriteRuleDescriptor rule = rules.addRule( "test-rule" );
    UrlRewriteControlDescriptor control = rule.addStep( "control" );
    control.flow( "or" );

    StringWriter writer = new StringWriter();
    UrlRewriteRulesDescriptorFactory.store( rules, "xml", writer );
View Full Code Here

  }

  @Test
  public void testCheckStep() throws Exception {
    UrlRewriteRulesDescriptor rules = UrlRewriteRulesDescriptorFactory.create();
    UrlRewriteRuleDescriptor rule = rules.addRule( "test-rule" );
    UrlRewriteCheckDescriptor step = rule.addStep( "check" );
    step.operation("test-operation").input("test-input").value("test-value").flow( "all" );

    StringWriter writer = new StringWriter();
    UrlRewriteRulesDescriptorFactory.store( rules, "xml", writer );
View Full Code Here

  }

  @Test
  public void testRewriteStep() throws Exception {
    UrlRewriteRulesDescriptor rules = UrlRewriteRulesDescriptorFactory.create();
    UrlRewriteRuleDescriptor rule = rules.addRule( "test-rule" );
    UrlRewriteActionRewriteDescriptorExt step = rule.addStep( "rewrite" );
    step.operation("test-operation").parameter( "test-param" );

    StringWriter writer = new StringWriter();
    UrlRewriteRulesDescriptorFactory.store( rules, "xml", writer );
View Full Code Here

  }

  @Test
  public void testNestedStep() throws Exception {
    UrlRewriteRulesDescriptor rules = UrlRewriteRulesDescriptorFactory.create();
    UrlRewriteRuleDescriptor rule = rules.addRule( "test-rule" );

    UrlRewriteMatchDescriptor match = rule.addStep( "match" );
    UrlRewriteMatchDescriptor matchMatch = match.addStep( "match" );
    UrlRewriteCheckDescriptor matchCheck = match.addStep( "check" );
    UrlRewriteControlDescriptor matchControl = match.addStep( "control" );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.