List of usage examples for org.springframework.web.util WebUtils getNativeResponse
@SuppressWarnings("unchecked") @Nullable public static <T> T getNativeResponse(ServletResponse response, @Nullable Class<T> requiredType)
From source file:org.springframework.security.web.context.HttpSessionSecurityContextRepository.java
public void saveContext(SecurityContext context, HttpServletRequest request, HttpServletResponse response) { SaveContextOnUpdateOrErrorResponseWrapper responseWrapper = WebUtils.getNativeResponse(response, SaveContextOnUpdateOrErrorResponseWrapper.class); if (responseWrapper == null) { throw new IllegalStateException("Cannot invoke saveContext on response " + response + ". You must use the HttpRequestResponseHolder.response after invoking loadContext"); }/*from w ww . ja v a2 s . c o m*/ // saveContext() might already be called by the response wrapper // if something in the chain called sendError() or sendRedirect(). This ensures we // only call it // once per request. if (!responseWrapper.isContextSaved()) { responseWrapper.saveContext(context); } }