Return-Path: Delivered-To: apmail-incubator-jspwiki-commits-archive@locus.apache.org Received: (qmail 92168 invoked from network); 6 Oct 2008 03:51:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Oct 2008 03:51:47 -0000 Received: (qmail 74185 invoked by uid 500); 6 Oct 2008 03:51:46 -0000 Delivered-To: apmail-incubator-jspwiki-commits-archive@incubator.apache.org Received: (qmail 74170 invoked by uid 500); 6 Oct 2008 03:51:46 -0000 Mailing-List: contact jspwiki-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jspwiki-dev@incubator.apache.org Delivered-To: mailing list jspwiki-commits@incubator.apache.org Received: (qmail 74161 invoked by uid 99); 6 Oct 2008 03:51:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Oct 2008 20:51:46 -0700 X-ASF-Spam-Status: No, hits=-1999.9 required=10.0 tests=ALL_TRUSTED,DNS_FROM_SECURITYSAGE X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Oct 2008 03:50:50 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id EF9F2238895F; Sun, 5 Oct 2008 20:50:55 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r701929 - /incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiContext.java Date: Mon, 06 Oct 2008 03:50:55 -0000 To: jspwiki-commits@incubator.apache.org From: ajaquith@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081006035055.EF9F2238895F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ajaquith Date: Sun Oct 5 20:50:55 2008 New Revision: 701929 URL: http://svn.apache.org/viewvc?rev=701929&view=rev Log: Merged STRIPES_BRANCH with trunk revision 701873. Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiContext.java Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiContext.java URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiContext.java?rev=701929&r1=701928&r2=701929&view=diff ============================================================================== --- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiContext.java (original) +++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiContext.java Sun Oct 5 20:50:55 2008 @@ -71,6 +71,18 @@ { private WikiPage m_page; private WikiPage m_realPage; + private WikiEngine m_engine; + private String m_template = "default"; + + private HashMap m_variableMap = new HashMap(); + + /** + * Stores the HttpServletRequest. May be null, if the request did not + * come from a servlet. + */ + protected HttpServletRequest m_request = null; + + private WikiSession m_session = null; /** User is administering JSPWiki (Install, SecurityConfig). */ public static final String INSTALL = HandlerInfo.getHandlerInfo( InstallActionBean.class, "install" ).getRequestContext(); @@ -456,6 +468,36 @@ } /** + * Creates a deep clone of the WikiContext. This is useful when you want + * to be sure that you don't accidentally mess with page attributes, etc. + * + * @since 2.8.0 + * @return A deep clone of the WikiContext. + */ + public WikiContext deepClone() + { + try + { + // super.clone() must always be called to make sure that inherited objects + // get the right type + WikiContext copy = (WikiContext)super.clone(); + + // No need to deep clone these + copy.m_engine = m_engine; + copy.m_template = m_template; + copy.m_variableMap = (HashMap)m_variableMap.clone(); + copy.m_request = m_request; + copy.m_session = m_session; + copy.m_page = (WikiPage)m_page.clone(); + copy.m_realPage = (WikiPage)m_realPage.clone(); + return copy; + } + catch( CloneNotSupportedException e ){} // Never happens + + return null; + } + + /** * Returns the WikiSession associated with the context. * This method is guaranteed to always return a valid WikiSession. * If this context was constructed without an associated