You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Paul Joseph <pj...@yahoo.com> on 2004/10/22 22:22:12 UTC

Uploaded file disappears on Tomcat restart

Hi,

I have the upload widget working....the only question
I have is this:

when I restart Tomcat (not when I stop it), the file
disappears - Tomcat thinks it needes to clean it out
(?)

Is there anyway to stop this or to work around it?

thx
Paul

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


Re: Uploaded file disappears on Tomcat restart

Posted by Paul Joseph <pj...@yahoo.com>.
Thanks again Gertjan.

I will do this (for the beta in Jan.) and will keep
you posted.  

rgds
Paul
--- Gertjan Assies <ge...@assies.nu> wrote:

> Paul,
> 
> I believe the location in the setting will be
> cleaned and only that 
> location, if you move it with the code below,
> Cocoon/Tomcat _should_ be 
> unaware of the new location.
> Perhaps it has to do with your deploy method, I
> believe when deploying 
> using the manager webapp in Tomcat, it recreates the
> webapp every time 
> you restart Tomcat somewhere under the work
> directory, but i'm not sure 
> about the precise mechanism
> 
> cheers,
> Gertjan
> 
> Paul Joseph wrote:
> 
> >Actually Gertjan,
> >
> >I can move it directly to any directory I choose by
> >changing the upload setting in the Cocoon conf.
> file.
> >
> >If I use the approach below and keep it in a
> directory
> >that is still under the Tomcat heirarchy, I presume
> it
> >will still be deleted - no?
> >
> >thx
> >Paul
> >--- Paul Joseph <pj...@yahoo.com> wrote:
> >
> >  
> >
> >>Thank you very much Gertjan.  Your solution is
> much
> >>simpler than what I was planning to do, and so I
> >>will
> >>use it instead of mine!
> >>
> >>
> >>--- Gertjan Assies <ge...@assies.nu> wrote:
> >>
> >>    
> >>
> >>>Hi,
> >>>
> >>>I use the following simple code to move uploaded
> >>>files
> >>>It's called from the action which handles the
> >>>submitted form
> >>>the _sName here is extracted from the submitted
> >>>field value which 
> >>>contains the local path and the filename
> >>> 
> >>>private boolean moveFile(String _sName) {
> >>>       boolean bResult = false;
> >>>       File aInFile = new File(TEMP_PATH +
> >>>      
> >>>
> >>_sName);
> >>    
> >>
> >>>        if (aInFile.exists()) {
> >>>            File aOutFile = new File(DEST_PATH +
> >>>_sName);
> >>>            bResult = aInFile.renameTo(aOutFile);
> >>>        }
> >>>        return bResult;
> >>>}
> >>>
> >>>Leszek Gawron wrote:
> >>>
> >>>      
> >>>
> >>>>Paul Joseph wrote:
> >>>>
> >>>>        
> >>>>
> >>>>>Thank you Grzegorz.
> >>>>>
> >>>>>I would like to save it under the Tomcat
> >>>>>hierarchy....so that Tomcat can serve the
> >>>>>          
> >>>>>
> >>>uploaded
> >>>      
> >>>
> >>>>>file to other users in the company.
> >>>>>
> >>>>>That being the case, the other option that you
> >>>>>          
> >>>>>
> >>>suggest
> >>>      
> >>>
> >>>>>is to disable autoupload.
> >>>>>
> >>>>>If I do this, will the upload widget continue
> >>>>>          
> >>>>>
> >>to
> >>    
> >>
> >>>work?
> >>>      
> >>>
> >>>>>(that is all I care about in terms of
> >>>>>          
> >>>>>
> >>uploading)
> >>    
> >>
> >>>>First I think there is no such thing as
> >>>>        
> >>>>
> >>>autoupload. However if the 
> >>>      
> >>>
> >>>>upload is being enabled in web.xml file then if
> >>>>        
> >>>>
> >>>multipart request 
> >>>      
> >>>
> >>>>comes the request is automatically properly
> >>>>        
> >>>>
> >>>decoded and made available 
> >>>      
> >>>
> >>>>to the user. Query cocoon wiki for the  way to
> >>>>        
> >>>>
> >>>obtain the access to 
> >>>      
> >>>
> >>>>FilePart. You should copy the data into some
> >>>>        
> >>>>
> >>>storage (filesystem, 
> >>>      
> >>>
> >>>>database). I do not really remember the details
> >>>>        
> >>>>
> >>of
> >>    
> >>
> >>>this mechanism. If 
> >>>      
> >>>
> >>>>it persists temporary data to disk it will be
> >>>>        
> >>>>
> >>>deleted after the 
> >>>      
> >>>
> >>>>request has been processed.
> >>>>
> >>>>        
> >>>>
> >>>
> >>>      
> >>>
>
>---------------------------------------------------------------------
> >  
> >
> >>>To unsubscribe, e-mail:
> >>>users-unsubscribe@cocoon.apache.org
> >>>For additional commands, e-mail:
> >>>users-help@cocoon.apache.org
> >>>
> >>>
> >>>      
> >>>
> >>
> >>    
> >>
>
>---------------------------------------------------------------------
> >  
> >
> >>To unsubscribe, e-mail:
> >>users-unsubscribe@cocoon.apache.org
> >>For additional commands, e-mail:
> >>users-help@cocoon.apache.org
> >>
> >>
> >>    
> >>
> >
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> >For additional commands, e-mail:
> users-help@cocoon.apache.org
> 
=== message truncated ===


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


