Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-267

Failed to match an URL through RoutingHandler

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.2.0.Beta10
    • 1.1.Beta2
    • Core
    • None
    • Hide

      Register a HttpHandler like the bellow code:

          final RoutingHandler rootHandler = Handlers.routing();
          rootHandler.add( new HttpString( "GET" ), "/sample/", new SampleRoute() );
          Undertow.builder()
              .addHttpListener( 9000, "localhost" )
              .setHandler( rootHandler )
              .build().start();
      

      Access http://localhost:9000/sample/ and it will return 404.

      Show
      Register a HttpHandler like the bellow code: final RoutingHandler rootHandler = Handlers.routing(); rootHandler.add( new HttpString( "GET" ), "/sample/" , new SampleRoute() ); Undertow.builder() .addHttpListener( 9000, "localhost" ) .setHandler( rootHandler ) .build().start(); Access http://localhost:9000/sample/ and it will return 404.

      I've tryied to register the "/sample/" URL for the GET Http Method using RoutingHandler. But when I access "http://localhost:9000/sample/" it always returns me a 404 status code.

      Digging into the code, I found that there's a normalization routine that removes the last "/" ( slash ) character when I add a new route.

      It seems that there's a normalization while registering the URL, but there's no normalization when the request arrive to the server. May be that's the 404 reason.

            sdouglas1@redhat.com Stuart Douglas
            miere.teixeira Miere Teixeira (Inactive)
            Stuart douglas (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: