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

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


  }

  //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 );
      if( output != null ) {
        value = output.toString();
      }
    } catch( URISyntaxException e ) {
      //TODO: Proper i18n logging of stack trace.
      e.printStackTrace();
    }
View Full Code Here


  }

  //TODO: Need to limit which values are attempted to be filtered by the name.
  private 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

  }

  @Override
  public UrlRewriteStepStatus process( UrlRewriteContext context ) throws Exception {
    //TODO: Need some way to get a reference to the keystore service and the encryption key in particular.
    Template url = context.getCurrentUrl();
    String str = url.toString();
    String path = str;
    String query = null;
    int index = str.indexOf( '?' );
    if( index >= 0 ) {
      path = str.substring( 0, index );
View Full Code Here

  }

  @Override
  public UrlRewriteStepStatus process( UrlRewriteContext context ) throws Exception {
    //TODO: Need some way to get a reference to the keystore service and the encryption key in particular.
    Template currUrl = context.getCurrentUrl();
    Builder newUrl = new Builder( currUrl );
    Map<String,Query> map = newUrl.getQuery();
    Query query = map.remove( ENCODED_PARAMETER_NAME );
    if( query != null ) {
      String value = query.getFirstValue().getPattern();
View Full Code Here

  }

  @Override
  public UrlRewriteStepStatus process( UrlRewriteContext context ) throws Exception {
    //TODO: Need some way to get a reference to the keystore service and the encryption key in particular.
    Template currUrl = context.getCurrentUrl();
    Builder newUrl = new Builder( currUrl );
    Map<String,Query> map = newUrl.getQuery();
    Query query = map.remove( ENCRYPTED_PARAMETER_NAME );
    if( query != null ) {
      String value = query.getFirstValue().getPattern();
View Full Code Here

  }

  @Override
  public UrlRewriteStepStatus process( UrlRewriteContext context ) throws Exception {
    //TODO: Need some way to get a reference to the keystore service and the encryption key in particular.
    Template url = context.getCurrentUrl();
    String str = url.toString();
    String path = str;
    String query = null;
    int index = str.indexOf( '?' );
    if( index >= 0 ) {
      path = str.substring( 0, index );
View Full Code Here

    UrlRewriteProcessor processor = new UrlRewriteProcessor();
    UrlRewriteRulesDescriptor config = UrlRewriteRulesDescriptorFactory.load(
        "xml", getTestResourceReader( "rewrite.xml", "UTF-8" ) );
    processor.initialize( environment, config );

    Template inputUrl = Parser.parse( "test-scheme://test-host:1/test-input-path" );
    Template outputUrl = processor.rewrite( null, inputUrl, UrlRewriter.Direction.IN );

    assertThat( "Expect rewrite to produce a new URL",
        outputUrl, notNullValue() );
    assertThat(
        "Expect rewrite to contain the correct path.",
        outputUrl.toString(), is( "test-scheme://test-host:1/test-output-path" ) );
    processor.destroy();
  }
View Full Code Here

public class SecureQueryEncryptDecryptProcessorTest {

  @Test
  public void testEncryptDecrypt() throws Exception {
    Query query;
    Template origTemplate = Parser.parse( "http://host:0/path/file?query-param-name=query-param-value" );

    // Test encryption.  Results are left in encTemplate

    UrlRewriteEnvironment encEnvironment = EasyMock.createNiceMock( UrlRewriteEnvironment.class );
    EasyMock.expect( encEnvironment.resolve( "cluster.name" ) ).andReturn( Arrays.asList( "test-cluster-name" ) ).anyTimes();
View Full Code Here

    EasyMock.expect( resolver.resolve( EasyMock.anyObject(UrlRewriteContext.class), EasyMock.eq( "test-ctx-param-name" ) ) ).andReturn( "test-ctx-param-value" );

    EasyMock.replay( environment, resolver );

    UrlRewriter.Direction direction = UrlRewriter.Direction.OUT;
    Template template = Parser.parse( "scheme://host:port/dir/file" );

    UrlRewriteContextImpl context = new UrlRewriteContextImpl( environment, resolver, direction, template );

    Params params = context.getParameters();
    List<String> values = params.resolve( "test-env-param-name" );
View Full Code Here

    //TODO: The resulting pathInfo + query needs to be added to the servlet context somehow so that filters don't need to rebuild it.  This is done in HttpClientDispatch right now for example.
    String query = httpRequest.getQueryString();
    String path = httpRequest.getPathInfo() + ( query == null ? "" : "?" + query );

    Template pathTemplate;
    try {
      pathTemplate = Parser.parse( path );
    } catch( URISyntaxException e ) {
      throw new ServletException( e );
    }
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.