Re: Uploaded file disappears on Tomcat restart

Posted by Gertjan Assies <ge...@assies.nu>.
Paul,

I believe the location in the setting will be cleaned and only that 
location, if you move it with the code below, Cocoon/Tomcat _should_ be 
unaware of the new location.
Perhaps it has to do with your deploy method, I believe when deploying 
using the manager webapp in Tomcat, it recreates the webapp every time 
you restart Tomcat somewhere under the work directory, but i'm not sure 
about the precise mechanism

cheers,
Gertjan

Paul Joseph wrote:

>Actually Gertjan,
>
>I can move it directly to any directory I choose by
>changing the upload setting in the Cocoon conf. file.
>
>If I use the approach below and keep it in a directory
>that is still under the Tomcat heirarchy, I presume it
>will still be deleted - no?
>
>thx
>Paul
>--- Paul Joseph <pj...@yahoo.com> wrote:
>
>  
>
>>Thank you very much Gertjan.  Your solution is much
>>simpler than what I was planning to do, and so I
>>will
>>use it instead of mine!
>>
>>
>>--- Gertjan Assies <ge...@assies.nu> wrote:
>>
>>    
>>
>>>Hi,
>>>
>>>I use the following simple code to move uploaded
>>>files
>>>It's called from the action which handles the
>>>submitted form
>>>the _sName here is extracted from the submitted
>>>field value which 
>>>contains the local path and the filename
>>> 
>>>private boolean moveFile(String _sName) {
>>>       boolean bResult = false;
>>>       File aInFile = new File(TEMP_PATH +
>>>      
>>>
>>_sName);
>>    
>>
>>>        if (aInFile.exists()) {
>>>            File aOutFile = new File(DEST_PATH +
>>>_sName);
>>>            bResult = aInFile.renameTo(aOutFile);
>>>        }
>>>        return bResult;
>>>}
>>>
>>>Leszek Gawron wrote:
>>>
>>>      
>>>
>>>>Paul Joseph wrote:
>>>>
>>>>        
>>>>
>>>>>Thank you Grzegorz.
>>>>>
>>>>>I would like to save it under the Tomcat
>>>>>hierarchy....so that Tomcat can serve the
>>>>>          
>>>>>
>>>uploaded
>>>      
>>>
>>>>>file to other users in the company.
>>>>>
>>>>>That being the case, the other option that you
>>>>>          
>>>>>
>>>suggest
>>>      
>>>
>>>>>is to disable autoupload.
>>>>>
>>>>>If I do this, will the upload widget continue
>>>>>          
>>>>>
>>to
>>    
>>
>>>work?
>>>      
>>>
>>>>>(that is all I care about in terms of
>>>>>          
>>>>>
>>uploading)
>>    
>>
>>>>First I think there is no such thing as
>>>>        
>>>>
>>>autoupload. However if the 
>>>      
>>>
>>>>upload is being enabled in web.xml file then if
>>>>        
>>>>
>>>multipart request 
>>>      
>>>
>>>>comes the request is automatically properly
>>>>        
>>>>
>>>decoded and made available 
>>>      
>>>
>>>>to the user. Query cocoon wiki for the  way to
>>>>        
>>>>
>>>obtain the access to 
>>>      
>>>
>>>>FilePart. You should copy the data into some
>>>>        
>>>>
>>>storage (filesystem, 
>>>      
>>>
>>>>database). I do not really remember the details
>>>>        
>>>>
>>of
>>    
>>
>>>this mechanism. If 
>>>      
>>>
>>>>it persists temporary data to disk it will be
>>>>        
>>>>
>>>deleted after the 
>>>      
>>>
>>>>request has been processed.
>>>>
>>>>        
>>>>
>>>
>>>      
>>>
>---------------------------------------------------------------------
>  
>
>>>To unsubscribe, e-mail:
>>>users-unsubscribe@cocoon.apache.org
>>>For additional commands, e-mail:
>>>users-help@cocoon.apache.org
>>>
>>>
>>>      
>>>
>>
>>    
>>
>---------------------------------------------------------------------
>  
>
>>To unsubscribe, e-mail:
>>users-unsubscribe@cocoon.apache.org
>>For additional commands, e-mail:
>>users-help@cocoon.apache.org
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>  
>


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


