Is it possible to add to the available parameters of a request (HttpServletRequest)

前端 未结 6 1690
天涯浪人
天涯浪人 2020-12-14 22:50

I want to intercept a request in a filter/servlet and add a few parameters to it. However, the request does not expose a \'setParameter\' method and the parameter map when m

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-14 23:33

    First you should receive the request and read all its parameters. Then construct another request with the original parameters + the new ones and send it again.

    The HttpServletRequest is immutable and there is no way to change it.

提交回复
热议问题