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 Johann RENEL <jo...@softeam.fr> on 2006/01/03 12:01:00 UTC

Delete attachments after the response

Hello all,

I send attachments into a response message (into XXXXSOAPBindingImpl 
generated by Axis with WSDL2Java):

-- code --

MessageContext msgContext = MessageContext.getCurrentContext();
Message msgResponse = msgContext.getResponseMessage();
...		
File file = UtilitaireAttachement.recupereFichierAttachement(uri);
DataHandler dataHandler = new DataHandler(new FileDataSource(file));
AttachmentPart ap = new AttachmentPart(dataHandler);
ap.setContentId(uri.getPath());
msgResponse.addAttachmentPart(ap);
...

-- end code --

I would like to delete my file after the response was sent but I don't 
know how to do it. I saw the dispose() method into AttachmentPart but 
how to access it ?

Best regards,

Johann

PS : sorry for my "pitoyable" english :-)

Re: Delete attachments after the response

Posted by dvselva <se...@credit-suisse.com>.
Hi,

Can you please send me the sample code that you used to delete the
attachments. I am having same issue.

Thanks for your HELP
--
View this message in context: http://www.nabble.com/Delete+attachments+after+the+response-t842099.html#a4651570
Sent from the Axis - User forum at Nabble.com.


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


Re: Delete attachments after the response

Posted by Johann RENEL <jo...@gmail.com>.
Yes ! Thank you Jayachandra ! I have modified the dispose() method to delete
my files and that's work. The Garbage collector call dispose() after the
message is sent.

Johann

2006/1/6, jayachandra <ja...@gmail.com>:
>
> Hi,
> I believe one might not worry of disposing the attachment from memory
> AFTER the message is sent, once the request-response session ends
> automatically the held up memory objects return back to pool. I see a
> protected finalize() method inside attachment part.
>
> Jayachandra
>
> On 1/6/06, Johann RENEL <jo...@gmail.com> wrote:
> >
> > Hello,
> >
> > The problem is : When execute the dispose() method.
> > I need to delete file AFTER the message sent, and where write the call
> > to the dispose() methode.
> >
> > Johann
> >
> > 2006/1/4, jayachandra <ja...@gmail.com>:
> > >
> > > I haven't tried anything like what you said, but just wanted to know
> > > what is the problem you are facing accessing dispose() method.
> > > I just checked the signature and it is a public method.
> > >
> > > Thanks
> > > Jayachandra
> > >
> > > On 1/3/06, Johann RENEL <johann.renel@softeam.fr > wrote:
> > > >
> > > > Hello all,
> > > >
> > > > I send attachments into a response message (into XXXXSOAPBindingImpl
> > > > generated by Axis with WSDL2Java):
> > > >
> > > > -- code --
> > > >
> > > > MessageContext msgContext = MessageContext.getCurrentContext();
> > > > Message msgResponse = msgContext.getResponseMessage();
> > > > ...
> > > > File file = UtilitaireAttachement.recupereFichierAttachement(uri);
> > > > DataHandler dataHandler = new DataHandler(new FileDataSource(file));
> > > > AttachmentPart ap = new AttachmentPart(dataHandler);
> > > > ap.setContentId(uri.getPath());
> > > > msgResponse.addAttachmentPart(ap);
> > > > ...
> > > >
> > > > -- end code --
> > > >
> > > > I would like to delete my file after the response was sent but I
> > > > don't
> > > > know how to do it. I saw the dispose() method into AttachmentPart
> > > > but
> > > > how to access it ?
> > > >
> > > > Best regards,
> > > >
> > > > Johann
> > > >
> > > > PS : sorry for my "pitoyable" english :-)
> > > >
> > >
> > >
> > >
> > > --
> > > -- Jaya
> >
> >
> >
>
>
> --
> -- Jaya

Re: Delete attachments after the response

Posted by jayachandra <ja...@gmail.com>.
Hi,
I believe one might not worry of disposing the attachment from memory AFTER
the message is sent, once the request-response session ends automatically
the held up memory objects return back to pool. I see a protected finalize()
method inside attachment part.

Jayachandra

