Package org.apache.hadoop.gateway.util.urltemplate

Examples of org.apache.hadoop.gateway.util.urltemplate.Template


  private void initializeRules( UrlRewriteRulesDescriptor descriptor ) {
    for( UrlRewriteRuleDescriptor ruleDescriptor : descriptor.getRules() ) {
      try {
        UrlRewriteStepProcessorHolder ruleProcessor = new UrlRewriteStepProcessorHolder();
        ruleProcessor.initialize( environment, ruleDescriptor );
        Template template = ruleDescriptor.template();
        rules.add( ruleProcessor );
        EnumSet<Direction> directions = ruleDescriptor.directions();
        if( directions == null || directions.isEmpty() ) {
          inbound.add( template, ruleProcessor );
          outbound.add( template, ruleProcessor );
View Full Code Here


  }

  @Override
  public Template rewrite(
      Resolver resolver, Template inputUri, Direction direction ) {
    Template outputUri = inputUri;
    Matcher<UrlRewriteStepProcessorHolder>.Match match = null;
    switch( direction ) {
      case IN:
        match = inbound.match( outputUri );
        break;
View Full Code Here

    return IGNORE_HEADER_NAMES.contains( name );
  }

  public String rewriteValue( UrlRewriter rewriter, String value ) {
    try {
      Template input = Parser.parse( value );
      Template output = rewriter.rewrite( this, input, UrlRewriter.Direction.OUT );
      value = output.toString();
    } catch( URISyntaxException e ) {
      e.printStackTrace();
    }
    return value;
  }
View Full Code Here

    super( request );
    this.rewriter = UrlRewriteServletContextListener.getUrlRewriter( config.getServletContext() );
  }

  private Template getSourceUrl() {
    Template urlTemplate = null;
    StringBuffer urlString = super.getRequestURL();
    String queryString = super.getQueryString();
    if( queryString != null ) {
      urlString.append( '?' );
      urlString.append( queryString );
View Full Code Here

  }

  // Note: Source url was added to the request attributes by the GatewayFilter doFilter method.
  private Template getTargetUrl() {
    boolean rewriteRequestUrl = true;
    Template targetUrl;
    if( rewriteRequestUrl ) {
      targetUrl = (Template)getAttribute( AbstractGatewayFilter.TARGET_REQUEST_URL_ATTRIBUTE_NAME );
      if( targetUrl == null ) {
        Template sourceUrl = getSourceUrl();
        targetUrl = rewriter.rewrite( this, sourceUrl, UrlRewriter.Direction.IN );
        setAttribute( AbstractGatewayFilter.TARGET_REQUEST_URL_ATTRIBUTE_NAME, targetUrl );
      }
    } else {
      targetUrl = (Template)getAttribute( AbstractGatewayFilter.SOURCE_REQUEST_URL_ATTRIBUTE_NAME );
View Full Code Here

    }
    return targetUrl;
  }

  private String[] splitTargetUrl( Template url ) {
    Template targetUrl = getTargetUrl();
    String s = targetUrl.toString();
    return s.split( "\\?" );
  }
View Full Code Here

    }
  }

  public String rewriteValue( UrlRewriter rewriter, String value ) {
    try {
      Template input = Parser.parse( value );
      Template output = rewriter.rewrite( this, input, UrlRewriter.Direction.IN );
      value = output.toString();
    } catch( URISyntaxException e ) {
      e.printStackTrace();
    }
    return value;
  }
View Full Code Here

    this.template = Parser.parse( descriptor.parameter() );
  }

  @Override
  public UrlRewriteStepStatus process( UrlRewriteContext context ) throws Exception {
    Template rewritten = expander.expandToTemplate( template, context.getParameters() );
    context.setCurrentUrl( rewritten );
    return UrlRewriteStepStatus.SUCCESS;
  }
View Full Code Here

  }

  //TODO: Need to limit which values are attempted to be filtered by the name.
  protected String filterValueString( String name, String value ) {
    try {
      Template input = Parser.parse( value );
      Template output = rewriter.rewrite( resolver, input, direction );
      value = output.toString();
    } catch( URISyntaxException e ) {
      LOG.failedToParseValueForUrlRewrite( value );
    }
    return value;
  }
View Full Code Here

  }

  //TODO: Need to limit which values are attempted to be filtered by the name.
  protected String filterValue( String name, String value ) {
    try {
      Template input = Parser.parse( value );
      Template output = rewriter.rewrite( resolver, input, direction );
      value = output.toString();
    } catch( URISyntaxException e ) {
      LOG.failedToParseValueForUrlRewrite( value );
    }
    return value;
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.gateway.util.urltemplate.Template

Copyright © 2018 www.massapicom. 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.