1 package org.apache.struts.actions; 2 3 import javax.servlet.ServletException ; 4 5 import org.apache.struts.Globals; 6 import org.apache.struts.action.ActionServlet; 7 import org.apache.struts.action.RequestProcessor; 8 import org.apache.struts.config.ModuleConfig; 9 import org.apache.struts.tiles.DefinitionsFactory; 10 import org.apache.struts.tiles.DefinitionsFactoryException; 11 import org.apache.struts.tiles.TilesRequestProcessor; 12 13 14 37 public class RedeployableActionServlet extends ActionServlet { 38 private TilesRequestProcessor tileProcessor; 39 40 protected synchronized RequestProcessor 41 getRequestProcessor(ModuleConfig config) throws ServletException { 42 43 if (tileProcessor != null) { 44 TilesRequestProcessor processor = (TilesRequestProcessor) super.getRequestProcessor(config); 45 return processor; 46 } 47 48 String requestProcessorKey = Globals.REQUEST_PROCESSOR_KEY + 50 config.getPrefix(); 51 getServletContext().removeAttribute(requestProcessorKey); 52 53 TilesRequestProcessor processor = (TilesRequestProcessor) super.getRequestProcessor(config); 55 56 tileProcessor = processor; 57 58 try { 59 DefinitionsFactory factory = processor.getDefinitionsFactory(); 61 factory.init(factory.getConfig(), getServletContext()); 62 } catch (DefinitionsFactoryException e) { 64 e.printStackTrace(); 65 } 66 67 return processor; 68 } 69 } 70 | Popular Tags |