jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajaqu...@apache.org
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 GMT
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<String,Object> m_variableMap = new HashMap<String,Object>();
+
+    /**
+     *  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<String,Object>)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



Mime
View raw message