当用文字和图片同时上传时,英文,数字字符不会乱码,只有中文乱码
@Override
public ActivateResponse addActivate(String userid, String username, String activatename, String activateaddr,
String formatDate, String context, String pageviews, String activateType, String bitmapPath) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("userid", userid);
paramMap.add("username", username);
paramMap.add("activatename", activatename);
paramMap.add("activateaddr", activateaddr);
paramMap.add("starttime", formatDate);
paramMap.add("context", context);
paramMap.add("pageviews", pageviews);
paramMap.add("activatetype", activateType);
String url = null;
if (bitmapPath != null && bitmapPath.length() > 0) {
paramMap.add("bitmappath", new FileSystemResource(bitmapPath));
url = getRequestUrl(REQUEST_NEW_ACTIVATE);
}else {
url = getRequestUrl(REQUEST_NEW_ACTIVATENOPIC);
}
ActivateResponse response = restTemplate.postForObject(url, paramMap,
ActivateResponse.class);
return response;
}
@wendal 前端是android
public ActivateResponse addActivate(String userid, String username, String activatename, String activateaddr,
String formatDate, String context, String pageviews, String activateType, String bitmapPath) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("userid", userid);
paramMap.add("username", username);
paramMap.add("activatename", activatename);
paramMap.add("activateaddr", activateaddr);
paramMap.add("starttime", formatDate);
paramMap.add("context", context);
paramMap.add("pageviews", pageviews);
paramMap.add("activatetype", activateType);
String url = null;
if (bitmapPath != null && bitmapPath.length() > 0) {
paramMap.add("bitmappath", new FileSystemResource(bitmapPath));
url = getRequestUrl(REQUEST_NEW_ACTIVATE);
}else {
url = getRequestUrl(REQUEST_NEW_ACTIVATENOPIC);
}
ActivateResponse response = restTemplate.postForObject(url, paramMap,
ActivateResponse.class);
return response;
}