use of org.apache.wicket.protocol.http.servlet.AbstractRequestWrapperFactory in project wicket by apache.
the class WebApplication method createWebRequest.
/**
* Pre- and post- configures the {@link WebRequest} created by user override-able
* {@link #newWebRequest(HttpServletRequest, String)}
*
* @param servletRequest
* the current HTTP Servlet request
* @param filterPath
* the filter mapping read from web.xml
* @return a WebRequest object
*/
WebRequest createWebRequest(HttpServletRequest servletRequest, final String filterPath) {
if (hasFilterFactoryManager()) {
for (AbstractRequestWrapperFactory factory : getFilterFactoryManager()) {
servletRequest = factory.getWrapper(servletRequest);
}
}
WebRequest webRequest = newWebRequest(servletRequest, filterPath);
if (servletRequest.getCharacterEncoding() == null) {
try {
if (webRequest.isAjax()) {
// WICKET-3908, WICKET-1816: Forms submitted with Ajax are always UTF-8 encoded
servletRequest.setCharacterEncoding(CharEncoding.UTF_8);
} else {
String requestEncoding = getRequestCycleSettings().getResponseRequestEncoding();
servletRequest.setCharacterEncoding(requestEncoding);
}
} catch (UnsupportedEncodingException e) {
throw new WicketRuntimeException(e);
}
}
return webRequest;
}
Aggregations