use of com.thoughtworks.go.server.newsecurity.handlers.renderer.ContentTypeNegotiationMessageRenderer in project gocd by gocd.
the class AccessTokenAuthenticationFilter method onAuthenticationFailure.
private void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, String errorMessage) throws IOException {
response.setStatus(SC_UNAUTHORIZED);
ContentTypeAwareResponse contentTypeAwareResponse = new ContentTypeNegotiationMessageRenderer().getResponse(request);
response.setCharacterEncoding("utf-8");
response.setContentType(contentTypeAwareResponse.getContentType().toString());
response.getOutputStream().print(contentTypeAwareResponse.getFormattedMessage(errorMessage));
}
Aggregations