use of org.apache.struts.tiles.DefinitionsFactory in project sonar-java by SonarSource.
the class ReloadDefinitionsAction method execute.
/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it),
* with provision for handling exceptions thrown by the business logic.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request (if any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
* @exception Exception if the application business logic throws
* an exception
* @since Struts 1.1
*/
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setContentType("text/plain");
PrintWriter writer = response.getWriter();
try {
ServletContext context = getServlet().getServletContext();
DefinitionsFactory factory = TilesUtil.getDefinitionsFactory(request, context);
factory.setConfig(factory.getConfig(), context);
writer.println("OK");
} catch (ClassCastException e) {
writer.println("FAIL - " + e.toString());
getServlet().log("ReloadAction", e);
} catch (DefinitionsFactoryException e) {
writer.println("FAIL - " + e.toString());
getServlet().log("ReloadAction", e);
}
writer.flush();
writer.close();
return (null);
}
use of org.apache.struts.tiles.DefinitionsFactory in project sonar-java by SonarSource.
the class ViewDefinitionsAction method execute.
/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it),
* with provision for handling exceptions thrown by the business logic.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request (if any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
* @exception Exception if the application business logic throws
* an exception
* @since Struts 1.1
*/
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setContentType("text/plain");
PrintWriter writer = response.getWriter();
try {
ServletContext context = getServlet().getServletContext();
DefinitionsFactory factory = TilesUtil.getDefinitionsFactory(request, context);
writer.println(factory.toString());
} catch (Exception e) {
writer.println("FAIL - " + e.toString());
getServlet().log("ReloadAction", e);
}
writer.flush();
writer.close();
return (null);
}
use of org.apache.struts.tiles.DefinitionsFactory in project sonar-java by SonarSource.
the class InitDefinitionsTag method doStartTag.
/**
* Do start tag.
*/
public int doStartTag() throws JspException {
DefinitionsFactory factory = TilesUtil.getDefinitionsFactory(pageContext.getRequest(), pageContext.getServletContext());
if (factory != null)
return SKIP_BODY;
DefinitionsFactoryConfig factoryConfig = new DefinitionsFactoryConfig();
factoryConfig.setFactoryClassname(classname);
factoryConfig.setDefinitionConfigFiles(filename);
try {
factory = TilesUtil.createDefinitionsFactory(pageContext.getServletContext(), factoryConfig);
} catch (DefinitionsFactoryException ex) {
ex.printStackTrace();
throw new JspException(ex);
}
return SKIP_BODY;
}
use of org.apache.struts.tiles.DefinitionsFactory in project sonar-java by SonarSource.
the class RedeployableActionServlet method getRequestProcessor.
protected synchronized RequestProcessor getRequestProcessor(ModuleConfig config) throws ServletException {
if (tileProcessor != null) {
TilesRequestProcessor processor = (TilesRequestProcessor) super.getRequestProcessor(config);
return processor;
}
// reset the request processor
String requestProcessorKey = Globals.REQUEST_PROCESSOR_KEY + config.getPrefix();
getServletContext().removeAttribute(requestProcessorKey);
// create a new request processor instance
TilesRequestProcessor processor = (TilesRequestProcessor) super.getRequestProcessor(config);
tileProcessor = processor;
try {
// reload Tiles defs
DefinitionsFactory factory = processor.getDefinitionsFactory();
factory.init(factory.getConfig(), getServletContext());
// System.out.println("reloaded tiles-definitions");
} catch (DefinitionsFactoryException e) {
e.printStackTrace();
}
return processor;
}
Aggregations