On 1/6/06, Johann RENEL <jo...@gmail.com> wrote:
>
> Hello,
>
> The problem is : When execute the dispose() method.
> I need to delete file AFTER the message sent, and where write the call to
> the dispose() methode.
>
> Johann
>
> 2006/1/4, jayachandra <ja...@gmail.com>:
> >
> > I haven't tried anything like what you said, but just wanted to know
> > what is the problem you are facing accessing dispose() method.
> > I just checked the signature and it is a public method.
> >
> > Thanks
> > Jayachandra
> >
> > On 1/3/06, Johann RENEL <johann.renel@softeam.fr > wrote:
> > >
> > > Hello all,
> > >
> > > I send attachments into a response message (into XXXXSOAPBindingImpl
> > > generated by Axis with WSDL2Java):
> > >
> > > -- code --
> > >
> > > MessageContext msgContext = MessageContext.getCurrentContext();
> > > Message msgResponse = msgContext.getResponseMessage();
> > > ...
> > > File file = UtilitaireAttachement.recupereFichierAttachement(uri);
> > > DataHandler dataHandler = new DataHandler(new FileDataSource(file));
> > > AttachmentPart ap = new AttachmentPart(dataHandler);
> > > ap.setContentId(uri.getPath());
> > > msgResponse.addAttachmentPart(ap);
> > > ...
> > >
> > > -- end code --
> > >
> > > I would like to delete my file after the response was sent but I don't
> > > know how to do it. I saw the dispose() method into AttachmentPart but
> > > how to access it ?
> > >
> > > Best regards,
> > >
> > > Johann
> > >
> > > PS : sorry for my "pitoyable" english :-)
> > >
> >
> >
> >
> > --
> > -- Jaya
>
>
>


--
-- Jaya

Re: Delete attachments after the response

Posted by Johann RENEL <jo...@gmail.com>.
Hello,

The problem is : When execute the dispose() method.
I need to delete file AFTER the message sent, and where write the call to
the dispose() methode.

Johann

2006/1/4, jayachandra <ja...@gmail.com>:
>
> I haven't tried anything like what you said, but just wanted to know what
> is the problem you are facing accessing dispose() method.
> I just checked the signature and it is a public method.
>
> Thanks
> Jayachandra
>
> On 1/3/06, Johann RENEL <jo...@softeam.fr> wrote:
> >
> > Hello all,
> >
> > I send attachments into a response message (into XXXXSOAPBindingImpl
> > generated by Axis with WSDL2Java):
> >
> > -- code --
> >
> > MessageContext msgContext = MessageContext.getCurrentContext();
> > Message msgResponse = msgContext.getResponseMessage();
> > ...
> > File file = UtilitaireAttachement.recupereFichierAttachement(uri);
> > DataHandler dataHandler = new DataHandler(new FileDataSource(file));
> > AttachmentPart ap = new AttachmentPart(dataHandler);
> > ap.setContentId(uri.getPath());
> > msgResponse.addAttachmentPart(ap);
> > ...
> >
> > -- end code --
> >
> > I would like to delete my file after the response was sent but I don't
> > know how to do it. I saw the dispose() method into AttachmentPart but
> > how to access it ?
> >
> > Best regards,
> >
> > Johann
> >
> > PS : sorry for my "pitoyable" english :-)
> >
>
>
>
> --
> -- Jaya

Re: Delete attachments after the response

Posted by jayachandra <ja...@gmail.com>.
I haven't tried anything like what you said, but just wanted to know what is
the problem you are facing accessing dispose() method.
I just checked the signature and it is a public method.

Thanks
Jayachandra

On 1/3/06, Johann RENEL <jo...@softeam.fr> wrote:
>
> Hello all,
>
> I send attachments into a response message (into XXXXSOAPBindingImpl
> generated by Axis with WSDL2Java):
>
> -- code --
>
> MessageContext msgContext = MessageContext.getCurrentContext();
> Message msgResponse = msgContext.getResponseMessage();
> ...
> File file = UtilitaireAttachement.recupereFichierAttachement(uri);
> DataHandler dataHandler = new DataHandler(new FileDataSource(file));
> AttachmentPart ap = new AttachmentPart(dataHandler);
> ap.setContentId(uri.getPath());
> msgResponse.addAttachmentPart(ap);
> ...
>
> -- end code --
>
> I would like to delete my file after the response was sent but I don't
> know how to do it. I saw the dispose() method into AttachmentPart but
> how to access it ?
>
> Best regards,
>
> Johann
>
> PS : sorry for my "pitoyable" english :-)
>



--
-- Jaya