In jetty9, I can set the encoding for request, response and uri by inheriting handlerWrapper and rewriting handle(String target, Request baseRequest, HttpServletRequest request,
HttpServletResponse response). Is there an alternative method in jetty12?
I set it up like this
`
protected void doFilterCharacterEncoding(
HttpServletRequest request, HttpServletResponse response)
throws UnsupportedEncodingException {
if (StringUtil.isNotBlank(URICharset)) {
request.setAttribute("org.eclipse.jetty.server.Request.queryEncoding", URICharset);
}
if (StringUtil.isNotBlank(requestCharacterEncoding) && request.getCharacterEncoding() == null) {
request.setCharacterEncoding(requestCharacterEncoding);
}
if (StringUtil.isNotBlank(responseCharacterEncoding)) {
response.setCharacterEncoding(responseCharacterEncoding);
}
}
`
Is there any alternative method? Thanks for your answer
yusen zhang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.