The value of required parameter [page] was null.

Splash Forums Rewrite Users The value of required parameter [page] was null.

This topic contains 4 replies, has 3 voices, and was last updated by  Gianluca Elmo 1 year, 4 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #26993

    Gianluca Elmo
    Participant

    Hi,

    I am a little bit lost.

    I am trying this Provider out

          return ConfigurationBuilder.begin()
                  .addRule(Join.path("/{page}").to("/views/{page}.xhtml").withInboundCorrection())
                  .when(Resource.exists("/views/{page}.xhtml"))
                  .otherwise(Redirect.permanent("http://www.google.com"))
                  .where("page").matches("^[^\\/.\\s]*$");

    Unfortunately when I try to reach an existing resource

    http://localhost:8080/test/views/home

    I get an exception

    org.ocpsoft.rewrite.exception.ParameterizationException: The value of required parameter [page] was null.

    The code works only if I try to reach a resource, which does not exist.

    What am I doing wrong?

    I have tried commenting the .otherwise operation out and the URL got properly rewritten.

    What I am trying to match with the RegEX above is to filter all pages, which contain a / or a \, a . or a space. That does not seems to work. That is why I reverted back to the simpler .*. Any idea of why my regEx is not giving the expected results?

    I am using Netbean 8.0.2, deploying on Wildfly 8.2.0 using rewrite 2.0.12 with CDI extention.

    Many thanks.

    Regards,
    Luca

    • This topic was modified 1 year, 5 months ago by  Gianluca Elmo. Reason: Added question and new results
    #26995

    Not sure why otherwise doesn’t work correctly here. I’m not familiar with the implementation details. But could you perhaps post the full stacktrace please?

    Regarding the regular expression. Please remember that the regex must match against the _encoded_ URL. So space is actually not a space but %20.

    #26996

    Is that right? It matches the encoded URL? Are you sure?

    #26997

    What I see wrong with the regex is this:

    
    .matches("^[^\\/.\\s]*$");
              ^           ^

    Because the regex is going to get compiled into a larger regular expression for the entire path, you can’t use start & end matches in the regex. You could either remove them (they aren’t necessary) To be honest I think you just want to use .* based on what I see your pattern does (matches / and anything any number of times).

    Or you could remove the leading slash in your Join path:

    .addRule(Join.path("{page}").to...
    .matches("^[^\\/.\\s]*$");
    

    That might work as well.

    #27008

    Gianluca Elmo
    Participant

    Hi Christian,

    sorry for the late reply.

    Here copy of the stack trace

    2015-03-19 18:06:23,051 ERROR [io.undertow.request] (default task-12) UT005023: Exception handling request to /ocpsofttest/index: org.ocpsoft.rewrite.exception.ParameterizationException: The value of required parameter [page] was null.
    	at org.ocpsoft.rewrite.param.RegexParameterizedPatternBuilder.extractBoundValues(RegexParameterizedPatternBuilder.java:261) [rewrite-servlet-2.0.12.Final.jar:2.0.12.Final]
    	at org.ocpsoft.rewrite.param.RegexParameterizedPatternBuilder.build(RegexParameterizedPatternBuilder.java:136) [rewrite-servlet-2.0.12.Final.jar:2.0.12.Final]
    	at org.ocpsoft.rewrite.servlet.config.Forward.performHttp(Forward.java:85) [rewrite-servlet-2.0.12.Final.jar:2.0.12.Final]
    	at org.ocpsoft.rewrite.servlet.config.HttpOperation.perform(HttpOperation.java:42) [rewrite-servlet-2.0.12.Final.jar:2.0.12.Final]
    	at org.ocpsoft.rewrite.servlet.config.rule.Join.perform(Join.java:264) [rewrite-servlet-2.0.12.Final.jar:2.0.12.Final]
    	at org.ocpsoft.rewrite.config.DefaultOperationBuilder$DefaultCompositeOperation.perform(DefaultOperationBuilder.java:56) [rewrite-servlet-2.0.12.Final.jar:2.0.12.Final]
    	at org.ocpsoft.rewrite.config.RuleBuilder.perform(RuleBuilder.java:136) [rewrite-servlet-2.0.12.Final.jar:2.0.12.Final]
    	at org.ocpsoft.rewrite.config.DefaultOperationBuilder$DefaultCompositeOperation.perform(DefaultOperationBuilder.java:56) [rewrite-servlet-2.0.12.Final.jar:2.0.12.Final]
    	at org.ocpsoft.rewrite.config.RuleBuilder.perform(RuleBuilder.java:136) [rewrite-servlet-2.0.12.Final.jar:2.0.12.Final]
    	at org.ocpsoft.rewrite.config.DefaultOperationBuilder$DefaultCompositeOperation.perform(DefaultOperationBuilder.java:56) [rewrite-servlet-2.0.12.Final.jar:2.0.12.Final]
    	at org.ocpsoft.rewrite.config.RuleBuilder.perform(RuleBuilder.java:136) [rewrite-servlet-2.0.12.Final.jar:2.0.12.Final]
    	at org.ocpsoft.rewrite.servlet.impl.DefaultHttpRewriteProvider.rewriteHttp(DefaultHttpRewriteProvider.java:182) [rewrite-servlet-2.0.12.Final.jar:2.0.12.Final]
    	at org.ocpsoft.rewrite.servlet.http.HttpRewriteProvider.rewrite(HttpRewriteProvider.java:43) [rewrite-servlet-2.0.12.Final.jar:2.0.12.Final]
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.rewrite(RewriteFilter.java:247) [rewrite-servlet-2.0.12.Final.jar:2.0.12.Final]
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:188) [rewrite-servlet-2.0.12.Final.jar:2.0.12.Final]
    	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    	at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
    	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    	at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_25]
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_25]
    	at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_25]
    

    For Lincoln, thanks for the reply about the RegEx. For today’s test I have used the .*

    Unfortunately I am still not able to get it to work.

    I have attached also the POM file hoping it can help you point out the problem. Again many thanks for your help.

    Regards,
    Luca

    Attachments:
    1. pom.xml
Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

Comments are closed.