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 David Nolen <da...@gmail.com> on 2005/09/01 21:21:34 UTC
Waiting for JSVGComponent
I using the Batik classes from a Java Servlet. In the Servlet I'm
creating a new JSVGComponent and then calling the loadSVGDocument()
method. However according to the Batik API, the only way to know if
the document has finished loading is to set up an event listener,
which I've done.
However the listener fires after the Servlet has exited. How can I
make the Servlet wait for loadSVGDocument() to truly finish?
David
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: Waiting for JSVGComponent
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi David,
David
wrote:
> Thanks. I had tried to accomplish what you're describing, but I'm new
> to Java threading. I am calling wait() from the main servlet thread.
> At the end of the event listener I call notify(). This doesn't not
> seem to work. Any suggestions?
Are you calling 'wait' and 'notify' on the same object? It doesn't
matter much what the object is but they have to be the same object.
Some people construct a primitive 'Object' to act as a lock in cases
like this.
> As for what why I'm using JSVGComponent- I'm writing a custom
> web-based map tool. By using JSVGComponent I can have the client
> click on the map in the web browser, then via the xmlhttprequest
> object send the coordinates to the server. I'm using the
> JSVGComponent to generate a GVTTree and checking each path's
> contains(Point2D) method to see which geographic region the client
> clicked on.
Well you can get a GVT tree easily enough using the instructions
on:
http://wiki.apache.org/xmlgraphics-batik/BootSvgAndCssDom
This would also allow you to use the SVG DOM methods.
>
> David
>
> On 9/2/05, Thomas DeWeese <Th...@kodak.com> wrote:
>
>>David Nolen wrote:
>>
>>>I using the Batik classes from a Java Servlet. In the Servlet I'm
>>>creating a new JSVGComponent and then calling the loadSVGDocument()
>>>method. However according to the Batik API, the only way to know if
>>>the document has finished loading is to set up an event listener,
>>>which I've done.
>>>
>>>However the listener fires after the Servlet has exited. How can I
>>>make the Servlet wait for loadSVGDocument() to truly finish?
>>
>> There are a large number of ways the simplest is probably to
>>have the main Servlet thread call 'wait()' and have your callback
>>'notify' the main servlet thread when it is called.
>>
>> BTW it is fairly unusual to be using the JSVGComponent in a
>>Servlet. Can I ask what you are doing? You may find that the
>>Transcoders are more appropriate or that you would find it easier
>>to call some of the internal classes directly rather than work
>>around the asynchronous nature of the JSVGCanavs (async is good
>>for UI, bad for Servlet).
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>>For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: Waiting for JSVGComponent
Posted by David Nolen <da...@gmail.com>.
Thanks. I had tried to accomplish what you're describing, but I'm new
to Java threading. I am calling wait() from the main servlet thread.
At the end of the event listener I call notify(). This doesn't not
seem to work. Any suggestions?
As for what why I'm using JSVGComponent- I'm writing a custom
web-based map tool. By using JSVGComponent I can have the client
click on the map in the web browser, then via the xmlhttprequest
object send the coordinates to the server. I'm using the
JSVGComponent to generate a GVTTree and checking each path's
contains(Point2D) method to see which geographic region the client
clicked on.
David
On 9/2/05, Thomas DeWeese <Th...@kodak.com> wrote:
> David Nolen wrote:
> > I using the Batik classes from a Java Servlet. In the Servlet I'm
> > creating a new JSVGComponent and then calling the loadSVGDocument()
> > method. However according to the Batik API, the only way to know if
> > the document has finished loading is to set up an event listener,
> > which I've done.
> >
> > However the listener fires after the Servlet has exited. How can I
> > make the Servlet wait for loadSVGDocument() to truly finish?
>
> There are a large number of ways the simplest is probably to
> have the main Servlet thread call 'wait()' and have your callback
> 'notify' the main servlet thread when it is called.
>
> BTW it is fairly unusual to be using the JSVGComponent in a
> Servlet. Can I ask what you are doing? You may find that the
> Transcoders are more appropriate or that you would find it easier
> to call some of the internal classes directly rather than work
> around the asynchronous nature of the JSVGCanavs (async is good
> for UI, bad for Servlet).
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: Waiting for JSVGComponent
Posted by Thomas DeWeese <Th...@Kodak.com>.
David Nolen wrote:
> I using the Batik classes from a Java Servlet. In the Servlet I'm
> creating a new JSVGComponent and then calling the loadSVGDocument()
> method. However according to the Batik API, the only way to know if
> the document has finished loading is to set up an event listener,
> which I've done.
>
> However the listener fires after the Servlet has exited. How can I
> make the Servlet wait for loadSVGDocument() to truly finish?
There are a large number of ways the simplest is probably to
have the main Servlet thread call 'wait()' and have your callback
'notify' the main servlet thread when it is called.
BTW it is fairly unusual to be using the JSVGComponent in a
Servlet. Can I ask what you are doing? You may find that the
Transcoders are more appropriate or that you would find it easier
to call some of the internal classes directly rather than work
around the asynchronous nature of the JSVGCanavs (async is good
for UI, bad for Servlet).
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org