Re: Uploaded file disappears on Tomcat restart

Posted by Paul Joseph <pj...@yahoo.com>.
Actually Gertjan,

I can move it directly to any directory I choose by
changing the upload setting in the Cocoon conf. file.

If I use the approach below and keep it in a directory
that is still under the Tomcat heirarchy, I presume it
will still be deleted - no?

thx
Paul
--- Paul Joseph <pj...@yahoo.com> wrote:

> Thank you very much Gertjan.  Your solution is much
> simpler than what I was planning to do, and so I
> will
> use it instead of mine!
> 
> 
> --- Gertjan Assies <ge...@assies.nu> wrote:
> 
> > Hi,
> > 
> > I use the following simple code to move uploaded
> > files
> > It's called from the action which handles the
> > submitted form
> > the _sName here is extracted from the submitted
> > field value which 
> > contains the local path and the filename
> >  
> > private boolean moveFile(String _sName) {
> >        boolean bResult = false;
> >        File aInFile = new File(TEMP_PATH +
> _sName);
> >         if (aInFile.exists()) {
> >             File aOutFile = new File(DEST_PATH +
> > _sName);
> >             bResult = aInFile.renameTo(aOutFile);
> >         }
> >         return bResult;
> > }
> > 
> > Leszek Gawron wrote:
> > 
> > > Paul Joseph wrote:
> > >
> > >> Thank you Grzegorz.
> > >>
> > >> I would like to save it under the Tomcat
> > >> hierarchy....so that Tomcat can serve the
> > uploaded
> > >> file to other users in the company.
> > >>
> > >> That being the case, the other option that you
> > suggest
> > >> is to disable autoupload.
> > >>
> > >> If I do this, will the upload widget continue
> to
> > work?
> > >> (that is all I care about in terms of
> uploading)
> > >
> > > First I think there is no such thing as
> > autoupload. However if the 
> > > upload is being enabled in web.xml file then if
> > multipart request 
> > > comes the request is automatically properly
> > decoded and made available 
> > > to the user. Query cocoon wiki for the  way to
> > obtain the access to 
> > > FilePart. You should copy the data into some
> > storage (filesystem, 
> > > database). I do not really remember the details
> of
> > this mechanism. If 
> > > it persists temporary data to disk it will be
> > deleted after the 
> > > request has been processed.
> > >
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail:
> > users-help@cocoon.apache.org
> > 
> > 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
> 
> 


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


Re: Uploaded file disappears on Tomcat restart

Posted by Paul Joseph <pj...@yahoo.com>.
Thank you very much Gertjan.  Your solution is much
simpler than what I was planning to do, and so I will
use it instead of mine!


--- Gertjan Assies <ge...@assies.nu> wrote:

> Hi,
> 
> I use the following simple code to move uploaded
> files
> It's called from the action which handles the
> submitted form
> the _sName here is extracted from the submitted
> field value which 
> contains the local path and the filename
>  
> private boolean moveFile(String _sName) {
>        boolean bResult = false;
>        File aInFile = new File(TEMP_PATH + _sName);
>         if (aInFile.exists()) {
>             File aOutFile = new File(DEST_PATH +
> _sName);
>             bResult = aInFile.renameTo(aOutFile);
>         }
>         return bResult;
> }
> 
> Leszek Gawron wrote:
> 
> > Paul Joseph wrote:
> >
> >> Thank you Grzegorz.
> >>
> >> I would like to save it under the Tomcat
> >> hierarchy....so that Tomcat can serve the
> uploaded
> >> file to other users in the company.
> >>
> >> That being the case, the other option that you
> suggest
> >> is to disable autoupload.
> >>
> >> If I do this, will the upload widget continue to
> work?
> >> (that is all I care about in terms of uploading)
> >
> > First I think there is no such thing as
> autoupload. However if the 
> > upload is being enabled in web.xml file then if
> multipart request 
> > comes the request is automatically properly
> decoded and made available 
> > to the user. Query cocoon wiki for the  way to
> obtain the access to 
> > FilePart. You should copy the data into some
> storage (filesystem, 
> > database). I do not really remember the details of
> this mechanism. If 
> > it persists temporary data to disk it will be
> deleted after the 
> > request has been processed.
> >
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
> 
> 


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


