You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Brian Bacsu <bb...@csc.com> on 2006/12/19 16:59:47 UTC

Re: Naming of MTOM cached attachment files

Hi

I am using the cache feature of Axis2 1.1 for very large MTOM attachments 
in a client component. Currently the files are being saved into the 
defined temporary directory with a naming format similar to 
"Axis28105.att, Axis28106.att, etc.  This naming convention makes it very 
difficult to identify which file was placed in the temp directory by which 
user, so that the file can be retrieved and the temp directory cleaned up. 
 I am wondering how/where these names are constructed?

Is there any method to control the naming of the cached file, or to obtain 
the name that will be used during the processing of the MTOM response?



Thanks,

Brian Bacsu

Re: Naming of MTOM cached attachment files

Posted by Thilina Gunarathne <cs...@gmail.com>.
Brain,
Proper method is to use the functionality provided by DataHandler and
DataSource. DataHandler will not read the attachment in to the memory In the
case of a large attachment when it is cached in the temp dir. I In that
scenerio DataHandler will run off on file data source object which will in
turn refer to the physical temp file...

~Thilina

On 12/20/06, Brian Bacsu <bb...@csc.com> wrote:
>
>
> Thilina:
>
> Thanks for the information. I will try that. The reason for using the
> cache was to avoid placing very large files in memory, but if the cache is
> for Axis2 internal use, what is the proper method to access/utilize these
> files, once they have been obtained from the response, and stored in the
> temp directory.
>
> Thanks,
>
> Brian Bacsu
>
>
>
>
>  *"Thilina Gunarathne" <cs...@gmail.com>*
>
> 12/19/2006 02:04 PM  Please respond to
> axis-user@ws.apache.org
>
>   To
> axis-user@ws.apache.org  cc
>
>  Subject
> Re: Naming of MTOM cached attachment files
>
>
>
>
>
>
> Hi,
> Actually the temp directory is meant for Axis2 internal use.  Also
> only the attachments which are larger than the file size threshold
> will get stored there...
>
> But u can manipulate those files in the following way by adding some
> code to the business logic.. (Make sure to make the file size
> threshold 0)..
>
> DataHandler dataHandler = (DataHandler)omText.getDataHandler();
> // You can check the data source type for added safety
> FileDataSource fileDataSource =
> (FileDataSource)dataHandler.getDataSource();
> File file = fileDataSource.getFile();
> //Rename to your desired file name
> file.renameTo(new File("MyFile.bin"));
>
> Thanks,
> Thilina
>
> On 12/19/06, Brian Bacsu <bb...@csc.com> wrote:
> >
> > Hi
> >
> > I am using the cache feature of Axis2 1.1 for very large MTOM
> attachments in
> > a client component. Currently the files are being saved into the defined
> > temporary directory with a naming format similar to "Axis28105.att,
> > Axis28106.att, etc.  This naming convention makes it very difficult to
> > identify which file was placed in the temp directory by which user, so
> that
> > the file can be retrieved and the temp directory cleaned up.  I am
> wondering
> > how/where these names are constructed?
> >
> > Is there any method to control the naming of the cached file, or to
> obtain
> > the name that will be used during the processing of the MTOM response?
> >
> >
> >
> > Thanks,
> >
> >  Brian Bacsu
> >
>
>
> --
> Thilina Gunarathne
> WSO2, Inc.; http://www.wso2.com/
> Home page: http://webservices.apache.org/~thilina/<http://webservices.apache.org/%7Ethilina/>
> Blog: http://thilinag.blogspot.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>


-- 
Thilina Gunarathne
WSO2, Inc.; http://www.wso2.com/
Home page: http://webservices.apache.org/~thilina/
Blog: http://thilinag.blogspot.com/

Re: Naming of MTOM cached attachment files

Posted by Brian Bacsu <bb...@csc.com>.
Thilina:

Thanks for the information. I will try that. The reason for using the 
cache was to avoid placing very large files in memory, but if the cache is 
for Axis2 internal use, what is the proper method to access/utilize these 
files, once they have been obtained from the response, and stored in the 
temp directory.

Thanks,

Brian Bacsu





"Thilina Gunarathne" <cs...@gmail.com> 
12/19/2006 02:04 PM
Please respond to
axis-user@ws.apache.org


To
axis-user@ws.apache.org
cc

Subject
Re: Naming of MTOM cached attachment files






Hi,
Actually the temp directory is meant for Axis2 internal use.  Also
only the attachments which are larger than the file size threshold
will get stored there...

But u can manipulate those files in the following way by adding some
code to the business logic.. (Make sure to make the file size
threshold 0)..

DataHandler dataHandler = (DataHandler)omText.getDataHandler();
// You can check the data source type for added safety
FileDataSource fileDataSource = 
(FileDataSource)dataHandler.getDataSource();
File file = fileDataSource.getFile();
//Rename to your desired file name
file.renameTo(new File("MyFile.bin"));

Thanks,
Thilina

On 12/19/06, Brian Bacsu <bb...@csc.com> wrote:
>
> Hi
>
> I am using the cache feature of Axis2 1.1 for very large MTOM 
attachments in
> a client component. Currently the files are being saved into the defined
> temporary directory with a naming format similar to "Axis28105.att,
> Axis28106.att, etc.  This naming convention makes it very difficult to
> identify which file was placed in the temp directory by which user, so 
that
> the file can be retrieved and the temp directory cleaned up.  I am 
wondering
> how/where these names are constructed?
>
> Is there any method to control the naming of the cached file, or to 
obtain
> the name that will be used during the processing of the MTOM response?
>
>
>
> Thanks,
>
>  Brian Bacsu
>


-- 
Thilina Gunarathne
WSO2, Inc.; http://www.wso2.com/
Home page: http://webservices.apache.org/~thilina/
Blog: http://thilinag.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org



Re: Naming of MTOM cached attachment files

Posted by Thilina Gunarathne <cs...@gmail.com>.
Hi,
Actually the temp directory is meant for Axis2 internal use.  Also
only the attachments which are larger than the file size threshold
will get stored there...

But u can manipulate those files in the following way by adding some
code to the business logic.. (Make sure to make the file size
threshold 0)..

DataHandler dataHandler = (DataHandler)omText.getDataHandler();
// You can check the data source type for added safety
FileDataSource fileDataSource = (FileDataSource)dataHandler.getDataSource();
File file = fileDataSource.getFile();
//Rename to your desired file name
file.renameTo(new File("MyFile.bin"));

Thanks,
Thilina

On 12/19/06, Brian Bacsu <bb...@csc.com> wrote:
>
> Hi
>
> I am using the cache feature of Axis2 1.1 for very large MTOM attachments in
> a client component. Currently the files are being saved into the defined
> temporary directory with a naming format similar to "Axis28105.att,
> Axis28106.att, etc.  This naming convention makes it very difficult to
> identify which file was placed in the temp directory by which user, so that
> the file can be retrieved and the temp directory cleaned up.  I am wondering
> how/where these names are constructed?
>
> Is there any method to control the naming of the cached file, or to obtain
> the name that will be used during the processing of the MTOM response?
>
>
>
> Thanks,
>
>  Brian Bacsu
>


-- 
Thilina Gunarathne
WSO2, Inc.; http://www.wso2.com/
Home page: http://webservices.apache.org/~thilina/
Blog: http://thilinag.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org