工作中源代码学习

HTTP获取支付异步回调,验签

2018-03-22  本文已影响12人  ___TheOne___

问题:

ServletRequest.java接口中,public Map getParameterMap();方法不单单获取post表单中参数,还会获取请求链接中的查询参数。

/**

* Returns a java.util.Map of the parameters of this request.

*

*

Request parameters are extra information sent with the request.

* For HTTP servlets, parameters are contained in the query string or

* posted form data.

*

* @returnan immutable java.util.Map containing parameter names as

* keys and parameter values as map values. The keys in the parameter

* map are of type String. The values in the parameter map are of type

* String array.

*/

public Map getParameterMap();

后续:

1.查看下spring的controller中,如何将HttpServletRequest中 public Map getParameterMap(); 实现添加进去的;

2.查看request的默认编码格式是什么?为什么请求参数中含有中文的时候,会显式设置请求和响应编码格式:

request.setCharacterEncoding("gbk");//通知传输的编码为GBK

response.setCharacterEncoding("gbk");

上一篇 下一篇

猜你喜欢

热点阅读