HttpServletRequest.getQueryString() does not contains rewritten param

Splash Forums Rewrite Users HttpServletRequest.getQueryString() does not contains rewritten param

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  djmj 2 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26099

    djmj
    Participant

    Having following rule rewrite rule:

    /sites/user/account.xhtml?user=userValue&foo=fooValue –> /user/{user}/account

    Join.path("/user/{user}/account").to("/sites/user/account.xhtml")

    And accessing url: “/user/userValue/account?foo=fooValue” in browser, the query parameter ‘user’ with its value ‘userValue’ is not represented in: HttpServletRequest.getQueryString().

    The param is lost within a filter:

    HttpServletRequest.getQueryString() = "foo=fooValue"
    HttpServletRequest.getServletPath() = "/sites/user/account.xhtml"

    All parameters can be found in the composite parameter map of the rewrite wrapper of HttpServletRequest.

    Is this correct behavior?

    #26101

    That’s right. Path parameters are not placed in the query string because they are not actually query-parameters. I suppose there’s no reason it *wouldn’t* work that way; it’s just not the way we implemented it.

    Is this something you need? It’s certainly possible to do this using Rewrite, but it requires a little more manual configuration.

    #26102

    djmj
    Participant

    Thanks for your explanation. Right now i think i will use RequestDispatcher.FORWARD_SERVLET_PATH in combination with RequestDispatcher.FORWARD_QUERY_STRING. Or alternatively i have to extract the parameters from the rewrite HttpServletRequest.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Comments are closed.