Method One, inherit Httpservletrequestwrapper, implement the custom request
1, in addition to the modified parameters, other headers and other parameters unchanged, equivalent to modify the request parameters
2. The essence is another request
/** * @author Zxguan * @description * @create 2018-03-02 9:51*/ Public classParameterrequestwrapper extends Httpservletrequestwrapper {PrivateMapparams; PublicParameterrequestwrapper (httpservletrequest request, Map Parammap) {super (request); params=Parammap; } @Override PublicMap<string, string[]>Getparametermap () {return params; }}
// The new hashmap<> is used to regenerate a map, because Request.getparametermap () gets a list of parameters that are not allowed to modify " Java.lang.IllegalStateException:No Modifications is allowed to a locked Parametermap " New Hashmap<>(Request.getparametermap ()); // xxx is the parameter to be overwritten, VALUESTR is the true parameter value, Wraprequest is the newly generated custom request Parammap.put ("xxx"new New Parameterrequestwrapper (Request, Parammap);
Method Two, did not find! - _ - !
Java Web Modification Request Parameters