Return-Path: Mailing-List: contact struts-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list struts-dev@jakarta.apache.org Received: (qmail 71868 invoked by uid 500); 16 Oct 2000 03:39:29 -0000 Delivered-To: apmail-jakarta-struts-cvs@apache.org Received: (qmail 71864 invoked by uid 1059); 16 Oct 2000 03:39:28 -0000 Date: 16 Oct 2000 03:39:28 -0000 Message-ID: <20001016033928.71863.qmail@locus.apache.org> From: craigmcc@locus.apache.org To: jakarta-struts-cvs@apache.org Subject: cvs commit: jakarta-struts/src/share/org/apache/struts/action ActionServlet.java craigmcc 00/10/15 20:39:28 Modified: src/share/org/apache/struts/action ActionServlet.java Log: Add a preprocessing hook that lets a custom subclass of ActionServlet get control before any of the standard processing is performed. The preprocess method can examine and/or modify the request and response parameters, and then return true to let the normal processing continue, or false if it has generated the response and the rest of the normal processing should be skipped. Submitted by: Chris Audley Revision Changes Path 1.31 +35 -4 jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java Index: ActionServlet.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- ActionServlet.java 2000/10/15 03:29:15 1.30 +++ ActionServlet.java 2000/10/16 03:39:28 1.31 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v 1.30 2000/10/15 03:29:15 craigmcc Exp $ - * $Revision: 1.30 $ - * $Date: 2000/10/15 03:29:15 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v 1.31 2000/10/16 03:39:28 craigmcc Exp $ + * $Revision: 1.31 $ + * $Date: 2000/10/16 03:39:28 $ * * ==================================================================== * @@ -200,7 +200,7 @@ * * * @author Craig R. McClanahan - * @version $Revision: 1.30 $ $Date: 2000/10/15 03:29:15 $ + * @version $Revision: 1.31 $ $Date: 2000/10/16 03:39:28 $ */ public class ActionServlet @@ -1042,6 +1042,10 @@ processContent(response); processNoCache(response); + // General purpose preprocessing hook + if (!processPreprocess(request, response)) + return; + // Look up the corresponding mapping ActionMapping mapping = processMapping(path, request); if (mapping == null) { @@ -1358,6 +1362,33 @@ if ((period >= 0) && (period > slash)) path = path.substring(0, period); return (path); + + } + + + /** + * General purpose preprocessing hook that can be overridden to support + * application specific preprocessing activity. This hook can examine + * and/or modify the properties of the request and response objects, and + * optionally complete the response if it wishes. + *

+ * The default implementation does nothing. + * + * @param request The servlet request we are processing + * @param response The servlet response we are generating + * + * @return true if the remainder of the standard processing + * should be performed, or false if the response has already + * been created so the calling method should immediately exit + * + * @exception IOException if an input/output error occurs + * @exception ServletException if a servlet exception occurs + */ + protected boolean processPreprocess(HttpServletRequest request, + HttpServletResponse response) + throws IOException, ServletException { + + return (true); // Default implementation does nothing }