You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Nicole Natho <na...@math.TU-Berlin.DE> on 2002/07/12 17:20:53 UTC

work-directory

Hello!

We try to unterstand the init()-methode of CocoonServlet. There we found
the following snippet:


// first init the work-directory for the logger.
// this is required if we are running inside a war file!
final String workDirParam = conf.getInitParameter("work-directory");
        if ((workDirParam != null) && (!workDirParam.trim().equals(""))) {
            if (this.servletContextPath == null) {
                this.workDir = new File(workDirParam);
            } else {
                this.workDir = IOUtils.createFile( new
File(servletContextPath) , workDirParam);
            }
            this.workDir.mkdirs();
        } else {
            this.workDir = (File)
this.servletContext.getAttribute("javax.servlet.context.tempdir");
            this.workDir = new File(workDir, "cocoon-files");
            this.workDir.mkdirs();
        }

But after execution, we don't find the /WEB-INF/work directory. We don't
find the entry in the web.xml (<init-param> <param-name> work-directory
... /WEB-INF/work ...), too.
We thought this snippet create some file anyway, because of the
mkdirs()-methode in the else-clause.  Or did we misunderstand something?

greetings
nicole & lars




---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: work-directory

Posted by Bernhard Huber <be...@a1.net>.
Nicole Natho wrote:

>Hello!
>
>We try to unterstand the init()-methode of CocoonServlet. There we found
>the following snippet:
>
>
>// first init the work-directory for the logger.
>// this is required if we are running inside a war file!
>final String workDirParam = conf.getInitParameter("work-directory");
>        if ((workDirParam != null) && (!workDirParam.trim().equals(""))) {
>            if (this.servletContextPath == null) {
>                this.workDir = new File(workDirParam);
>            } else {
>                this.workDir = IOUtils.createFile( new
>File(servletContextPath) , workDirParam);
>            }
>            this.workDir.mkdirs();
>        } else {
>            this.workDir = (File)
>this.servletContext.getAttribute("javax.servlet.context.tempdir");
>            this.workDir = new File(workDir, "cocoon-files");
>            this.workDir.mkdirs();
>        }
>
>But after execution, we don't find the /WEB-INF/work directory. We don't
>find the entry in the web.xml (<init-param> <param-name> work-directory
>... /WEB-INF/work ...), too.
>We thought this snippet create some file anyway, because of the
>mkdirs()-methode in the else-clause.  Or did we misunderstand something?
>  
>
<faq>
  <question>Where do I find Cocoon's work directory</question>
  <answer>
    <p>
      Cocoon needs a working directory for storing internal caching
      files, storing uploaded files, etc.
    </p>
    <p>
      You may specify the working explicitly by setting the
      servlet deployment init parameter <code>work-directory</code>.
      Setting this option you hava full control over the location
      of the working directory.
    </p>
    <p>
      If you don't set the deployment init paramter 
<code>work-directory</code>,
      Cocoon tries to find a suitable working directory.
      The exact location of the working directory depends on the
      deployment mode used by the servlet container.
    </p>
    <p>
      In case of deploying Cocoon in a "exploded directory" mode,
      the working directory is put relative to the servlet context path.
    </p>
    <p>
      In case of deploying Cocoon in a war mode, and the servlet container
      does not unpack the war file into a directory, Cocoon uses the
      servlet attribute <code>javax.servlet.context.tempdir</code> as
      the root directory for its <code>cocoon-files</code> directory.
      The working files and directories are located relative to the
      <code>cocoon-file</code> directory.
    </p>
    <p>
      As defined in the servlet specification each web application
      has its own temporary directory for writing tempory files.
      The servlet attribute <code>javax.servlet.context.tempdir</code>
      defines the location of the servlet application temporary directory.
      Thus Cocoon uses this directory for defining a directory
      <code>cocoon-files</code>. The directory <cocoon-files> is
      used for storing Cocoon working directories, and working files.
    </p>
  </answer>
</faq>

In case of tomcat check tomcat's work directory...

bye bernhard





---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org