我在检票口 1.4.9 中使用了下面的 configureResponse()
protected void configureResponse() {
super.configureResponse();
WebResponse response = getWebRequestCycle().getWebResponse();
response.setHeader("Cache-Control", "no-cache, max-age=0,must-revalidate, no-store");
response.setHeader("Expires", "-1");
response.setHeader("Pragma", "no-cache");
response.setCharacterEncoding("text/html; charset=utf-8");
response.setLocale(new Locale(Constants.USER_LANG_PREF_ENG));
}
所以现在在检票口 6 中 configureResponse() 被删除,它们被 configureResponse(WebResponse response) 取代,所以我尝试使用这种方法编写上面的代码,如下所示,
@Override
protected void configureResponse(WebResponse response) {
// TODO Auto-generated method stub
super.configureResponse(response);
response.setHeader("Cache-Control", "no-cache, max-age=0,must-revalidate, no-store");
response.setHeader("Expires", "-1");
response.setHeader("Pragma", "no-cache");
final String encoding = "text/html" + getMarkupType() + "; charset=utf-8";
response.setContentType(encoding);
final Locale originalLocale = getSession().getLocale();
getSession().setLocale(new Locale(Constants.USER_LANG_PREF_ENG));
}
谁能告诉我,此代码将与以前的代码相同,还是我需要再次修改?