private Map<?, ?> renderView() throws Exception{ final ModelAndView modelAndView = this.getModelAndViewUponServiceValidationWithSecurePgtUrl(); final JstlView v = (JstlView) resolver.resolveViewName(modelAndView.getViewName(), Locale.getDefault()); final MockHttpServletRequest req = new MockHttpServletRequest(new MockServletContext()); v.setServletContext(req.getServletContext()); req.setAttribute(RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE, new GenericWebApplicationContext(req.getServletContext())); final Cas30ResponseView view = new Cas30ResponseView(v); view.setServicesManager(this.servicesManager); view.setCasAttributeEncoder(new DefaultCasAttributeEncoder(this.servicesManager)); final MockHttpServletResponse resp = new MockHttpServletResponse(); view.render(modelAndView.getModel(), req, resp); return (Map<?, ?>) req.getAttribute(CasProtocolConstants.VALIDATION_CAS_MODEL_ATTRIBUTE_NAME_ATTRIBUTES); }
@Test public void verifyView() throws Exception { final ModelAndView modelAndView = this.getModelAndViewUponServiceValidationWithSecurePgtUrl(); final JstlView v = (JstlView) resolver.resolveViewName(modelAndView.getViewName(), Locale.getDefault()); final MockHttpServletRequest req = new MockHttpServletRequest(new MockServletContext()); v.setServletContext(req.getServletContext()); req.setAttribute(RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE, new GenericWebApplicationContext(req.getServletContext())); final Cas20ResponseView view = new Cas20ResponseView(v); final MockHttpServletResponse resp = new MockHttpServletResponse(); view.render(modelAndView.getModel(), req, resp); assertNotNull(req.getAttribute(CasViewConstants.MODEL_ATTRIBUTE_NAME_CHAINED_AUTHENTICATIONS)); assertNotNull(req.getAttribute(CasViewConstants.MODEL_ATTRIBUTE_NAME_PRIMARY_AUTHENTICATION)); assertNotNull(req.getAttribute(CasViewConstants.MODEL_ATTRIBUTE_NAME_PRINCIPAL)); assertNotNull(req.getAttribute(CasProtocolConstants.VALIDATION_CAS_MODEL_PROXY_GRANTING_TICKET_IOU)); }
@Bean public ViewResolver contentNegotiatingViewResolver() { logger.debug("Configuring the ContentNegotiatingViewResolver"); ContentNegotiatingViewResolver viewResolver = new ContentNegotiatingViewResolver(); List<ViewResolver> viewResolvers = new ArrayList<ViewResolver>(); UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver(); urlBasedViewResolver.setViewClass(JstlView.class); urlBasedViewResolver.setSuffix(".html"); viewResolvers.add(urlBasedViewResolver); viewResolver.setViewResolvers(viewResolvers); List<View> defaultViews = new ArrayList<View>(); defaultViews.add(new MappingJackson2JsonView()); viewResolver.setDefaultViews(defaultViews); return viewResolver; }
protected JstlView createView(String viewName) { return new JstlView("/WEB-INF/jsp/" + viewName + ".jsp") { @Override protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception { ServletOutputStream output = response.getOutputStream(); ServletContext servletContext = request.getServletContext(); super.setServletContext(servletContext); CacheResponseWrapper cacheResponseWrapper = new CacheResponseWrapper(response); // System.err.println("renderMergedOutputModel"); super.renderMergedOutputModel(model, request, cacheResponseWrapper); byte[] data = cacheResponseWrapper.getResponseData(); String content = new String(data); response(content); output.write(data); output.flush(); } }; }
@Bean public ViewResolver contentNegotiatingViewResolver() { LOGGER.debug("Configuring the ContentNegotiatingViewResolver"); ContentNegotiatingViewResolver viewResolver = new ContentNegotiatingViewResolver(); List<ViewResolver> viewResolvers = new ArrayList<>(); UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver(); urlBasedViewResolver.setViewClass(JstlView.class); urlBasedViewResolver.setPrefix("/WEB-INF/pages/"); urlBasedViewResolver.setSuffix(".jsp"); viewResolvers.add(urlBasedViewResolver); viewResolver.setViewResolvers(viewResolvers); List<View> defaultViews = new ArrayList<>(); defaultViews.add(new MappingJackson2JsonView()); viewResolver.setDefaultViews(defaultViews); return viewResolver; }
@Bean public UrlBasedViewResolver urlBasedViewResolver() { UrlBasedViewResolver resolver = new UrlBasedViewResolver(); resolver.setPrefix("/WEB-INF/views/"); resolver.setSuffix(".jsp"); resolver.setViewClass(JstlView.class); return resolver; }
/** * Configure ViewResolvers to deliver preferred views. */ @Override public void configureViewResolvers(ViewResolverRegistry registry) { InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); viewResolver.setViewClass(JstlView.class); viewResolver.setPrefix("/WEB-INF/views/"); viewResolver.setSuffix(".jsp"); registry.viewResolver(viewResolver); }
@Bean public UrlBasedViewResolver setupViewResolver() { UrlBasedViewResolver resolver = new UrlBasedViewResolver(); resolver.setPrefix("/WEB-INF/jsp/"); resolver.setSuffix(".jsp"); resolver.setViewClass(JstlView.class); return resolver; }
@Bean public InternalResourceViewResolver setupViewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setPrefix("/"); resolver.setSuffix(".jsp"); resolver.setContentType("text/html; charset-utf-8"); resolver.setViewClass(JstlView.class); return resolver; }
/** * @return ViewResolver */ @Bean public UrlBasedViewResolver setupViewResolver() { final UrlBasedViewResolver resolver = new UrlBasedViewResolver(); resolver.setPrefix("/"); resolver.setSuffix(".html"); resolver.setViewClass(JstlView.class); return resolver; }
@Bean public ViewResolver viewResolver() { final InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setViewClass(JstlView.class); resolver.setPrefix("/WEB-INF/views/"); resolver.setSuffix(".jsp"); return resolver; }
@Bean public InternalResourceViewResolver setupViewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setViewClass(JstlView.class); resolver.setPrefix("/WEB-INF/"); resolver.setSuffix(".html"); return resolver; }
@Override public void configureViewResolvers(ViewResolverRegistry registry) { InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); viewResolver.setViewClass(JstlView.class); viewResolver.setPrefix("/WEB-INF/views/"); viewResolver.setSuffix(".jsp"); registry.viewResolver(viewResolver); }
public static InternalResourceViewResolver getViewResolver() { InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); viewResolver.setViewClass(JstlView.class); viewResolver.setPrefix("/WEB-INF/jsp/"); viewResolver.setSuffix(".jsp"); return viewResolver; }
@Bean public ViewResolver viewResolver() { final InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setViewClass(JstlView.class); resolver.setPrefix("/WEB-INF/jsp/"); resolver.setSuffix(".jsp"); return resolver; }
/** * Mapeia todas as páginas JSP. * * @return o resolver da camada visão */ @Bean public ViewResolver viewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setViewClass(JstlView.class); resolver.setPrefix("/"); resolver.setSuffix(".jsp"); return resolver; }
@Bean public ViewResolver viewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setViewClass(JstlView.class); resolver.setPrefix("/WEB-INF/views/"); resolver.setSuffix(".jsp"); return resolver; }
@Bean public ViewResolver viewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setPrefix("/WEB-INF/views/"); resolver.setSuffix(".jsp"); resolver.setCache(false); resolver.setViewClass(JstlView.class); return resolver; }
@Bean InternalResourceViewResolver jspViewResolver() { final InternalResourceViewResolver vr = new InternalResourceViewResolver(); vr.setPrefix(prefix); vr.setSuffix(suffix); vr.setViewClass(JstlView.class); vr.setViewNames(viewNames); return vr; }
@Bean public UrlBasedViewResolver setupViewResolver() { UrlBasedViewResolver resolver = new UrlBasedViewResolver(); resolver.setPrefix("/WEB-INF/views/"); resolver.setSuffix(".jsp"); resolver.setViewClass(JstlView.class); return resolver; }
/** * Gets the internal resource view resolver. * * @return the internal resource view resolver */ @Bean(name = "jspViewResolver") public ViewResolver getViewResolver() { logger.debug("Instantiated internalResourceViewResolver"); InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setViewClass(JstlView.class); resolver.setPrefix("/WEB-INF/jsp/"); resolver.setSuffix(".jsp"); return resolver; }
@Bean public UrlBasedViewResolver setUpJSPViewResolver() { UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver(); urlBasedViewResolver.setSuffix(".jsp"); urlBasedViewResolver.setPrefix("/"); urlBasedViewResolver.setViewClass(JstlView.class); return urlBasedViewResolver; }
@Bean public ViewResolver viewResolver() { final InternalResourceViewResolver bean = new InternalResourceViewResolver(); bean.setViewClass(JstlView.class); bean.setPrefix("/WEB-INF/view/"); bean.setSuffix(".jsp"); return bean; }
@Bean @Description("Default viewClass: JSTL view (JSP with html output)") public ViewResolver internalResourceViewResolver() { // Example: a logical view name of 'vets' is mapped to // '/WEB-INF/jsp/vets.jsp' InternalResourceViewResolver bean = new InternalResourceViewResolver(); bean.setViewClass(JstlView.class); bean.setPrefix("/WEB-INF/jsp/"); bean.setSuffix(".jsp"); return bean; }
@Bean public InternalResourceViewResolver jspViewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setOrder(1); resolver.setPrefix("/WEB-INF/views/"); resolver.setSuffix(".jsp"); resolver.setRedirectHttp10Compatible(false); resolver.setViewClass(JstlView.class); return resolver; }
@Override public void configureViewResolvers(ViewResolverRegistry registry) { InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); viewResolver.setViewClass(JstlView.class); viewResolver.setPrefix("/WEB-INF/views/"); viewResolver.setSuffix(".jsp"); registry.viewResolver(viewResolver); super.configureViewResolvers(registry); }
@Bean public UrlBasedViewResolver setupViewResolver(){ UrlBasedViewResolver ubvr = new UrlBasedViewResolver(); ubvr.setPrefix("/WEB-INF/jsp/"); ubvr.setSuffix(".jsp"); ubvr.setViewClass(JstlView.class); return ubvr; }
@Bean public UrlBasedViewResolver viewResolver() { UrlBasedViewResolver resolver = new UrlBasedViewResolver(); resolver.setViewClass(JstlView.class); resolver.setPrefix("/WEB-INF/jsp/"); resolver.setSuffix(".jsp"); return resolver; }