Menu

#10 Request Dispatcher forward not aggregating query string corr

closed
nobody
None
5
2006-08-25
2006-08-16
Anonymous
No

Request Dispatcher forward is supposed to aggregate
the query string. I take this to mean that invoking
servlet params availble to forwarded servlet. This
does not happen correctly. In tomcat and jetty for
instance, params are aggregated such that later
invokee params are placed at lowest index of the given
param array.

Discussion

  • Robert Boyce

    Robert Boyce - 2006-08-16

    Logged In: YES
    user_id=782160

    Orig query string:
    ?action=Folders&mode=4&fldr=inbox1
    forward with:
    ?action=Acct&mode=0&acct=1
    forward with:
    ?action=Msgs&acct=1
    should give:
    action='Msgs' 'Acct' 'Folders' mode='0' '4' acct='1' '1'
    fldr='inbox1'
    winstone gives:
    fldr='inbox1' action='Msgs' mode='4' acct='1'

     
  • Robert Boyce

    Robert Boyce - 2006-08-16

    Logged In: YES
    user_id=782160

    This area of the code (parseRequestParameters) needs a good
    refactoring. There are many copies of the parameters in
    there because of the useless (i've never used it) Include
    functionality.

    protected Map parameters;
    protected Stack parametersStack; (for Include)
    protected Map forwardedParameters;

    Even so, it seems as though forwardedParameters can be
    removed for sure. the idea is to use an ArrayList for
    mapped values and just insert at index 0. This would have
    the effect of accumulating the params correctly. Of course
    getParameter, getParameterNames and getParameterValues
    would then need attention. But that should simplify them
    also.

     
  • Robert Boyce

    Robert Boyce - 2006-08-17

    Logged In: YES
    user_id=782160

    I attached a protoype of WistoneRequest to 1541529 (for
    some reason I could not attache here).

    I was quite caviler with forwardedParameters as I was not
    100% sure what the idea was with it.

    But it does correct the aggregation problem.

     
  • Robert Boyce

    Robert Boyce - 2006-08-21

    Logged In: YES
    user_id=782160

    From the 2.4 Servlet spec:
    SRV.8.4.1 Query String
    The request dispatching mechanism is responsible for
    aggregating query string
    parameters when forwarding or including requests.

    Looks like Forward and Include should both aggregate
    request parameters.

     
  • Nobody/Anonymous

    • status: open --> closed
     
  • Nobody/Anonymous

    Logged In: NO

    Should be fixed in CVS now. Thanks.

    For reference, it's only Forwards, not includes according
    to the spec.

    Also the final point (about samples of what "action"
    should be) is incorrect. The Sun TCK test breaks when it
    is implemented this way. It actually should be
    action=Msgs, acct=1, mode=0, fldr=inbox1, but with query
    string concatenating all three (ie they don't agree
    logically). Stupid I know, but there are 3 tests that
    break when it is coded the way you said (which I agree
    would be more logical).

    O well ... thanks.

     
  • Robert Boyce

    Robert Boyce - 2006-08-25

    Logged In: YES
    user_id=782160

    Obviously, it is your program and your determination, but
    tomcat and jetty both aggregate those parameters as i
    described. Also, the spec does say that both Forward and
    Include should aggregate. It's all about interpertation.
    Remember, if a bug stays around long enough, it's a feature.

     
  • Robert Boyce

    Robert Boyce - 2006-08-25

    Logged In: YES
    user_id=782160

    Just another thought after reviewing the new code. If you
    aggregate the query string, don't you affect the
    parameters? How can you throw out duplicates? No, i think
    aggregating the query string must imply that all those
    values are available in the parameters no matter what tests
    are broken (obviously tomcat and jetty must break those
    same tests).

     

Log in to post a comment.