Return-Path: Delivered-To: apmail-struts-dev-archive@www.apache.org Received: (qmail 81084 invoked from network); 24 Jun 2004 23:38:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 24 Jun 2004 23:38:53 -0000 Received: (qmail 73762 invoked by uid 500); 24 Jun 2004 23:39:00 -0000 Delivered-To: apmail-struts-dev-archive@struts.apache.org Received: (qmail 73627 invoked by uid 500); 24 Jun 2004 23:38:57 -0000 Mailing-List: contact dev-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Struts Developers List" Reply-To: "Struts Developers List" Delivered-To: mailing list dev@struts.apache.org Received: (qmail 73411 invoked by uid 500); 24 Jun 2004 23:38:52 -0000 Received: (qmail 73370 invoked by uid 500); 24 Jun 2004 23:38:51 -0000 Received: (qmail 73173 invoked by uid 99); 24 Jun 2004 23:38:44 -0000 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Thu, 24 Jun 2004 16:38:44 -0700 Received: (qmail 80755 invoked by uid 1237); 24 Jun 2004 23:38:16 -0000 Date: 24 Jun 2004 23:38:16 -0000 Message-ID: <20040624233816.80754.qmail@minotaur.apache.org> From: husted@apache.org To: jakarta-struts-cvs@apache.org Subject: cvs commit: jakarta-struts/src/share/org/apache/struts/actions RedeployableActionServlet.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N husted 2004/06/24 16:38:16 Added: src/share/org/apache/struts/actions RedeployableActionServlet.java Log: Apply #26322 - WebLogic hot-deploy breaks Tiles; TilesRequestProcessor is not serializable - Renaud Waldura, Justin Ashworth, YuJeong Kim, et al. Revision Changes Path 1.1 jakarta-struts/src/share/org/apache/struts/actions/RedeployableActionServlet.java Index: RedeployableActionServlet.java =================================================================== package org.apache.struts.actions; import javax.servlet.ServletException; import org.apache.struts.Globals; import org.apache.struts.action.ActionServlet; import org.apache.struts.config.ModuleConfig; import org.apache.struts.tiles.DefinitionsFactory; import org.apache.struts.tiles.DefinitionsFactoryException; import org.apache.struts.tiles.TilesRequestProcessor; /** *

* WebLogic (at least v6 and v7) attempts to serialize the TilesRequestProcessor * when re-deploying the Webapp in development mode. The TilesRequestProcessor * is not serializable, and loses the Tiles definitions. This results in * NullPointerException and/or NotSerializableException when using the app after * automatic redeploy. *

*

* This bug report proposes a workaround for this problem, in the hope it will * help others and maybe motivate an actual fix. *

*

* The attached class extends the Struts Action servlet and fixes the problem by * reloading the Tiles definitions when they have disappeared. *

*

* For background discussion see * http://issues.apache.org/bugzilla/show_bug.cgi?id=26322 *

* @version $Revision: 1.1 $ $Date: 2004/06/24 23:38:16 $ * @since 1.2.1 */ public class RedeployableActionServlet extends ActionServlet { private TilesRequestProcessor tileProcessor; protected synchronized org.apache.struts.action.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; } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org For additional commands, e-mail: dev-help@struts.apache.org