cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dani...@apache.org
Subject svn commit: r368177 - in /cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks: ./ util/
Date Thu, 12 Jan 2006 00:11:19 GMT
Author: danielf
Date: Wed Jan 11 16:11:05 2006
New Revision: 368177

URL: http://svn.apache.org/viewcvs?rev=368177&view=rev
Log:
Whitespace formating.

Modified:
    cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/BlockCallStack.java
    cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/BlockManager.java
    cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/BlocksContext.java
    cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/CoreUtil.java
    cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/LoggerUtil.java
    cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/ServletConfigurationWrapper.java
    cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/ServletContextWrapper.java

Modified: cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/BlockCallStack.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/BlockCallStack.java?rev=368177&r1=368176&r2=368177&view=diff
==============================================================================
--- cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/BlockCallStack.java (original)
+++ cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/BlockCallStack.java Wed Jan 11 16:11:05 2006
@@ -67,7 +67,7 @@
     public static Servlet getCurrentBlock() {
         final Stack stack = (Stack)blockStack.get();
         if ( stack != null && !stack.isEmpty()) {
-        	return (Servlet)stack.peek();
+                return (Servlet)stack.peek();
         }
         return null;
     }

Modified: cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/BlockManager.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/BlockManager.java?rev=368177&r1=368176&r2=368177&view=diff
==============================================================================
--- cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/BlockManager.java (original)
+++ cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/BlockManager.java Wed Jan 11 16:11:05 2006
@@ -199,7 +199,7 @@
     // a little bit clumsy. Question is what components, if any, the
     // blocks should have in common.
     public void setBlocks(Blocks blocks) {
-    	this.blocks = blocks;
+        this.blocks = blocks;
     }
 
     /**
@@ -225,12 +225,12 @@
     
     // Servlet methods
 
-	public void init(ServletConfig servletConfig) throws ServletException {
-	    super.init(servletConfig);
+        public void init(ServletConfig servletConfig) throws ServletException {
+            super.init(servletConfig);
     }
 
-	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-	    // Request to the own block
+        protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+            // Request to the own block
         try {
             // It is important to set the current block servlet each time
             // a new block is entered, this is used for the block
@@ -240,14 +240,14 @@
         } finally {
             BlockCallStack.leaveBlock();
         }
-	}
+        }
 
-	public String getServletInfo() {
-		return "BlockManager";
-	}
+        public String getServletInfo() {
+                return "BlockManager";
+        }
 
-	public void destroy() {
-	    super.destroy();
+        public void destroy() {
+            super.destroy();
     }
     
     public Servlet getBlockServlet() {

Modified: cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/BlocksContext.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/BlocksContext.java?rev=368177&r1=368176&r2=368177&view=diff
==============================================================================
--- cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/BlocksContext.java (original)
+++ cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/BlocksContext.java Wed Jan 11 16:11:05 2006
@@ -30,40 +30,49 @@
  */
 public class BlocksContext extends ServletContextWrapper {
 
-	Blocks blocks;
-	/**
-	 * @param servletContext
-	 */
-	public BlocksContext(ServletContext servletContext, Blocks blocks) {
-		super(servletContext);
-		this.blocks = blocks;
-	}
-	/* (non-Javadoc)
-	 * @see org.apache.cocoon.blocks.ServletContextWrapper#getNamedDispatcher(java.lang.String)
-	 */
-	public RequestDispatcher getNamedDispatcher(String name) {
-		// TODO Auto-generated method stub
-		return super.getNamedDispatcher(name);
-	}
-	/* (non-Javadoc)
-	 * @see org.apache.cocoon.blocks.ServletContextWrapper#getRequestDispatcher(java.lang.String)
-	 */
-	public RequestDispatcher getRequestDispatcher(String path) {
-		// TODO Auto-generated method stub
-		return super.getRequestDispatcher(path);
-	}
-	
-	private class NamedDispatcher implements RequestDispatcher {
-
-		public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException {
-			// TODO Auto-generated method stub
-			
-		}
-
-		public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException {
-			// TODO Auto-generated method stub
-			
-		}
-		
-	}
+    Blocks blocks;
+
+    /**
+     * @param servletContext
+     */
+    public BlocksContext(ServletContext servletContext, Blocks blocks) {
+        super(servletContext);
+        this.blocks = blocks;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.cocoon.blocks.ServletContextWrapper#getNamedDispatcher(java.lang.String)
+     */
+    public RequestDispatcher getNamedDispatcher(String name) {
+        // TODO Auto-generated method stub
+        return super.getNamedDispatcher(name);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.cocoon.blocks.ServletContextWrapper#getRequestDispatcher(java.lang.String)
+     */
+    public RequestDispatcher getRequestDispatcher(String path) {
+        // TODO Auto-generated method stub
+        return super.getRequestDispatcher(path);
+    }
+
+    private class NamedDispatcher implements RequestDispatcher {
+
+        public void forward(ServletRequest request, ServletResponse response)
+                throws ServletException, IOException {
+            // TODO Auto-generated method stub
+
+        }
+
+        public void include(ServletRequest request, ServletResponse response)
+                throws ServletException, IOException {
+            // TODO Auto-generated method stub
+
+        }
+
+    }
 }

Modified: cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/CoreUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/CoreUtil.java?rev=368177&r1=368176&r2=368177&view=diff
==============================================================================
--- cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/CoreUtil.java (original)
+++ cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/CoreUtil.java Wed Jan 11 16:11:05 2006
@@ -61,27 +61,30 @@
  * This is an utility class to create a new Cocoon instance.
  * 
  * TODO - Remove dependencies to LogKit and Log4J
- *
+ * 
  * @version $Id$
  * @since 2.2
  */
 public class CoreUtil {
 
     /** Parameter map for the context protocol */
-    private static final Map CONTEXT_PARAMETERS = Collections.singletonMap("force-traversable", Boolean.TRUE);
+    private static final Map CONTEXT_PARAMETERS = Collections.singletonMap(
+            "force-traversable", Boolean.TRUE);
 
     /**
      * Application <code>Context</code> Key for the servlet configuration
+     * 
      * @since 2.1.3
      */
     public static final String CONTEXT_SERVLET_CONFIG = "servlet-config";
 
     private ServletConfig config;
-	private ServletContext servletContext;
+
+    private ServletContext servletContext;
 
     /** "legacy" support: create an avalon context. */
     private final DefaultContext appContext = new ComponentContext();
-    
+
     private Context environmentContext;
 
     /** The settings. */
@@ -95,91 +98,101 @@
 
     private ClassLoader classloader;
 
-	private File contextForWriting = null;
-	private String contextURL;
-	
-	public CoreUtil(ServletConfig config) throws ServletException {
-		this(config, "WEB-INF/web.xml");
-	}
-	
-	/**
+    private File contextForWriting = null;
+
+    private String contextURL;
+
+    public CoreUtil(ServletConfig config) throws ServletException {
+        this(config, "WEB-INF/web.xml");
+    }
+
+    /**
      * Setup a new instance.
+     * 
      * @param config
-	 * @param knownFile path to a file that is supposed to be present in the servlet context
-	 * and that is used for calculating the context URI
+     * @param knownFile
+     *            path to a file that is supposed to be present in the servlet
+     *            context and that is used for calculating the context URI
      * @throws ServletException
      */
-    public CoreUtil(ServletConfig config, String knownFile) throws ServletException {
-		this.config = config;
-		this.servletContext = this.config.getServletContext();
-		this.servletContext.log("Initializing Apache Cocoon " + Constants.VERSION);
-		
-		this.contextURL = CoreUtil.getContextURL(this.servletContext, knownFile);
-		String writeableContextPath = CoreUtil.getWritableContextPath(this.servletContext);
-		if (writeableContextPath != null) {
-			this.contextForWriting = new File(writeableContextPath);
-		}
-    	this.environmentContext = new HttpContext(config.getServletContext());
-    	this.init();
+    public CoreUtil(ServletConfig config, String knownFile)
+            throws ServletException {
+        this.config = config;
+        this.servletContext = this.config.getServletContext();
+        this.servletContext.log("Initializing Apache Cocoon "
+                + Constants.VERSION);
+
+        this.contextURL = CoreUtil
+                .getContextURL(this.servletContext, knownFile);
+        String writeableContextPath = CoreUtil
+                .getWritableContextPath(this.servletContext);
+        if (writeableContextPath != null) {
+            this.contextForWriting = new File(writeableContextPath);
+        }
+        this.environmentContext = new HttpContext(config.getServletContext());
+        this.init();
     }
-    
+
     public static String getWritableContextPath(ServletContext servletContext) {
-    	return servletContext.getRealPath("/");
+        return servletContext.getRealPath("/");
+    }
+
+    /**
+     * @param servletContext
+     * @throws ServletException
+     */
+    public static String getContextURL(ServletContext servletContext,
+            String knownFile) throws ServletException {
+        String path = CoreUtil.getWritableContextPath(servletContext);
+        String contextURL;
+        if (path == null) {
+            // Try to figure out the path of the root from that of a known file
+            servletContext.log("Figuring out root from " + knownFile);
+            try {
+                path = servletContext.getResource("/" + knownFile).toString();
+                servletContext.log("Got " + path);
+            } catch (MalformedURLException me) {
+                throw new ServletException("Unable to get resource '"
+                        + knownFile + "'.", me);
+            }
+            path = path.substring(0, path.length() - knownFile.length());
+            servletContext.log("And servlet root " + path);
+        }
+        try {
+            if (path.indexOf(':') > 1) {
+                contextURL = path;
+            } else {
+                contextURL = new File(path).toURL().toExternalForm();
+            }
+        } catch (MalformedURLException me) {
+            // VG: Novell has absolute file names starting with the
+            // volume name which is easily more then one letter.
+            // Examples: sys:/apache/cocoon or sys:\apache\cocoon
+            try {
+                contextURL = new File(path).toURL().toExternalForm();
+            } catch (MalformedURLException ignored) {
+                throw new ServletException(
+                        "Unable to determine servlet context URL.", me);
+            }
+        }
+        return contextURL;
     }
-    
-	/**
-	 * @param servletContext
-	 * @throws ServletException
-	 */
-	public static String getContextURL(ServletContext servletContext, String knownFile) throws ServletException {
-		String path = CoreUtil.getWritableContextPath(servletContext);
-		String contextURL;
-		if (path == null) {
-		    // Try to figure out the path of the root from that of a known file
-			servletContext.log("Figuring out root from " + knownFile);
-		    try {
-		        path = servletContext.getResource("/" + knownFile).toString();
-				servletContext.log("Got " + path);
-		    } catch (MalformedURLException me) {
-		        throw new ServletException("Unable to get resource '" + knownFile + "'.", me);
-		    }
-		    path = path.substring(0, path.length() - knownFile.length());
-			servletContext.log("And servlet root " + path);
-		}
-		try {
-		    if (path.indexOf(':') > 1) {
-		        contextURL = path;
-		    } else {
-		        contextURL = new File(path).toURL().toExternalForm();
-		    }
-		} catch (MalformedURLException me) {
-		    // VG: Novell has absolute file names starting with the
-		    // volume name which is easily more then one letter.
-		    // Examples: sys:/apache/cocoon or sys:\apache\cocoon
-		    try {
-		        contextURL = new File(path).toURL().toExternalForm();
-		    } catch (MalformedURLException ignored) {
-		        throw new ServletException("Unable to determine servlet context URL.", me);
-		    }
-		}
-		return contextURL;
-	}
-    
+
     private void init() throws ServletException {
         // first let's set up the appContext with some values to make
         // the simple source resolver work
 
         // add root url
         try {
-            appContext.put(ContextHelper.CONTEXT_ROOT_URL,
-                           new URL(this.contextURL));
+            appContext.put(ContextHelper.CONTEXT_ROOT_URL, new URL(
+                    this.contextURL));
         } catch (MalformedURLException ignore) {
             // we simply ignore this
         }
 
         // add environment context
         this.appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT,
-                            this.environmentContext);
+                this.environmentContext);
 
         // now add environment specific information
         this.appContext.put(CONTEXT_SERVLET_CONFIG, this.config);
@@ -217,9 +230,9 @@
         this.servletContext.log("Context URL: " + this.contextURL);
         this.servletContext.log("Writeable Context: " + this.contextForWriting);
         if (workDirParam != null) {
-        	this.servletContext.log("Using work-directory " + workDir);
+            this.servletContext.log("Using work-directory " + workDir);
         } else {
-        	this.servletContext.log("Using default work-directory " + workDir);
+            this.servletContext.log("Using default work-directory " + workDir);
         }
 
         final String uploadDirParam = this.settings.getUploadDirectory();
@@ -241,7 +254,8 @@
             this.servletContext.log("Using upload-directory " + uploadDir);
         } else {
             uploadDir = new File(workDir, "upload-dir" + File.separator);
-            this.servletContext.log("Using default upload-directory " + uploadDir);
+            this.servletContext.log("Using default upload-directory "
+                    + uploadDir);
         }
         uploadDir.mkdirs();
         appContext.put(Constants.CONTEXT_UPLOAD_DIR, uploadDir);
@@ -270,55 +284,62 @@
             if (parent != null) {
                 parent.mkdirs();
             }
-            this.servletContext.log("cache-directory was not set - defaulting to " + cacheDir);
+            this.servletContext
+                    .log("cache-directory was not set - defaulting to "
+                            + cacheDir);
         }
         cacheDir.mkdirs();
         appContext.put(Constants.CONTEXT_CACHE_DIR, cacheDir);
         this.settings.setCacheDirectory(cacheDir.getAbsolutePath());
-		String configFileName = this.settings.getConfiguration();
-		final String usedFileName;
-		
-		if (configFileName == null) {
-			this.servletContext.log("Servlet initialization argument 'configurations' not specified, attempting to use '/WEB-INF/cocoon.xconf'");
-			usedFileName = "/WEB-INF/cocoon.xconf";
-		} else {
-			usedFileName = configFileName;
-		}
-		
-		this.servletContext.log("Using configuration file: " + usedFileName);
-		
-		URL result;
-		try {
-			// test if this is a qualified url
-			if (usedFileName.indexOf(':') == -1) {
-				result = this.config.getServletContext().getResource(usedFileName);
-			} else {
-				result = new URL(usedFileName);
-			}
-		} catch (Exception mue) {
-			String msg = "Init parameter 'configurations' is invalid : " + usedFileName;
-			this.servletContext.log(msg, mue);
-			throw new ServletException(msg, mue);
-		}
-		
-		if (result == null) {
-			File resultFile = new File(usedFileName);
-			if (resultFile.isFile()) {
-				try {
-					result = resultFile.getCanonicalFile().toURL();
-				} catch (Exception e) {
-					String msg = "Init parameter 'configurations' is invalid : " + usedFileName;
-					this.servletContext.log(msg, e);
-					throw new ServletException(msg, e);
-				}
-			}
-		}
-		
-		if (result == null) {
-			String msg = "Init parameter 'configurations' doesn't name an existing resource : " + usedFileName;
-			this.servletContext.log(msg);
-			throw new ServletException(msg);
-		}
+        String configFileName = this.settings.getConfiguration();
+        final String usedFileName;
+
+        if (configFileName == null) {
+            this.servletContext
+                    .log("Servlet initialization argument 'configurations' not specified, attempting to use '/WEB-INF/cocoon.xconf'");
+            usedFileName = "/WEB-INF/cocoon.xconf";
+        } else {
+            usedFileName = configFileName;
+        }
+
+        this.servletContext.log("Using configuration file: " + usedFileName);
+
+        URL result;
+        try {
+            // test if this is a qualified url
+            if (usedFileName.indexOf(':') == -1) {
+                result = this.config.getServletContext().getResource(
+                        usedFileName);
+            } else {
+                result = new URL(usedFileName);
+            }
+        } catch (Exception mue) {
+            String msg = "Init parameter 'configurations' is invalid : "
+                    + usedFileName;
+            this.servletContext.log(msg, mue);
+            throw new ServletException(msg, mue);
+        }
+
+        if (result == null) {
+            File resultFile = new File(usedFileName);
+            if (resultFile.isFile()) {
+                try {
+                    result = resultFile.getCanonicalFile().toURL();
+                } catch (Exception e) {
+                    String msg = "Init parameter 'configurations' is invalid : "
+                            + usedFileName;
+                    this.servletContext.log(msg, e);
+                    throw new ServletException(msg, e);
+                }
+            }
+        }
+
+        if (result == null) {
+            String msg = "Init parameter 'configurations' doesn't name an existing resource : "
+                    + usedFileName;
+            this.servletContext.log(msg);
+            throw new ServletException(msg);
+        }
 
         // update configuration
         final URL u = result;
@@ -326,7 +347,8 @@
         this.appContext.put(Constants.CONTEXT_CONFIG_URL, u);
 
         // set encoding
-        this.appContext.put(Constants.CONTEXT_DEFAULT_ENCODING, settings.getFormEncoding());
+        this.appContext.put(Constants.CONTEXT_DEFAULT_ENCODING, settings
+                .getFormEncoding());
 
         // set class loader
         this.appContext.put(Constants.CONTEXT_CLASS_LOADER, this.classloader);
@@ -344,23 +366,26 @@
         // The Cocoon container fetches the Core object using the context.
         this.appContext.put(Core.ROLE, core);
 
-        // FIXME - for now we just set an empty string as this information is looked up
-        //         by other components
+        // FIXME - for now we just set an empty string as this information is
+        // looked up
+        // by other components
         this.appContext.put(Constants.CONTEXT_CLASSPATH, "");
     }
 
     public Core getCore() {
         try {
-            return (Core)this.parentManager.lookup(Core.ROLE);
+            return (Core) this.parentManager.lookup(Core.ROLE);
         } catch (ServiceException neverIgnore) {
             // this should never happen!
-            throw new CoreFatalException("Fatal exception: no Cocoon core available.", neverIgnore);
+            throw new CoreFatalException(
+                    "Fatal exception: no Cocoon core available.", neverIgnore);
         }
     }
 
     /**
-     * Create a new core instance.
-     * This method can be overwritten in sub classes.
+     * Create a new core instance. This method can be overwritten in sub
+     * classes.
+     * 
      * @return A new core object.
      */
     private Core createCore() {
@@ -376,25 +401,28 @@
     }
 
     public ServiceManager getServiceManager() {
-    	return this.parentManager;
+        return this.parentManager;
     }
