List of usage examples for org.springframework.web.servlet.view.xslt XsltView setApplicationContext
@Override public final void setApplicationContext(@Nullable ApplicationContext context) throws BeansException
From source file:org.jasig.portlet.proxy.mvc.portlet.xslt.XsltPortletController.java
@RequestMapping public ModelAndView showContent(PortletRequest request) { final ModelAndView mv = new ModelAndView(); final PortletPreferences preferences = request.getPreferences(); // locate the content service to use to retrieve our XML final String contentServiceKey = preferences.getValue(CONTENT_SERVICE_KEY, null); final IContentService contentService = applicationContext.getBean(contentServiceKey, IContentService.class); final IContentRequest proxyRequest = contentService.getRequest(request); // retrieve the XML content final IContentResponse proxyResponse = contentService.getContent(proxyRequest, request); try {//from w w w . j a v a 2 s . c o m mv.addObject("xml", proxyResponse.getContent()); } finally { proxyResponse.close(); } // set the appropriate view name final String mainXslt = preferences.getValue(MAIN_XSLT_KEY, null); final String mobileXslt = preferences.getValue(MOBILE_XSLT_KEY, null); final String xslt; if (mobileXslt != null) { final boolean isMobile = viewSelector.isMobile(request); xslt = isMobile ? mobileXslt : mainXslt; } else { xslt = mainXslt; } // create an XSLT view using the configured source final XsltView view = new XsltView(); view.setUrl(xslt); view.setSourceKey("xml"); view.setApplicationContext(this.applicationContext); mv.setView(view); return mv; }