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

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


  public void testBasicUseCase() throws Exception {
    URL configUrl = TestUtils.getResourceUrl( this.getClass(), "hostmap.txt" );

    UrlRewriteEnvironment environment = EasyMock.createNiceMock( UrlRewriteEnvironment.class );
    EasyMock.expect( environment.getResource( "/WEB-INF/hostmap.txt" ) ).andReturn( configUrl ).anyTimes();
    Resolver resolver = EasyMock.createNiceMock( Resolver.class );
    EasyMock.expect( resolver.resolve( "host" ) ).andReturn( Arrays.asList( "test-inbound-host" ) ).anyTimes();
    EasyMock.replay( environment, resolver );

    UrlRewriteRulesDescriptor descriptor = UrlRewriteRulesDescriptorFactory.create();
    UrlRewriteRuleDescriptor rule = descriptor.addRule( "test-rule" );
    rule.pattern( "{*}://{host}:{*}/{**}?{**}" );
View Full Code Here


    //TODO: Some of the compilation should be done at servlet init for performance reasons.
    Template sourceTemplate = Parser.parse( sourcePattern );
    Template targetTemplate = Parser.parse( targetPattern );

    Resolver resolver = new DispatchParamResolver( getConfig(), request );
    URI sourceUri = new URI( sourcePathInfo );
    URI targetUri = Rewriter.rewrite( sourceUri, sourceTemplate, targetTemplate, resolver, null );

//    //TODO: This should be more at filter init.
//    Pattern sourceRegex = UrlRewriter.compileUrlRegex( sourcePattern );
View Full Code Here

TOP

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

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.