-    
+
     /**
      * Instatiates the parent service manager, as specified in the
      * parent-service-manager init parameter.
-     *
+     * 
      * If none is specified, the method returns <code>null</code>.
-     *
+     * 
      * @return the parent service manager, or <code>null</code>.
      */
     private ServiceManager getParentServiceManager(Core core) {
-        String parentServiceManagerClass = this.settings.getParentServiceManagerClassName();
+        String parentServiceManagerClass = this.settings
+                .getParentServiceManagerClassName();
         String parentServiceManagerInitParam = null;
         if (parentServiceManagerClass != null) {
             int dividerPos = parentServiceManagerClass.indexOf('/');
             if (dividerPos != -1) {
-                parentServiceManagerInitParam = parentServiceManagerInitParam.substring(dividerPos + 1);
-                parentServiceManagerClass = parentServiceManagerClass.substring(0, dividerPos);
+                parentServiceManagerInitParam = parentServiceManagerInitParam
+                        .substring(dividerPos + 1);
+                parentServiceManagerClass = parentServiceManagerClass
+                        .substring(0, dividerPos);
             }
         }
 
@@ -402,99 +430,124 @@
         if (parentServiceManagerClass != null) {
             try {
                 Class pcm = ClassUtils.loadClass(parentServiceManagerClass);
-                Constructor pcmc = pcm.getConstructor(new Class[]{String.class});
-                parentServiceManager = (ServiceManager) pcmc.newInstance(new Object[]{parentServiceManagerInitParam});
+                Constructor pcmc = pcm
+                        .getConstructor(new Class[] { String.class });
+                parentServiceManager = (ServiceManager) pcmc
+                        .newInstance(new Object[] { parentServiceManagerInitParam });
 
                 ContainerUtil.enableLogging(parentServiceManager, this.log);
-                ContainerUtil.contextualize(parentServiceManager, this.appContext);
+                ContainerUtil.contextualize(parentServiceManager,
+                        this.appContext);
                 ContainerUtil.initialize(parentServiceManager);
             } catch (Exception e) {
                 if (this.log.isErrorEnabled()) {
-                    this.log.error("Could not initialize parent component manager.", e);
+                    this.log
+                            .error(
+                                    "Could not initialize parent component manager.",
+                                    e);
                 }
             }
         }
-        return new SingleComponentServiceManager(parentServiceManager, core, Core.ROLE);
+        return new SingleComponentServiceManager(parentServiceManager, core,
+                Core.ROLE);
     }
 
     /**
-     * Get the settings for Cocoon.
-     * This method reads several property files and merges the result. If there
-     * is more than one definition for a property, the last one wins.
-     * The property files are read in the following order:
-     * 1) context://WEB-INF/properties/*.properties
-     *    Default values for the core and each block - the order in which the files are read is not guaranteed.
-     * 2) context://WEB-INF/properties/[RUNNING_MODE]/*.properties
-     *    Default values for the running mode - the order in which the files are read is not guaranteed.
-     * 3) Property providers (ToBeDocumented)
-     * 4) The environment (CLI, Servlet etc.) adds own properties (e.g. from web.xml)
-     * 5) Additional property file specified by the "org.apache.cocoon.settings" system property or
-     *    if the property is not found, the file ".cocoon/settings.properties" is tried to be read from
-     *    the user directory.
-     * 6) System properties
-     *
+     * Get the settings for Cocoon. This method reads several property files and
+     * merges the result. If there is more than one definition for a property,
+     * the last one wins. The property files are read in the following order: 1)
+     * context://WEB-INF/properties/*.properties Default values for the core and
+     * each block - the order in which the files are read is not guaranteed. 2)
+     * context://WEB-INF/properties/[RUNNING_MODE]/*.properties Default values
+     * for the running mode - the order in which the files are read is not
+     * guaranteed. 3) Property providers (ToBeDocumented) 4) The environment
+     * (CLI, Servlet etc.) adds own properties (e.g. from web.xml) 5) Additional
+     * property file specified by the "org.apache.cocoon.settings" system
+     * property or if the property is not found, the file
+     * ".cocoon/settings.properties" is tried to be read from the user
+     * directory. 6) System properties
+     * 
      * @return A new Settings object
      */
     private MutableSettings createSettings() {
         // get the running mode
-        final String mode = System.getProperty(Settings.PROPERTY_RUNNING_MODE, Settings.DEFAULT_RUNNING_MODE);
+        final String mode = System.getProperty(Settings.PROPERTY_RUNNING_MODE,
+                Settings.DEFAULT_RUNNING_MODE);
         this.config.getServletContext().log("Running in mode: " + mode);
 
         // create an empty settings objects
         final MutableSettings s = new MutableSettings();
 
         // we need our own resolver
-        final SourceResolver resolver = this.createSourceResolver(new LoggerWrapper(this.config.getServletContext()));
+        final SourceResolver resolver = this
+                .createSourceResolver(new LoggerWrapper(this.config
+                        .getServletContext()));
 
         // now read all properties from the properties directory
         this.readProperties("context://WEB-INF/properties", s, resolver);
         // read all properties from the mode dependent directory
-        this.readProperties("context://WEB-INF/properties/" + mode, s, resolver);
+        this
+                .readProperties("context://WEB-INF/properties/" + mode, s,
+                        resolver);
 
         // Next look for custom property providers
         Iterator i = s.getPropertyProviders().iterator();
-        while ( i.hasNext() ) {
-            final String className = (String)i.next();
+        while (i.hasNext()) {
+            final String className = (String) i.next();
             try {
-                PropertyProvider provider = (PropertyProvider)ClassUtils.newInstance(className);
+                PropertyProvider provider = (PropertyProvider) ClassUtils
+                        .newInstance(className);
                 s.fill(provider.getProperties());
             } catch (Exception ignore) {
-                this.config.getServletContext().log("Unable to get property provider for class " + className, ignore);
-                this.config.getServletContext().log("Continuing initialization.");            
+                this.config.getServletContext().log(
+                        "Unable to get property provider for class "
+                                + className, ignore);
+                this.config.getServletContext().log(
+                        "Continuing initialization.");
             }
         }
         // fill from the environment configuration, like web.xml etc.
         // fill from the servlet parameters
-		SettingsHelper.fill(s, this.config);
-		if ( s.getWorkDirectory() == null ) {
-			final File workDir = (File)this.config.getServletContext().getAttribute("javax.servlet.context.tempdir");
-			s.setWorkDirectory(workDir.getAbsolutePath());
-		}
-		if ( s.getLoggingConfiguration() == null ) {
-			s.setLoggingConfiguration("/WEB-INF/logkit.xconf");
-		}
+        SettingsHelper.fill(s, this.config);
+        if (s.getWorkDirectory() == null) {
+            final File workDir = (File) this.config.getServletContext()
+                    .getAttribute("javax.servlet.context.tempdir");
+            s.setWorkDirectory(workDir.getAbsolutePath());
+        }
+        if (s.getLoggingConfiguration() == null) {
+            s.setLoggingConfiguration("/WEB-INF/logkit.xconf");
+        }
 
         // read additional properties file
-        String additionalPropertyFile = s.getProperty(Settings.PROPERTY_USER_SETTINGS, 
-                                                      System.getProperty(Settings.PROPERTY_USER_SETTINGS));
-        // if there is no property defining the addition file, we try it in the home directory
-        if ( additionalPropertyFile == null ) {
-            additionalPropertyFile = System.getProperty("user.home") + File.separator + ".cocoon/settings.properties";
+        String additionalPropertyFile = s.getProperty(
+                Settings.PROPERTY_USER_SETTINGS, System
+                        .getProperty(Settings.PROPERTY_USER_SETTINGS));
+        // if there is no property defining the addition file, we try it in the
+        // home directory
+        if (additionalPropertyFile == null) {
+            additionalPropertyFile = System.getProperty("user.home")
+                    + File.separator + ".cocoon/settings.properties";
             final File testFile = new File(additionalPropertyFile);
-            if ( !testFile.exists() ) {
+            if (!testFile.exists()) {
                 additionalPropertyFile = null;
             }
         }
-        if ( additionalPropertyFile != null ) {
-            this.config.getServletContext().log("Reading user settings from '" + additionalPropertyFile + "'");
+        if (additionalPropertyFile != null) {
+            this.config.getServletContext().log(
+                    "Reading user settings from '" + additionalPropertyFile
+                            + "'");
             final Properties p = new Properties();
             try {
-                FileInputStream fis = new FileInputStream(additionalPropertyFile);
+                FileInputStream fis = new FileInputStream(
+                        additionalPropertyFile);
                 p.load(fis);
                 fis.close();
             } catch (IOException ignore) {
-                this.config.getServletContext().log("Unable to read '" + additionalPropertyFile + "'.", ignore);
-                this.config.getServletContext().log("Continuing initialization.");
+                this.config.getServletContext().log(
+                        "Unable to read '" + additionalPropertyFile + "'.",
+                        ignore);
+                this.config.getServletContext().log(
+                        "Continuing initialization.");
             }
         }
         // now overwrite with system properties
@@ -504,21 +557,26 @@
     }
 
     /**
-     * Read all property files from the given directory and apply them to the settings.
+     * Read all property files from the given directory and apply them to the
+     * settings.
      */
-    private void readProperties(String directoryName,
-                                  MutableSettings s,
-                                  SourceResolver resolver) {
+    private void readProperties(String directoryName, MutableSettings s,
+            SourceResolver resolver) {
         Source directory = null;
         try {
-            directory = resolver.resolveURI(directoryName, null, CONTEXT_PARAMETERS);
+            directory = resolver.resolveURI(directoryName, null,
+                    CONTEXT_PARAMETERS);
             if (directory.exists() && directory instanceof TraversableSource) {
-                final Iterator c = ((TraversableSource) directory).getChildren().iterator();
+                final Iterator c = ((TraversableSource) directory)
+                        .getChildren().iterator();
                 while (c.hasNext()) {
                     final Source src = (Source) c.next();
-                    if ( src.getURI().endsWith(".properties") ) {
+                    if (src.getURI().endsWith(".properties")) {
                         final InputStream propsIS = src.getInputStream();
-                        this.config.getServletContext().log("Reading settings from '" + src.getURI() + "'.");
+                        this.config.getServletContext()
+                                .log(
+                                        "Reading settings from '"
+                                                + src.getURI() + "'.");
                         final Properties p = new Properties();
                         p.load(propsIS);
                         propsIS.close();
@@ -527,8 +585,10 @@
                 }
             }
         } catch (IOException ignore) {
-            this.config.getServletContext().log("Unable to read from directory 'WEB-INF/properties'.", ignore);
-            this.config.getServletContext().log("Continuing initialization.");            
+            this.config.getServletContext().log(
+                    "Unable to read from directory 'WEB-INF/properties'.",
+                    ignore);
+            this.config.getServletContext().log("Continuing initialization.");
         } finally {
             resolver.release(directory);
         }
@@ -547,7 +607,7 @@
             throw new CoreInitializationException(
                     "Cannot setup source resolver.", ce);
         }
-        return resolver;        
+        return resolver;
     }
 
     private static final class LoggerWrapper implements Logger {
@@ -558,7 +618,7 @@
         }
 
         private void text(String arg0, Throwable arg1) {
-            if ( arg1 != null ) {
+            if (arg1 != null) {
                 this.context.log(arg0, arg1);
             } else {
                 this.context.log(arg0);

Modified: cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/LoggerUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/LoggerUtil.java?rev=368177&r1=368176&r2=368177&view=diff
==============================================================================
--- cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/LoggerUtil.java (original)
+++ cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/LoggerUtil.java Wed Jan 11 16:11:05 2006
@@ -53,19 +53,21 @@
  * This is an utility class to create a new Cocoon instance.
  * 
  * TODO - Remove dependencies to LogKit and Log4J
- *
+ * 
  * @version $Id$
  * @since 2.2
  */
 public class LoggerUtil {
 
     /** Parameter map for the context protocol */
-    private static final Map CONTEXT_PARAMETERS = Collections.singletonMap("force-traversable", Boolean.TRUE);
+    private static final Map CONTEXT_PARAMETERS = Collections.singletonMap(
+            "force-traversable", Boolean.TRUE);
 
     private ServletConfig config;
-	/** "legacy" support: create an avalon context. */
+
+    /** "legacy" support: create an avalon context. */
     private Context appContext;
-    
+
     /** The settings. */
     private Settings settings;
 
@@ -79,16 +81,18 @@
 
     /**
      * Setup a new instance.
+     * 
      * @param config
      */
-    public LoggerUtil(ServletConfig config, Context appContext, Settings settings) {
-    	this.config = config;
-    	this.appContext = appContext;
-    	this.settings = settings;
-    	// Init logger
-		this.initLogger();
+    public LoggerUtil(ServletConfig config, Context appContext,
+            Settings settings) {
+        this.config = config;
+        this.appContext = appContext;
+        this.settings = settings;
+        // Init logger
+        this.initLogger();
     }
-    
+
     /**
      * Create a simple source resolver.
      */
@@ -102,7 +106,7 @@
             throw new CoreInitializationException(
                     "Cannot setup source resolver.", ce);
         }
-        return resolver;        
+        return resolver;
     }
 
     private void initLogger() {
@@ -117,19 +121,24 @@
         }
 
         // create bootstrap logger
-        final BootstrapEnvironment.LogLevel level = BootstrapEnvironment.LogLevel.getLogLevelForName(logLevel);
-        final Logger bootstrapLogger = new ServletLogger(this.config, level.getLevel());
+        final BootstrapEnvironment.LogLevel level = BootstrapEnvironment.LogLevel
+                .getLogLevelForName(logLevel);
+        final Logger bootstrapLogger = new ServletLogger(this.config, level
+                .getLevel());
 
         // Create our own resolver
-        final SourceResolver resolver = this.createSourceResolver(bootstrapLogger);
+        final SourceResolver resolver = this
+                .createSourceResolver(bootstrapLogger);
 
         // create an own service manager for the logger manager
         final ServiceManager loggerManagerServiceManager = new SingleComponentServiceManager(
-                 null, resolver, SourceResolver.ROLE);
+                null, resolver, SourceResolver.ROLE);
 
         // create an own context for the logger manager
-        final DefaultContext subcontext = new SettingsContext(this.appContext, this.settings);
-        subcontext.put("context-work", new File(this.settings.getWorkDirectory()));
+        final DefaultContext subcontext = new SettingsContext(this.appContext,
+                this.settings);
+        subcontext.put("context-work", new File(this.settings
+                .getWorkDirectory()));
         if (this.contextForWriting == null) {
             File logSCDir = new File(this.settings.getWorkDirectory(), "log");
             logSCDir.mkdirs();
@@ -144,7 +153,8 @@
         // the log4j support requires currently that the log4j system is already
         // configured elsewhere
 
-        final LoggerManager loggerManager = this.newLoggerManager(loggerManagerClass);
+        final LoggerManager loggerManager = this
+                .newLoggerManager(loggerManagerClass);
         ContainerUtil.enableLogging(loggerManager, bootstrapLogger);
 
         try {
@@ -154,28 +164,30 @@
             this.loggerManager = loggerManager;
 
             if (loggerManager instanceof Configurable) {
-                //Configure the logkit management
+                // Configure the logkit management
                 String logkitConfig = settings.getLoggingConfiguration();
 
-                if ( logkitConfig != null ) {
+                if (logkitConfig != null) {
                     Source source = null;
                     try {
                         source = resolver.resolveURI(logkitConfig);
                         final ConfigurationBuilder builder = new ConfigurationBuilder(
                                 settings);
-                        final Configuration conf = builder.build(source.getInputStream());
+                        final Configuration conf = builder.build(source
+                                .getInputStream());
                         final DefaultConfiguration categories = (DefaultConfiguration) conf
                                 .getChild("categories");
                         final DefaultConfiguration targets = (DefaultConfiguration) conf
                                 .getChild("targets");
                         final DefaultConfiguration factories = (DefaultConfiguration) conf
                                 .getChild("factories");
-    
+
                         // now process includes
                         final Configuration[] children = conf
                                 .getChildren("include");
                         for (int i = 0; i < children.length; i++) {
-                            String directoryURI = children[i].getAttribute("dir");
+                            String directoryURI = children[i]
+                                    .getAttribute("dir");
                             final String pattern = children[i].getAttribute(
                                     "pattern", null);
                             int[] parsedPattern = null;
@@ -198,12 +210,14 @@
                                             final Configuration includeConf = builder
                                                     .build(s.getInputStream());
                                             // add targets and categories
-                                            categories.addAllChildren(includeConf
-                                                    .getChild("categories"));
+                                            categories
+                                                    .addAllChildren(includeConf
+                                                            .getChild("categories"));
                                             targets.addAllChildren(includeConf
                                                     .getChild("targets"));
-                                            factories.addAllChildren(includeConf
-                                                    .getChild("factories"));
+                                            factories
+                                                    .addAllChildren(includeConf
+                                                            .getChild("factories"));
                                         }
                                     }
                                 } else {
@@ -219,9 +233,10 @@
                             } finally {
                                 resolver.release(directory);
                             }
-    
+
                             // finally remove include
-                            ((DefaultConfiguration) conf).removeChild(children[i]);
+                            ((DefaultConfiguration) conf)
+                                    .removeChild(children[i]);
                         }
                         // override log level?
                         if (settings.getOverrideLogLevel() != null) {
@@ -246,18 +261,21 @@
 
     /**
      * Create a new logger manager.
-     * @param loggerManagerClass The class name or one of the allowed shortcuts.
+     * 
+     * @param loggerManagerClass
+     *            The class name or one of the allowed shortcuts.
      * @return A new logger manager.
      */
     private LoggerManager newLoggerManager(String loggerManagerClass) {
-        if ("LogKit".equalsIgnoreCase(loggerManagerClass) || loggerManagerClass == null) {
+        if ("LogKit".equalsIgnoreCase(loggerManagerClass)
+                || loggerManagerClass == null) {
             loggerManagerClass = CocoonLogKitLoggerManager.class.getName();
         } else if ("LOG4J".equalsIgnoreCase(loggerManagerClass)) {
             loggerManagerClass = Log4JConfLoggerManager.class.getName();
         }
         try {
             Class clazz = Class.forName(loggerManagerClass);
-            if ( PerRequestLoggerManager.class.isAssignableFrom(clazz) ) {
+            if (PerRequestLoggerManager.class.isAssignableFrom(clazz)) {
             }
             return (LoggerManager) clazz.newInstance();
         } catch (Exception e) {
@@ -267,16 +285,16 @@
 
     public void overrideLogLevel(Configuration root, String value) {
         Configuration[] c = root.getChildren("category");
-        for(int i=0;i<c.length;i++) {
-            ((DefaultConfiguration)c[i]).setAttribute("log-level", value);
+        for (int i = 0; i < c.length; i++) {
+            ((DefaultConfiguration) c[i]).setAttribute("log-level", value);
             this.overrideLogLevel(c[i], value);
         }
     }
 
-    private boolean match(String uri, int[] parsedPattern ) {
+    private boolean match(String uri, int[] parsedPattern) {
         int pos = uri.lastIndexOf('/');
-        if ( pos != -1 ) {
-            uri = uri.substring(pos+1);
+        if (pos != -1) {
+            uri = uri.substring(pos + 1);
         }
         return WildcardHelper.match(null, uri, parsedPattern);
     }
@@ -288,8 +306,8 @@
         }
         return this.log;
     }
-    
+
     public LoggerManager getCocoonLoggerManager() {
-    	return this.loggerManager;
+        return this.loggerManager;
     }
 }

Modified: cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/ServletConfigurationWrapper.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/ServletConfigurationWrapper.java?rev=368177&r1=368176&r2=368177&view=diff
==============================================================================
--- cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/ServletConfigurationWrapper.java (original)
+++ cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/ServletConfigurationWrapper.java Wed Jan 11 16:11:05 2006
@@ -21,57 +21,68 @@
 import javax.servlet.ServletContext;
 
 /**
- * @version $Id$
- *
+ * @version $Id: ServletConfigurationWrapper.java 368000 2006-01-11 10:45:20Z
+ *          danielf $
+ * 
  */
 public class ServletConfigurationWrapper implements ServletConfig {
 
-	protected ServletConfig servletConfig;
-	protected ServletContext servletContext;
-	
-	
-	/**
-	 * @param servletConfig
-	 */
-	public ServletConfigurationWrapper(ServletConfig servletConfig) {
-		this(servletConfig, null);
-	}
-
-	/**
-	 * @param servletConfig
-	 * @param servletContext
-	 */
-	public ServletConfigurationWrapper(ServletConfig servletConfig, ServletContext servletContext) {
-		this.servletConfig = servletConfig;
-		this.servletContext = servletContext;
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletConfig#getServletName()
-	 */
-	public String getServletName() {
-		return this.servletConfig.getServletName();
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletConfig#getServletContext()
-	 */
-	public ServletContext getServletContext() {
-		return this.servletContext != null ? this.servletContext : this.servletConfig.getServletContext();
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletConfig#getInitParameter(java.lang.String)
-	 */
-	public String getInitParameter(String name) {
-		return this.servletConfig.getInitParameter(name);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletConfig#getInitParameterNames()
-	 */
-	public Enumeration getInitParameterNames() {
-		return this.servletConfig.getInitParameterNames();
-	}
+    protected ServletConfig servletConfig;
+
+    protected ServletContext servletContext;
+
+    /**
+     * @param servletConfig
+     */
+    public ServletConfigurationWrapper(ServletConfig servletConfig) {
+        this(servletConfig, null);
+    }
+
+    /**
+     * @param servletConfig
+     * @param servletContext
+     */
+    public ServletConfigurationWrapper(ServletConfig servletConfig,
+            ServletContext servletContext) {
+        this.servletConfig = servletConfig;
+        this.servletContext = servletContext;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletConfig#getServletName()
+     */
+    public String getServletName() {
+        return this.servletConfig.getServletName();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletConfig#getServletContext()
+     */
+    public ServletContext getServletContext() {
+        return this.servletContext != null ? this.servletContext
+                : this.servletConfig.getServletContext();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletConfig#getInitParameter(java.lang.String)
+     */
+    public String getInitParameter(String name) {
+        return this.servletConfig.getInitParameter(name);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletConfig#getInitParameterNames()
+     */
+    public Enumeration getInitParameterNames() {
+        return this.servletConfig.getInitParameterNames();
+    }
 
 }

Modified: cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/ServletContextWrapper.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/ServletContextWrapper.java?rev=368177&r1=368176&r2=368177&view=diff
==============================================================================
--- cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/ServletContextWrapper.java (original)
+++ cocoon/trunk/cocoon-blocks-fw/src/main/java/org/apache/cocoon/blocks/util/ServletContextWrapper.java Wed Jan 11 16:11:05 2006
@@ -28,185 +28,236 @@
 
 /**
  * @version $Id$
- *
+ * 
  */
 public class ServletContextWrapper implements ServletContext {
 
-	protected ServletContext servletContext;
-	
-	/**
-	 * @param servletContext
-	 */
-	public ServletContextWrapper(ServletContext servletContext) {
-		this.servletContext = servletContext;
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getContext(java.lang.String)
-	 */
-	public ServletContext getContext(String uripath) {
-		return this.servletContext.getContext(uripath);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getMajorVersion()
-	 */
-	public int getMajorVersion() {
-		return this.servletContext.getMajorVersion();
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getMinorVersion()
-	 */
-	public int getMinorVersion() {
-		return this.servletContext.getMinorVersion();
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getMimeType(java.lang.String)
-	 */
-	public String getMimeType(String file) {
-		return this.servletContext.getMimeType(file);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getResourcePaths(java.lang.String)
-	 */
-	public Set getResourcePaths(String paths) {
-		return this.servletContext.getResourcePaths(paths);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getResource(java.lang.String)
-	 */
-	public URL getResource(String path) throws MalformedURLException {
-		return this.servletContext.getResource(path);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getResourceAsStream(java.lang.String)
-	 */
-	public InputStream getResourceAsStream(String path) {
-		return this.servletContext.getResourceAsStream(path);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getRequestDispatcher(java.lang.String)
-	 */
-	public RequestDispatcher getRequestDispatcher(String path) {
-		return this.servletContext.getRequestDispatcher(path);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getNamedDispatcher(java.lang.String)
-	 */
-	public RequestDispatcher getNamedDispatcher(String name) {
-		return this.servletContext.getNamedDispatcher(name);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getServlet(java.lang.String)
-	 */
-	public Servlet getServlet(String name) throws ServletException {
-		return this.servletContext.getServlet(name);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getServlets()
-	 */
-	public Enumeration getServlets() {
-		return this.servletContext.getServlets();
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getServletNames()
-	 */
-	public Enumeration getServletNames() {
-		return this.servletContext.getServletNames();
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#log(java.lang.String)
-	 */
-	public void log(String msg) {
-		this.servletContext.log(msg);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#log(java.lang.Exception, java.lang.String)
-	 */
-	public void log(Exception exception, String msg) {
-		this.servletContext.log(exception, msg);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#log(java.lang.String, java.lang.Throwable)
-	 */
-	public void log(String msg, Throwable throwable) {
-		this.servletContext.log(msg, throwable);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getRealPath(java.lang.String)
-	 */
-	public String getRealPath(String path) {
-		return this.servletContext.getRealPath(path);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getServerInfo()
-	 */
-	public String getServerInfo() {
-		return this.servletContext.getServerInfo();
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getInitParameter(java.lang.String)
-	 */
-	public String getInitParameter(String path) {
-		return this.servletContext.getInitParameter(path);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getInitParameterNames()
-	 */
-	public Enumeration getInitParameterNames() {
-		return this.servletContext.getInitParameterNames();
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getAttribute(java.lang.String)
-	 */
-	public Object getAttribute(String name) {
-		return this.servletContext.getAttribute(name);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getAttributeNames()
-	 */
-	public Enumeration getAttributeNames() {
-		return this.servletContext.getAttributeNames();
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#setAttribute(java.lang.String, java.lang.Object)
-	 */
-	public void setAttribute(String name, Object value) {
-		this.servletContext.setAttribute(name, value);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#removeAttribute(java.lang.String)
-	 */
-	public void removeAttribute(String name) {
-		this.servletContext.removeAttribute(name);
-	}
-
-	/* (non-Javadoc)
-	 * @see javax.servlet.ServletContext#getServletContextName()
-	 */
-	public String getServletContextName() {
-		return this.servletContext.getServletContextName();
-	}
+    protected ServletContext servletContext;
+
+    /**
+     * @param servletContext
+     */
+    public ServletContextWrapper(ServletContext servletContext) {
+        this.servletContext = servletContext;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getContext(java.lang.String)
+     */
+    public ServletContext getContext(String uripath) {
+        return this.servletContext.getContext(uripath);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getMajorVersion()
+     */
+    public int getMajorVersion() {
+        return this.servletContext.getMajorVersion();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getMinorVersion()
+     */
+    public int getMinorVersion() {
+        return this.servletContext.getMinorVersion();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getMimeType(java.lang.String)
+     */
+    public String getMimeType(String file) {
+        return this.servletContext.getMimeType(file);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getResourcePaths(java.lang.String)
+     */
+    public Set getResourcePaths(String paths) {
+        return this.servletContext.getResourcePaths(paths);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getResource(java.lang.String)
+     */
+    public URL getResource(String path) throws MalformedURLException {
+        return this.servletContext.getResource(path);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getResourceAsStream(java.lang.String)
+     */
+    public InputStream getResourceAsStream(String path) {
+        return this.servletContext.getResourceAsStream(path);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getRequestDispatcher(java.lang.String)
+     */
+    public RequestDispatcher getRequestDispatcher(String path) {
+        return this.servletContext.getRequestDispatcher(path);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getNamedDispatcher(java.lang.String)
+     */
+    public RequestDispatcher getNamedDispatcher(String name) {
+        return this.servletContext.getNamedDispatcher(name);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getServlet(java.lang.String)
+     */
+    public Servlet getServlet(String name) throws ServletException {
+        return this.servletContext.getServlet(name);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getServlets()
+     */
+    public Enumeration getServlets() {
+        return this.servletContext.getServlets();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getServletNames()
+     */
+    public Enumeration getServletNames() {
+        return this.servletContext.getServletNames();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#log(java.lang.String)
+     */
+    public void log(String msg) {
+        this.servletContext.log(msg);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#log(java.lang.Exception,
+     *      java.lang.String)
+     */
+    public void log(Exception exception, String msg) {
+        this.servletContext.log(exception, msg);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#log(java.lang.String,
+     *      java.lang.Throwable)
+     */
+    public void log(String msg, Throwable throwable) {
+        this.servletContext.log(msg, throwable);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getRealPath(java.lang.String)
+     */
+    public String getRealPath(String path) {
+        return this.servletContext.getRealPath(path);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getServerInfo()
+     */
+    public String getServerInfo() {
+        return this.servletContext.getServerInfo();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getInitParameter(java.lang.String)
+     */
+    public String getInitParameter(String path) {
+        return this.servletContext.getInitParameter(path);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getInitParameterNames()
+     */
+    public Enumeration getInitParameterNames() {
+        return this.servletContext.getInitParameterNames();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getAttribute(java.lang.String)
+     */
+    public Object getAttribute(String name) {
+        return this.servletContext.getAttribute(name);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getAttributeNames()
+     */
+    public Enumeration getAttributeNames() {
+        return this.servletContext.getAttributeNames();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#setAttribute(java.lang.String,
+     *      java.lang.Object)
+     */
+    public void setAttribute(String name, Object value) {
+        this.servletContext.setAttribute(name, value);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#removeAttribute(java.lang.String)
+     */
+    public void removeAttribute(String name) {
+        this.servletContext.removeAttribute(name);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.servlet.ServletContext#getServletContextName()
+     */
+    public String getServletContextName() {
+        return this.servletContext.getServletContextName();
+    }
 
 }



Mime
View raw message