Skip to content
Snippets Groups Projects
Commit c3002db0 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Fixed encoding issue in ErrorController

parent ca54bd5e
No related branches found
No related tags found
No related merge requests found
Pipeline #1047 passed
package it.inaf.oats.vospace.exception;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -23,7 +24,11 @@ public class ErrorController extends AbstractErrorController {
public void errorText(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> errors = super.getErrorAttributes(request, true);
response.setContentType("text/plain;charset=UTF-8");
response.getOutputStream().print((String) errors.get("message"));
response.setCharacterEncoding("UTF-8");
String errorMessage = (String) errors.get("message");
if (errorMessage != null) {
response.getOutputStream().write(errorMessage.getBytes(StandardCharsets.UTF_8));
}
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment