private void process(AuthorizationRequestProcessor processor, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ServiceProviderToken token; try { token = loader.getTokenForAuthorization(request); } catch (OAuthException e) { if (e instanceof OAuthProblemException) { OAuthProblemUtils.logOAuthProblem(OAuthServlet.getMessage(request, null), (OAuthProblemException) e, log); } handleException(response, e, applicationProperties.getBaseUrl(), false); // setting content type directly to "text/html;charset=UTF-8" does not seem to work, // probably due to the response.reset() call in handleException() above renderError(response, getMessage(e)); return; } if (!loginRedirector.isLoggedIn(request)) { loginRedirector.redirectToLogin(request, response); } else { processor.process(request, response, token); } }