You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Peter Coppens <pc...@gmail.com> on 2007/07/04 22:21:47 UTC

svg:image - referred images kept open?

Gentlepeople,

I am using batik through fop in a servlet. I have the impression that
referenced image files through the svg:image tag are kept open after being
rendered (while I would want to remove the files).

I see similar behavior with squiqle - once an svg file is displayed that
references an image the image file seems to be locked even though the svg
file that reference that image file is no longer displayed.

Is that known/intentional behavior? Is there any way to avoid that ?

Thanks,

Peter
-- 
View this message in context: http://www.nabble.com/svg%3Aimage---referred-images-kept-open--tf4026380.html#a11436982
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: batik wrapper for svg+js

Posted by Mark Fortner <ph...@gmail.com>.
If all you want to do is view SVG + JS you might try using FireFox.

Regards,

Mark

On 7/12/07, benamou <je...@inria.fr> wrote:
>
> Hi
> sorry if my question does not make sense ...
>
> I understand it is possible to write a java warpper using Batik to view
> dynamic svg  +JS files.
> (I mean without launching squiggle)
> Is there any example of this available .. and usable by a non java
> programmer.
>
> Thanks
> JD
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>

Re: batik wrapper for svg+js

Posted by Cameron McCormack <ca...@mcc.id.au>.
Hi JD.

benamou:
> sorry if my question does not make sense ...
> 
> I understand it is possible to write a java warpper using Batik to view 
> dynamic svg  +JS files.
> (I mean without launching squiggle)
> Is there any example of this available .. and usable by a non java 
> programmer.

There is a simple example of using the JSVGCanvas to display an SVG
document here:

  http://xmlgraphics.apache.org/batik/using/swing.html

-- 
Cameron McCormack, http://mcc.id.au/
	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au

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


batik wrapper for svg+js

Posted by benamou <je...@inria.fr>.
Hi
sorry if my question does not make sense ...

I understand it is possible to write a java warpper using Batik to view 
dynamic svg  +JS files.
(I mean without launching squiggle)
Is there any example of this available .. and usable by a non java 
programmer.

Thanks
JD



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


RE: svg:image - referred images kept open?

Posted by th...@kodak.com.
Hi Peter,

"Peter" <pc...@gmail.com> wrote on 07/11/2007 08:12:11 AM:

> > So the real fix here is a bit more complex than just adding 'close'
> > at the end of those readers (however they should do that).
> 
> I see (more or less). Oth, keeping the stream open for ever is also (in 
some
> environments like servlets) a bit of nuisance no? What would be the 
options?

   Well the streams won't stay open forever eventually the Garbage 
Collector
will collect those objects and the streams will be closed.

   However to make it happen as soon as possible, I would suggest a 
mechanism
for the ProtectedStream to be notified that it should respect any close 
calls
(including retrospectively). So if the ProtectedStream is 'tied' to it's
user then a call to close would actually close it.  And when you set it
to tied it would check if 'close' had been called since the last retry and
if so it would close the stream.


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


RE: svg:image - referred images kept open?

Posted by Peter <pc...@gmail.com>.
> So the real fix here is a bit more complex than just adding 'close'
> at the end of those readers (however they should do that).

I see (more or less). Oth, keeping the stream open for ever is also (in some
environments like servlets) a bit of nuisance no? What would be the options?

Thanks,

Peter


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


Re: svg:image - referred images kept open?

Posted by th...@kodak.com.
Hi Peter,

Peter Coppens <pc...@gmail.com> wrote on 07/06/2007 06:52:07 
PM:

> I think the problems is "created" in
> SVGElementImageBridge#createImageGraphicsNode
> 
> I added the release invocations and recompiled. The rendering still 
seems to
> work and now the image file no longer stays locked.
> 
> Should I submit a bug for this, or is this intentional ?

   This is intentional.  Some raster formats read the data only
on demand (in particular Tiff) doing the above will cause those
formats to fail.

   However JPEG and PNG read the entire file up front currently,
so those readers should close the stream when they are done.  However
even for those formats you could end up with trouble because they
read the data in a separate thread, so you might close the
stream on them when they are still reading.

   Given the whole purpose of the ProtectedStream is to keep
children for closing streams they shouldn't (for example it's
really expensive to keep re-opening an HTTP stream).  So the
real fix here is a bit more complex than just adding 'close'
at the end of those readers (however they should do that).


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


Re: svg:image - referred images kept open?

Posted by Peter Coppens <pc...@gmail.com>.
I think the problems is "created" in
SVGElementImageBridge#createImageGraphicsNode

The image file is opened at a certain point            

                 reference = openStream(e, purl);

There is also a try-finally block that seems to close it again
(reference.release()), but there are multiple returns from that function
that do not invoke the release call, like in 

                // It's a bouncing baby Raster...
                return createRasterImageNode(ctx, e, img, purl);


I added the release invocations and recompiled. The rendering still seems to
work and now the image file no longer stays locked.

Should I submit a bug for this, or is this intentional ?

Thanks,

Peter

 



Peter Coppens wrote:
> 
> I am attaching ( http://www.nabble.com/file/p11471903/FopLock.java
> FopLock.java ) a little repro.
> 
> Anyone seen this before? Any tips on how I could avoid this?
> 
> Many thanks,
> 
> Peter
> 
> 
> 
> 
> 
> Peter Coppens wrote:
>> 
>> Gentlepeople,
>> 
>> I am using batik through fop in a servlet. I have the impression that
>> referenced image files through the svg:image tag are kept open after
>> being rendered (while I would want to remove the files).
>> 
>> I see similar behavior with squiqle - once an svg file is displayed that
>> references an image the image file seems to be locked even though the svg
>> file that reference that image file is no longer displayed.
>> 
>> Is that known/intentional behavior? Is there any way to avoid that ?
>> 
>> Thanks,
>> 
>> Peter
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/svg%3Aimage---referred-images-kept-open--tf4026380.html#a11473661
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: svg:image - referred images kept open?

Posted by Peter Coppens <pc...@gmail.com>.
I am attaching ( http://www.nabble.com/file/p11471903/FopLock.java
FopLock.java ) a little repro.

Anyone seen this before? Any tips on how I could avoid this?

Many thanks,

Peter





Peter Coppens wrote:
> 
> Gentlepeople,
> 
> I am using batik through fop in a servlet. I have the impression that
> referenced image files through the svg:image tag are kept open after being
> rendered (while I would want to remove the files).
> 
> I see similar behavior with squiqle - once an svg file is displayed that
> references an image the image file seems to be locked even though the svg
> file that reference that image file is no longer displayed.
> 
> Is that known/intentional behavior? Is there any way to avoid that ?
> 
> Thanks,
> 
> Peter
> 

-- 
View this message in context: http://www.nabble.com/svg%3Aimage---referred-images-kept-open--tf4026380.html#a11471903
Sent from the Batik - Users mailing list archive at Nabble.com.


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