微信公众号开发——获取用户openId
/**
*
* 获取用户openID
* @param course
* @return
* @throws UnsupportedEncodingException
*/
@RequestMapping(value = "/obtainOpenid" , method = RequestMethod.POST)
public String obtainOpenid(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException{
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
request = attributes.getRequest();
// 获取openid
response.setContentType("text/html");<