Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 36857 invoked from network); 4 Jun 2007 13:45:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Jun 2007 13:45:42 -0000 Received: (qmail 74088 invoked by uid 500); 4 Jun 2007 13:45:33 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 73838 invoked by uid 500); 4 Jun 2007 13:45:32 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 73827 invoked by uid 99); 4 Jun 2007 13:45:32 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jun 2007 06:45:32 -0700 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: 128.253.83.142 is neither permitted nor denied by domain of dns4@cornell.edu) Received: from [128.253.83.142] (HELO authusersmtp.mail.cornell.edu) (128.253.83.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jun 2007 06:45:27 -0700 Received: from [128.253.38.244] (defiant.ento.cornell.edu [128.253.38.244]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.13.1/8.12.10) with ESMTP id l54Dj5q1002958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Mon, 4 Jun 2007 09:45:06 -0400 (EDT) Message-ID: <46641761.8080706@cornell.edu> Date: Mon, 04 Jun 2007 09:45:05 -0400 From: David Smith User-Agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tomcat Users List Subject: Re: tomcat temp directory References: <361797.86664.qm@web60122.mail.yahoo.com> In-Reply-To: <361797.86664.qm@web60122.mail.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hmmmm... I'm not sure why hitting the 8080 HTTP connector would act differently w/ respect to temp files than that 8009 AJP connector. One thought that comes to mind is to have your own internal temp directory. Since this won't be a real temp directory you will get the advantage of a folder that keeps files indefinitely (or at least long enough for the client to request them). On the down side, it's up to you to manage name conflicts and delete the files. The servlet handing out files can just delete them once they are requested. For the minor number of files that get abandon (client aborts the page load), you might want to consider the Quartz project for running a timed thread to kill all the files that are older than say 12 hours. --David Chris Pat wrote: >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... However fails when accessed from a domain setup to pass *.do, *.jsp through modjk to TC. > >I know for a fact, from the timestamp and opening the file that Action is creating the file correctly, the servlet is just not finding it...when accessed from a domain/modjk. But again it works, inscrutably, perfectly when accessed from localhost on the same server. I can even simultaneously switch between it succeeding on localhost and failing on domain multiple times with the same running instance of TC. > >Or is there a better way to create a tmpdir and random file under the webapp. I am loathe to do that as I want to keep it possible for the admin to just delete the files in the root \temp or make it a task. I dont want to get access into the webapp. > >David Smith wrote: 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 where your files are going ... by default I think it's usually >the system temp. My install of tomcat 5.5 as a service explicitly set's >it to the temp directory within the tomcat folder. You can look for it >in your .bat files by looking for -Djava.io.tmpdir= > >Could you expand on this image tag generation? Looks like you are >attempting to generate a temp image in a jsp and keep it long enough to >return it via servlet. Those are two separate requests (page and image) >and it may already be gone by the time the client requests the image >itself if that's the case. > >--David > >Chris Pat wrote: > > > >>Hi >>Further >>I see in catalina.bat where it is setup and all the defaults are unchanged. This still does not explain why it is NOT putting the files in \temp and rather in just the root dir of the TC installation. I could explicitly force it, however that doesnt seem right. >> >>Chris Pat wrote: Hi Martin, David >>Thanks. >>Where/syntax to set the tmpdir? >>Below is the syntax I use and when run from local host it puts the files in the "root" tomcat directory, at the same level as the all the subdirectories. Even outside the webapp directory. However it is accessible. >> >>When I switch to accessing from a domain with modjk, TC cant find the file. The very same code that calls a servlet to populate a html img tag is blank, but the rest of the page renders correctly. >> >>I also found something claiming that TC configures its own tmp directory per webapp. Is that from the proper setting of CATALINA_TMPDIR in the server.xml? with what syntax? tia. >> >>String tempdir = System.getProperty("java.io.tmpdir"); >> if (! (tempdir.endsWith("/") || tempdir.endsWith("\\"))) { >> tempdir = tempdir + System.getProperty("file.separator"); >> } >> File tempFile = null; >> try { >> tempFile = File.createTempFile("myFile", "." + outputType); >> } >> catch (IOException ex2) { >> } >> >> >> >> >> > > >--------------------------------------------------------------------- >To start a new topic, e-mail: users@tomcat.apache.org >To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >For additional commands, e-mail: users-help@tomcat.apache.org > > > > > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org