Examples of UrlRewriteMatchDescriptor


Examples of org.apache.hadoop.gateway.filter.rewrite.ext.UrlRewriteMatchDescriptor

  private void contributeRewriteRules( DeploymentContext context, Service service ) throws URISyntaxException {
    UrlRewriteRulesDescriptor rules = context.getDescriptor( "rewrite" );
    UrlRewriteRuleDescriptor rule;
    UrlRewriteActionRewriteDescriptorExt rewrite;
    UrlRewriteMatchDescriptor match;

    rule = rules.addRule( getRole() + "/" + getName() + "/namenode/root/inbound" )
        .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=**}?{**}" );

    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" );
    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" );
    rewrite.template( CLUSTER_URL_FUNCTION + DATANODE_EXTERNAL_PATH + "/{path=**}?{host}&{port}&{**}" );
    rule.addStep( "encode-query" );
  }
View Full Code Here

Examples of org.apache.hadoop.gateway.filter.rewrite.ext.UrlRewriteMatchDescriptor

    return "rule";
  }

  @Override
  public void initialize( UrlRewriteEnvironment environment, UrlRewriteRuleDescriptor descriptor ) throws Exception {
    UrlRewriteMatchDescriptor matchDescriptor = new UrlRewriteMatchDescriptorExt();
    matchDescriptor.operation( "matches" );
    matchDescriptor.flow( descriptor.flow() );
    matchDescriptor.template( descriptor.template() );
    matchProcessor = new UrlRewriteMatchProcessorExt();
    matchProcessor.initialize( environment, matchDescriptor );
  }
View Full Code Here

Examples of org.apache.hadoop.gateway.filter.rewrite.ext.UrlRewriteMatchDescriptor

  @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 );

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

Examples of org.apache.hadoop.gateway.filter.rewrite.ext.UrlRewriteMatchDescriptor

  @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" );
    UrlRewriteActionDescriptor matchRewrite = match.addStep( "rewrite" );

    UrlRewriteCheckDescriptor check = rule.addStep( "check" );
    UrlRewriteMatchDescriptor checkMatch = check.addStep( "match" );
    UrlRewriteCheckDescriptor checkCheck = check.addStep( "check" );
    UrlRewriteControlDescriptor checkControl = check.addStep( "control" );
    UrlRewriteActionDescriptor checkRewrite = check.addStep( "rewrite" );

    UrlRewriteControlDescriptor control = rule.addStep( "control" );
    UrlRewriteMatchDescriptor controlMatch = control.addStep( "match" );
    UrlRewriteCheckDescriptor controlCheck = control.addStep( "check" );
    UrlRewriteControlDescriptor controlControl = control.addStep( "control" );
    UrlRewriteActionDescriptor controlRewrite = control.addStep( "rewrite" );

    UrlRewriteActionDescriptor rewrite = rule.addStep( "rewrite" );
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.