@Override protected ModelAndView handleRequestInternal( HttpServletRequest request, HttpServletResponse response) throws Exception { SiteContext siteContext = SiteContext.getCurrent(); ScriptFactory scriptFactory = siteContext.getScriptFactory(); if (scriptFactory == null) { throw new IllegalStateException( "No script factory associate to current site context '" + siteContext.getSiteName() + "'"); } String serviceUrl = getServiceUrl(request); String scriptUrl = getScriptUrl(scriptFactory, siteContext, request, serviceUrl); Object responseBody = executeScript(scriptFactory, request, response, scriptUrl); if (response.isCommitted()) { // If response has been already committed by the script, just return null logger.debug("Response already committed by script " + scriptUrl); return null; } ModelAndView modelAndView = new ModelAndView(); modelAndView.addObject(responseBodyModelAttributeName, responseBody); return modelAndView; }
@Override public String[] getTenants() { return new String[] {SiteContext.getCurrent().getSiteName()}; }