roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r224389 - in /incubator/roller/trunk: src/org/roller/presentation/velocity/PageServlet.java src/org/roller/presentation/velocity/PreviewResourceLoader.java web/WEB-INF/velocity.properties
Date Fri, 22 Jul 2005 19:30:03 GMT
Author: agilliland
Date: Fri Jul 22 12:29:58 2005
New Revision: 224389

URL: http://svn.apache.org/viewcvs?rev=224389&view=rev
Log:
removing old preview resource loader since we don't need it anymore.
the page servlet has also been rewritten because all of it's old logic was about dealing with
the preview resource loader.

Removed:
    incubator/roller/trunk/src/org/roller/presentation/velocity/PreviewResourceLoader.java
Modified:
    incubator/roller/trunk/src/org/roller/presentation/velocity/PageServlet.java
    incubator/roller/trunk/web/WEB-INF/velocity.properties

Modified: incubator/roller/trunk/src/org/roller/presentation/velocity/PageServlet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/velocity/PageServlet.java?rev=224389&r1=224388&r2=224389&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/velocity/PageServlet.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/velocity/PageServlet.java Fri Jul 22
12:29:58 2005
@@ -1,24 +1,12 @@
-
 package org.roller.presentation.velocity;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.velocity.Template;
-import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.context.Context;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
-
-import java.util.Properties;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
 
 /**
- * Extend RollerServlet to load proper resource loader for page execution.
+ * The PageServlet handles all requests for weblog pages at /page/*
+ *
+ * All the real work is handled by the BasePageServlet though.
+ *
+ * @see org.roller.presentation.velocity.BasePageServlet
  * 
  * @web.servlet name="PageServlet" load-on-startup="0"
  * @web.servlet-init-param name="org.apache.velocity.properties" 
@@ -26,114 +14,12 @@
  *  
  * @web.servlet-mapping url-pattern="/page/*"
  */ 
-public class PageServlet extends BasePageServlet
-{
-    static final long serialVersionUID = 5083624357559616805L;
+public class PageServlet extends BasePageServlet {
     
-    private static Log mLogger = 
-        LogFactory.getFactory().getInstance(PageServlet.class);
-
-	/** We are overriding the default Runtime Velocity
-	 * singleton to gain control over the initialization
-	 * and so that the PreviewResourceLoader is not set
-	 * for the PageServlet.
-	 */
-	transient VelocityEngine ve = null;
-	
-    public Template handleRequest( HttpServletRequest request,
-                                    HttpServletResponse response, 
-                                    Context ctx ) throws Exception
-    {
-		return super.handleRequest(request, response, ctx);
-    }
-	
-	/**
-	 * Override initVelocity() so we can man-handle the list of
-	 * resource loaders and remove "preview" if it is present.
-	 * @see org.apache.velocity.servlet.VelocityServlet#initVelocity(ServletConfig)
-	 */
-	protected void initVelocity( ServletConfig config )
-		 throws ServletException
-	{
-		try
-		{
-			/*
-			 *  call the overridable method to allow the 
-			 *  derived classes a shot at altering the configuration
-			 *  before initializing Runtime
-			 */
-			Properties props = loadConfiguration( config );
-			
-			// remove "preview," from the beginning of the 
-			// resource.loader list
-			String resourceLoaders = (String)props.get("resource.loader");
-			if (resourceLoaders != null &&
-				resourceLoaders.indexOf("preview") > -1)
-			{
-				int begin = resourceLoaders.indexOf("preview");
-				int length = "preview".length() + 1;
-				String tempStr = "";
-				if (begin > 0)
-				{
-					tempStr = resourceLoaders.substring(0,begin);
-				}
-				resourceLoaders = tempStr + resourceLoaders.substring(begin+length);
-
-				//System.out.println("PageServlet RESOURCELOADERS: " + resourceLoaders);
-				props.put("resource.loader", resourceLoaders);
-			}
-			
-			// remove all trace of the PreviewResourceLoader
-			props.remove("preview.resource.loader.public.name");
-			props.remove("preview.resource.loader.description");
-			props.remove("preview.resource.loader.class");
-			props.remove("preview.resource.loader.cache");
-			props.remove("preview.resource.loader.modificationCheckInterval");
-			
-			/** set custom logging file */
-			props.setProperty( "runtime.log", "page_servlet.log" );
-			
-			// make user WebappResourceLoader has what it needs
-			WebappResourceLoader.setServletContext( getServletContext() );
-			
-            if (mLogger.isDebugEnabled())
-            {
-                mLogger.debug("VelocityEngine props: " + props.toString());
-            }
-            
-			ve = new VelocityEngine();
-			ve.info("*******************************************");
-			ve.info("Initializing VelocityEngine for PageServlet");
-			ve.init( props );
-			ve.info("Done initializing VelocityEngine for PageServlet");
-			ve.info("************************************************");
-		}
-		catch( Exception e )
-		{
-			String msg = "Error initializing Velocity: " + e.toString();
-            mLogger.error(msg, e);
-			throw new ServletException(msg, e);
-		}   
-	}
-
-	/**
-	 * Override the parent getTemplate( String name ) method.
-	 * @see org.apache.velocity.servlet.VelocityServlet#getTemplate(String, String)
-	 */
-	public Template getTemplate( String name )
-		throws ResourceNotFoundException, ParseErrorException, Exception
-	{
-		return ve.getTemplate( name );
-	}
-
-	/**
-	 * Override the parent getTemplate(String name, String encoding) method.
-	 * @see org.apache.velocity.servlet.VelocityServlet#getTemplate(String, String)
-	 */
-	public Template getTemplate( String name, String encoding )
-		throws ResourceNotFoundException, ParseErrorException, Exception
-	{
-		return ve.getTemplate( name, encoding );
-	}
+    /**
+     * This class used to have some special velocity init code that was
+     * related to how previewing worked, but it became obsolete when we
+     * redid the theme management stuff, so now this class does nothing.
+     */
 }
 

Modified: incubator/roller/trunk/web/WEB-INF/velocity.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/web/WEB-INF/velocity.properties?rev=224389&r1=224388&r2=224389&view=diff
==============================================================================
--- incubator/roller/trunk/web/WEB-INF/velocity.properties (original)
+++ incubator/roller/trunk/web/WEB-INF/velocity.properties Fri Jul 22 12:29:58 2005
@@ -8,13 +8,6 @@
 theme.resource.loader.cache=false
 theme.resource.loader.modificationCheckInterval=2
 
-# for the loader we call 'preview', use the PreviewResourceLoader
-preview.resource.loader.public.name=preview
-preview.resource.loader.description=Roller Preview Resource Loader
-preview.resource.loader.class=org.roller.presentation.velocity.PreviewResourceLoader
-preview.resource.loader.cache=false
-preview.resource.loader.modificationCheckInterval=60
-
 # for the loader we call 'roller', use the RollerResourceLoader
 roller.resource.loader.public.name=roller
 roller.resource.loader.description=Roller Main Resource Loader



Mime
View raw message