use of org.springframework.web.servlet.View in project cas by apereo.
the class Cas30ResponseViewTests method renderView.
protected Map<?, ?> renderView() throws Exception {
final ModelAndView modelAndView = this.getModelAndViewUponServiceValidationWithSecurePgtUrl();
LOGGER.debug("Retrieved model and view [{}]", modelAndView.getModel());
final MockHttpServletRequest req = new MockHttpServletRequest(new MockServletContext());
req.setAttribute(RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE, new GenericWebApplicationContext(req.getServletContext()));
final ProtocolAttributeEncoder encoder = new DefaultCasProtocolAttributeEncoder(this.servicesManager, CipherExecutor.noOpOfStringToString());
final View viewDelegated = new View() {
@Override
public String getContentType() {
return MediaType.TEXT_HTML_VALUE;
}
@Override
public void render(final Map<String, ?> map, final HttpServletRequest request, final HttpServletResponse response) {
LOGGER.warn("Setting attribute [{}]", map.keySet());
map.forEach(request::setAttribute);
}
};
final AbstractCasView view = getCasViewToRender(encoder, viewDelegated);
final MockHttpServletResponse resp = new MockHttpServletResponse();
view.render(modelAndView.getModel(), req, resp);
return getRenderedViewModelMap(req);
}
use of org.springframework.web.servlet.View in project grails-core by grails.
the class GrailsExceptionResolver method resolveView.
protected void resolveView(HttpServletRequest request, UrlMappingInfo info, ModelAndView mv) throws Exception {
ViewResolver viewResolver = WebUtils.lookupViewResolver(servletContext);
View v = UrlMappingUtils.resolveView(request, info, info.getViewName(), viewResolver);
if (v != null) {
mv.setView(v);
}
}
use of org.springframework.web.servlet.View in project spring-security-oauth by spring-projects.
the class AuthorizationEndpointTests method testAuthorizationCodeWithTrickyState.
@Test
public void testAuthorizationCodeWithTrickyState() throws Exception {
endpoint.setAuthorizationCodeServices(new StubAuthorizationCodeServices());
model.put("authorizationRequest", getAuthorizationRequest("foo", "http://anywhere.com", " =?s", null, Collections.singleton("code")));
View result = endpoint.approveOrDeny(Collections.singletonMap(OAuth2Utils.USER_OAUTH_APPROVAL, "true"), model, sessionStatus, principal);
assertEquals("http://anywhere.com?code=thecode&state=%20%3D?s", ((RedirectView) result).getUrl());
}
use of org.springframework.web.servlet.View in project spring-security-oauth by spring-projects.
the class AuthorizationEndpointTests method testAuthorizationCodeWithMultipleQueryParams.
@Test
public void testAuthorizationCodeWithMultipleQueryParams() throws Exception {
endpoint.setAuthorizationCodeServices(new StubAuthorizationCodeServices());
model.put("authorizationRequest", getAuthorizationRequest("foo", "http://anywhere.com?foo=bar&bar=foo", null, null, Collections.singleton("code")));
View result = endpoint.approveOrDeny(Collections.singletonMap(OAuth2Utils.USER_OAUTH_APPROVAL, "true"), model, sessionStatus, principal);
assertEquals("http://anywhere.com?foo=bar&bar=foo&code=thecode", ((RedirectView) result).getUrl());
}
use of org.springframework.web.servlet.View in project spring-security-oauth by spring-projects.
the class AuthorizationEndpointTests method testAuthorizationCodeWithMoreTrickyEncodedQueryParams.
@Test
public void testAuthorizationCodeWithMoreTrickyEncodedQueryParams() throws Exception {
endpoint.setAuthorizationCodeServices(new StubAuthorizationCodeServices());
model.put("authorizationRequest", getAuthorizationRequest("foo", "http://anywhere?t=a%3Db%26ep%3Dtest%2540test.me", null, null, Collections.singleton("code")));
View result = endpoint.approveOrDeny(Collections.singletonMap(OAuth2Utils.USER_OAUTH_APPROVAL, "true"), model, sessionStatus, principal);
assertEquals("http://anywhere?t=a%3Db%26ep%3Dtest%2540test.me&code=thecode", ((RedirectView) result).getUrl());
}
Aggregations