Re: Uploaded file disappears on Tomcat restart

Posted by Gertjan Assies <ge...@assies.nu>.
Hi,

I use the following simple code to move uploaded files
It's called from the action which handles the submitted form
the _sName here is extracted from the submitted field value which 
contains the local path and the filename
 
private boolean moveFile(String _sName) {
       boolean bResult = false;
       File aInFile = new File(TEMP_PATH + _sName);
        if (aInFile.exists()) {
            File aOutFile = new File(DEST_PATH + _sName);
            bResult = aInFile.renameTo(aOutFile);
        }
        return bResult;
}

Leszek Gawron wrote:

> Paul Joseph wrote:
>
>> Thank you Grzegorz.
>>
>> I would like to save it under the Tomcat
>> hierarchy....so that Tomcat can serve the uploaded
>> file to other users in the company.
>>
>> That being the case, the other option that you suggest
>> is to disable autoupload.
>>
>> If I do this, will the upload widget continue to work?
>> (that is all I care about in terms of uploading)
>
> First I think there is no such thing as autoupload. However if the 
> upload is being enabled in web.xml file then if multipart request 
> comes the request is automatically properly decoded and made available 
> to the user. Query cocoon wiki for the  way to obtain the access to 
> FilePart. You should copy the data into some storage (filesystem, 
> database). I do not really remember the details of this mechanism. If 
> it persists temporary data to disk it will be deleted after the 
> request has been processed.
>


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


Re: Uploaded file disappears on Tomcat restart

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Paul Joseph wrote:
> Thank you Grzegorz.
> 
> I would like to save it under the Tomcat
> hierarchy....so that Tomcat can serve the uploaded
> file to other users in the company.
> 
> That being the case, the other option that you suggest
> is to disable autoupload.
> 
> If I do this, will the upload widget continue to work?
> (that is all I care about in terms of uploading)
First I think there is no such thing as autoupload. However if the 
upload is being enabled in web.xml file then if multipart request comes 
the request is automatically properly decoded and made available to the 
user. Query cocoon wiki for the  way to obtain the access to FilePart. 
You should copy the data into some storage (filesystem, database). I do 
not really remember the details of this mechanism. If it persists 
temporary data to disk it will be deleted after the request has been 
processed.

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

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


Re: Uploaded file disappears on Tomcat restart

Posted by Paul Joseph <pj...@yahoo.com>.
Thank you Grzegorz.

I would like to save it under the Tomcat
hierarchy....so that Tomcat can serve the uploaded
file to other users in the company.

That being the case, the other option that you suggest
is to disable autoupload.

If I do this, will the upload widget continue to work?
(that is all I care about in terms of uploading)

Also, how does one turn it off?

thx
Paul
--- Grzegorz Ta�czyk <go...@polzone.pl> wrote:

> Hello Paul,
> 
> You should save this file in another location or
> disable autoupload.
> Cocoon marks uploaded files as "delete after
> release"(or sth).
> 
> Friday, October 22, 2004, 10:22:12 PM, you wrote:
> PJ> Hi,
> 
> PJ> I have the upload widget working....the only
> question
> PJ> I have is this:
> 
> PJ> when I restart Tomcat (not when I stop it), the
> file
> PJ> disappears - Tomcat thinks it needes to clean it
> out
> PJ> (?)
> 
> PJ> Is there anyway to stop this or to work around
> it?
> 
> PJ> thx
> PJ> Paul
> 
> 
> -- 
> Best regards,
>  Grzegorz                           
> mailto:goliatus@polzone.pl
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
> 
> 


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


Re: Uploaded file disappears on Tomcat restart

Posted by Grzegorz Tańczyk <go...@polzone.pl>.
Hello Paul,

You should save this file in another location or disable autoupload.
Cocoon marks uploaded files as "delete after release"(or sth).

Friday, October 22, 2004, 10:22:12 PM, you wrote:
PJ> Hi,

PJ> I have the upload widget working....the only question
PJ> I have is this:

PJ> when I restart Tomcat (not when I stop it), the file
PJ> disappears - Tomcat thinks it needes to clean it out
PJ> (?)

PJ> Is there anyway to stop this or to work around it?

PJ> thx
PJ> Paul


-- 
Best regards,
 Grzegorz                            mailto:goliatus@polzone.pl


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