private void processHttpResponse(HttpIdentityResponse httpIdentityResponse, HttpServletRequest request,
HttpServletResponse response) {
for(Map.Entry<String,String> entry: httpIdentityResponse.getHeaders().entrySet()) {
response.addHeader(entry.getKey(), entry.getValue());
}
for(Map.Entry<String,Cookie> entry: httpIdentityResponse.getCookies().entrySet()) {
response.addCookie(entry.getValue());
}
if(StringUtils.isNotBlank(httpIdentityResponse.getContentType())) {
response.setContentType(httpIdentityResponse.getContentType());
}
if (httpIdentityResponse.getStatusCode() == HttpServletResponse.SC_MOVED_TEMPORARILY) {
try {
sendRedirect(response, httpIdentityResponse);
} catch (IOException ex) {
throw FrameworkRuntimeException.error("Error occurred while redirecting response", ex);
}
} else {
response.setStatus(httpIdentityResponse.getStatusCode());
try {
PrintWriter out = response.getWriter();
if(StringUtils.isNotBlank(httpIdentityResponse.getBody())) {
out.print(httpIdentityResponse.getBody());
}
} catch (IOException e) {
throw FrameworkRuntimeException.error("Error occurred while getting Response writer object", e);
}
}
}