Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-391

ResponseCodeHandler defaultParameter() returns "200"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 7.0.0.DR6
    • 7.0.0.DR5
    • Undertow
    • None
    • Hide

      Setup expression filter and add it to default-host:

      /subsystem=undertow/configuration=filter/expression-filter=test_expr:add(expression="path('/') -> response-code(403)")
      /subsystem=undertow/server=default-server/host=default-host/filter-ref=test_expr:add()
      

      Then do some request on server and exception like this occurrs:

      15:09:51,057 ERROR [io.undertow.request] (default I/O-1) Undertow request failed HttpServerExchange{ GET /}: java.lang.IllegalArgumentException: UT000045: Error parsing predicated handler string unknown parameter 200:
      path('/') -> response-code(403)
                                    ^
      	at io.undertow.server.handlers.builder.PredicatedHandlersParser.error(PredicatedHandlersParser.java:727)
      	at io.undertow.server.handlers.builder.PredicatedHandlersParser.handleHandlerNode(PredicatedHandlersParser.java:170)
      	at io.undertow.server.handlers.builder.PredicatedHandlersParser.handlePredicatedAction(PredicatedHandlersParser.java:134)
      	at io.undertow.server.handlers.builder.PredicatedHandlersParser.handlePredicateOperatorNode(PredicatedHandlersParser.java:124)
      	at io.undertow.server.handlers.builder.PredicatedHandlersParser.handleNode(PredicatedHandlersParser.java:116)
      	at io.undertow.server.handlers.builder.PredicatedHandlersParser.parse(PredicatedHandlersParser.java:90)
      	at org.wildfly.extension.undertow.filters.ExpressionFilterDefinition.createHttpHandler(ExpressionFilterDefinition.java:88)
      	at org.wildfly.extension.undertow.filters.FilterService.createHttpHandler(FilterService.java:57)
      	at org.wildfly.extension.undertow.filters.FilterRef.createHttpHandler(FilterRef.java:69)
      	at org.wildfly.extension.undertow.LocationService.configureHandlerChain(LocationService.java:96)
      	at org.wildfly.extension.undertow.Host.configureRootHandler(Host.java:117)
      	at org.wildfly.extension.undertow.Host.getOrCreateRootHandler(Host.java:171)
      	at org.wildfly.extension.undertow.Host$HostRootHandler.handleRequest(Host.java:285)
      	at io.undertow.server.handlers.NameVirtualHostHandler.handleRequest(NameVirtualHostHandler.java:53)
      	at io.undertow.server.handlers.error.SimpleErrorPageHandler.handleRequest(SimpleErrorPageHandler.java:76)
      	at io.undertow.server.handlers.CanonicalPathHandler.handleRequest(CanonicalPathHandler.java:49)
      	at io.undertow.server.handlers.ChannelUpgradeHandler.handleRequest(ChannelUpgradeHandler.java:158)
      	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
      	at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:227)
      	at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:128)
      	at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:56)
      	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
      	at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
      	at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88)
      	at org.xnio.nio.WorkerThread.run(WorkerThread.java:539)
      

      When expression filter is configured like this:

      /subsystem=undertow/configuration=filter/expression-filter=test_expr:write-attribute(name=expression,value="path('/') -> response-code(value=403)")
      reload
      

      then it works perfectly.

      Show
      Setup expression filter and add it to default-host: /subsystem=undertow/configuration=filter/expression-filter=test_expr:add(expression= "path( '/' ) -> response-code(403)" ) /subsystem=undertow/server= default -server/host= default -host/filter-ref=test_expr:add() Then do some request on server and exception like this occurrs: 15:09:51,057 ERROR [io.undertow.request] ( default I/O-1) Undertow request failed HttpServerExchange{ GET /}: java.lang.IllegalArgumentException: UT000045: Error parsing predicated handler string unknown parameter 200: path( '/' ) -> response-code(403) ^ at io.undertow.server.handlers.builder.PredicatedHandlersParser.error(PredicatedHandlersParser.java:727) at io.undertow.server.handlers.builder.PredicatedHandlersParser.handleHandlerNode(PredicatedHandlersParser.java:170) at io.undertow.server.handlers.builder.PredicatedHandlersParser.handlePredicatedAction(PredicatedHandlersParser.java:134) at io.undertow.server.handlers.builder.PredicatedHandlersParser.handlePredicateOperatorNode(PredicatedHandlersParser.java:124) at io.undertow.server.handlers.builder.PredicatedHandlersParser.handleNode(PredicatedHandlersParser.java:116) at io.undertow.server.handlers.builder.PredicatedHandlersParser.parse(PredicatedHandlersParser.java:90) at org.wildfly.extension.undertow.filters.ExpressionFilterDefinition.createHttpHandler(ExpressionFilterDefinition.java:88) at org.wildfly.extension.undertow.filters.FilterService.createHttpHandler(FilterService.java:57) at org.wildfly.extension.undertow.filters.FilterRef.createHttpHandler(FilterRef.java:69) at org.wildfly.extension.undertow.LocationService.configureHandlerChain(LocationService.java:96) at org.wildfly.extension.undertow.Host.configureRootHandler(Host.java:117) at org.wildfly.extension.undertow.Host.getOrCreateRootHandler(Host.java:171) at org.wildfly.extension.undertow.Host$HostRootHandler.handleRequest(Host.java:285) at io.undertow.server.handlers.NameVirtualHostHandler.handleRequest(NameVirtualHostHandler.java:53) at io.undertow.server.handlers.error.SimpleErrorPageHandler.handleRequest(SimpleErrorPageHandler.java:76) at io.undertow.server.handlers.CanonicalPathHandler.handleRequest(CanonicalPathHandler.java:49) at io.undertow.server.handlers.ChannelUpgradeHandler.handleRequest(ChannelUpgradeHandler.java:158) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199) at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:227) at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:128) at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:56) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) at org.xnio.nio.WorkerThread.run(WorkerThread.java:539) When expression filter is configured like this: /subsystem=undertow/configuration=filter/expression-filter=test_expr:write-attribute(name=expression,value= "path( '/' ) -> response-code(value=403)" ) reload then it works perfectly.

      When configuring expression filter in undertow subsystem using "response-code" handler, then response code value must be added as follows:

      response-code(value=403)
      

      althought in documentation is example like this:

      response-code(403)
      

      The problem seems to be here - method defaultParameter() returns "200" which is probably mistake as this handler has no such parameter.

      I suppose that either method defaultParameter() returns

      • null, so "value=403" format must be used (and documentation must be fixed)
      • "value", so format "403" may be used

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              jstourac@redhat.com Jan Stourac
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: