To: Tomcat
Sent: Sunday, June 03, 2007 10:02 PM
Subject: tomcat temp directory
Hello
How do I configure and access a temporary directory in Tomcat5x? Oddly I
am presently writing files I want to use immediately into java.io.tempdir
and it works if I access the webapp from localhost. However
To: Tomcat
Sent: Sunday, June 03, 2007 10:02 PM
Subject: tomcat temp directory
Hello
How do I configure and access a temporary directory in Tomcat5x? Oddly I
am presently writing files I want to use immediately into java.io.tempdir
and it works if I access the webapp from localhost. However
In the code below, let's just ignore the logic for the string 'tempdir'
... looks like noise to me as it isn't used in the creation of a file.
The call to create the temp file looks good and should store it in the
path specified by java.io.tmpdir. You can write out the system property
to see
Hi David
Thanks for further engaging this with me.
Yes, I am creating the file in an Action, dropping it in the tmpdir and reading
it with a jsp that calls a servlet that reads the parameters and displays.
What I find odd is everything works perfectly when executed from
localhost:8080...
);
out.close();
}
catch (IOException e) {
...
}
HTH,
Tim
-Original Message-
From: Chris Pat [mailto:[EMAIL PROTECTED]
Sent: Monday, June 04, 2007 6:38 AM
To: Tomcat Users List
Subject: Re: tomcat temp directory
Hi
Further
I see in catalina.bat where it is setup and all
From: Chris Pat [mailto:[EMAIL PROTECTED]
Subject: Re: tomcat temp directory
Or is there a better way to create a tmpdir and random file
under the webapp.
Look at section 4.7.1 of the servlet spec:
A temporary storage directory is required for each servlet context.
Servlet containers
Hi Chuck
Thanks.
But how to I get at it programatically? Is workDir an actual context param
that I can access and build a File from?
Caldarale, Charles R [EMAIL PROTECTED] wrote: From: Chris Pat
[mailto:[EMAIL PROTECTED]
Subject: Re: tomcat temp directory
Or is there a better way
From: Chris Pat [mailto:[EMAIL PROTECTED]
Subject: RE: tomcat temp directory
But how to I get at it programatically? Is workDir an actual
context param that I can access and build a File from?
It's not a param, it's an attribute - read the servlet spec and the
servlet API doc. Use
: tomcat temp directory
But how to I get at it programatically? Is workDir an actual
context param that I can access and build a File from?
It's not a param, it's an attribute - read the servlet spec and the
servlet API doc. Use the ServletContext.getAttribute() API to retrieve
the value
From: Chris Pat [mailto:[EMAIL PROTECTED]
Subject: RE: tomcat temp directory
How do I get the servletContext within a method, within an
Action.
Assuming your code is part of a servlet, use the
GenericServlet.getServletContext() method. If the servlet is hidden by
some framework, you'll
From: Chris Pat [mailto:[EMAIL PROTECTED]
Subject: RE: tomcat temp directory
Why however do I get null when I do the following?
File tempDir = (File) sc.getAttribute(workDir);
String tempDirStr = (String) sc.getAttribute(workDir);
The attribute name for the API
tempDirStr = (String) sc.getAttribute(workDir);
File tempFile = null;
Caldarale, Charles R [EMAIL PROTECTED] wrote: From: Chris Pat
[mailto:[EMAIL PROTECTED]
Subject: RE: tomcat temp directory
How do I get the servletContext within a method, within an
Action.
Assuming your code is part
Hello
How do I configure and access a temporary directory in Tomcat5x? Oddly I am
presently writing files I want to use immediately into java.io.tempdir and it
works if I access the webapp from localhost. However fails when accessed from
a domain.
Within the Action/servlet how to I
Tomcat doesn't have any config for the temp dir that I know of...it's
more of a jvm thing.
I believe Sun's jvm is supposed to delete the file when it's associated
file handle is gc'd. Can you provide your OS, jdk and a chunk of sample
code if how you are using the temp dir? Also assuming
the sender immediately by telephone or email and destroy the original
message without making a copy. Thank you.
- Original Message -
From: Chris Pat [EMAIL PROTECTED]
To: Tomcat users@tomcat.apache.org
Sent: Sunday, June 03, 2007 10:02 PM
Subject: tomcat temp directory
Hello
How do I
15 matches
Mail list logo