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 Massimo Signori <si...@webscience.it> on 2004/10/26 15:38:16 UTC

batik opens too TCP connections?

Hi everybody, i'm using batik to display an SVG in my java applet. This SVG
contains some links to javascript functions as shown:

<svg xmlns="http://www.w3.org/2000/svg"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:java="http://xml.apache.org/xslt/java"
xmlns:xlink="http://www.w3.org/1999/xlink"
onmousedown="evt.preventDefault();"
onmouseup="evt.preventDefault();keyboard.notifyMouse(evt);" onkeypress=""
height="678" width="802" zoomAndPan="disable">
	<script type="text/ecmascript" xlink:href="js/Functions.js"/>
	<script type="text/ecmascript" xlink:href="js/MouseAction.js"/>
	<script type="text/ecmascript" xlink:href="js/Button.js"/>
	<script type="text/ecmascript" xlink:href="js/ButtonContainer.js"/>
	<script type="text/ecmascript" xlink:href="js/Frame.js"/>
	<script type="text/ecmascript" xlink:href="js/Movie.js"/>
	<script type="text/ecmascript" xlink:href="js/SVGObject.js"/>
	<script type="text/ecmascript" xlink:href="js/Variable.js"/>
	<script type="text/ecmascript" xlink:href="js/VariablesVector.js"/>
	<script type="text/ecmascript" xlink:href="js/Label.js"/>
	<script type="text/ecmascript" xlink:href="js/TextBox.js"/>
	<script type="text/ecmascript" xlink:href="js/GlassRectangle.js"/>
	<script type="text/ecmascript" xlink:href="js/NodeBuilder.js"/>
	<script type="text/ecmascript" xlink:href="js/rtapi.js"/>
	<script type="text/ecmascript" xlink:href="js/ConfirmedPanel.js"/>
	<script type="text/ecmascript" xlink:href="js/Keyboard.js"/>
	<script type="text/ecmascript" xlink:href="js/Caret.js"/>
	<script type="text/ecmascript"
xlink:href="js/CustomKeyboardListener.js"/>
	<script type="text/ecmascript" xlink:href="js/CustomFunctions.js"/>
	<image height="76" width="802" y="0" x="0"
xlink:href="img/sfondo.png"/>
	<rect stroke-width="1" stroke="rgb(55,84,113)" fill="none"
height="601" width="801" y="76" x="0"/>
	<title/>

My applet downloads this file from server and then opens this file from the
hard drive.
It seems that when SVG rendering is complete and I start browsing this svg
using some JS functions, my applet opens an incredible number of TCP
connections just when a JS function is called (I think...). I've seen that
by monitoring with TCPView the number of connections opened.


Please note I'm quite new with batik and don't know if this problem is in
some way related to it. 

Best regards,
Massimo


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


R: R: batik opens too TCP connections?

Posted by Massimo Signori <si...@webscience.it>.
Hi Thomas,
Java classes are in the Applet Jar (I see them in java cache) and the applet
is called by a JSP.

This is a part of my JSP:

<%@page contentType="text/html" import="java.util.Vector,player.dao.bean.*"
%>

<jsp:useBean id="testForPlayer" scope="request"
class="player.dao.bean.TestForPlayer" />     
<jsp:useBean id="appletConfig" scope="request"
class="player.dao.bean.AppletConfig" />     

<html>
<html>
<head>
<title>JSP Page</title>
		<script language="javascript">
		
		function unloadApplet() {
			window.close();
		}
				
		</script>
	</head>


<body>
<applet codebase= "../JSP/"
               id = "qcocorrector"
               name = "qcocorrector"
               code = "qcocorrector.view.MainApplet.class"
               ARCHIVE="qcocorrector.jar, 
    		simeditor.jar,
    		batik-all.jar, 
		commons-httpclient-2.0.jar, 
		commons-logging-api.jar, 
		jaxen-core.jar,
		jaxen-jdom.jar,
		jdom.jar,
		js.jar,
		genutils-last.jar,
		keyManagerInterface.jar,
		keyManagerClientInterface.jar,
		log4j-1.2.8.jar,
		qcoUploader.jar,
		rtqcoplayer.jar,
		saxpath.jar, 
		xerces.jar,
                webECDLplaf.jar,jhall.jar,
		SimplyHTML.jar,
		validator.jar


as you see jars are loaded... 
the only piece of code that interacts with server is this:

try {
            URL url = new URL(remoteFile);
            
            URLConnection yc = url.openConnection();
            InputStream in = yc.getInputStream();
            logger.debug("reading from url... " + remoteFile);
            //InputStream in = url.openStream();
            
            logger.debug("writing file " + remoteFile + "...");
            FileOutputStream out = new FileOutputStream(savePath);
            byte[] buffer = new byte[4096];
            int len = 0;
            while ((len = in.read(buffer)) > 0) {
                out.write(buffer, 0, len);
            }
            
            in.close();
            out.close();
            logger.debug("stream closed");
                    }
        catch (MalformedURLException e) {
            logger.debug("new URL() failed");
            e.printStackTrace();
        }
        catch (IOException e) {
            logger.debug("openConnection() failed");
            e.printStackTrace();
        }

Kind regards,
Massimo


-----Messaggio originale-----
Da: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com] 
Inviato: mercoledì 27 ottobre 2004 14.12
A: Batik Users
Oggetto: Re: R: batik opens too TCP connections?

Hi Massimo,

Massimo Signori wrote:

> Thank you Thomas, i guess you're right. Let me know if I'm right now :)
> This is what my applet does:
> 
> 1. downloads a zip file from server in which there are the SVG and the JS
> files
> 
> 2. saves and unzip this zip file in a local directory
> 
> 3. loads the SVG in browser
> 
> 4. at this point I can make some svg browsing using some js functions
> 
> 5. these js functions use rhino to call some java classes
> 
> You are telling me that calling java classes on server causes this opening
> of so many TCP connections, aren't you?

    Are the Java class in the Applet Jar(s)?  If so it shouldn't
hit the server.

> It seems that Tomcat doesn't log this passage... you know if there is a
> possible solution? 

    Is Tomcat acting as your http server as well?  Or do you mean that
the 'calling java classes' is calling a JSP or the like?  You
should be able to add System.err.println statements to get an idea
when you are contacting the server in your code.

    You might also want to discuss with Bartosz since he seems to
be having a similar issue with Batik in an Applet.


> Thank you very much for your help,
> Kind regards
> Massimo
> 
> -----Messaggio originale-----
> Da: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com] 
> Inviato: martedì 26 ottobre 2004 15.43
> A: Batik Users
> Oggetto: Re: batik opens too TCP connections?
> 
> Massimo Signori wrote:
> 
> 
>>Hi everybody, i'm using batik to display an SVG in my java applet. This
> 
> SVG
> 
>>contains some links to javascript functions as shown:
> 
> 
> [...]
> 
> 
>>My applet downloads this file from server and then opens this file from
> 
> the
> 
>>hard drive.
>>It seems that when SVG rendering is complete and I start browsing this svg
>>using some JS functions, my applet opens an incredible number of TCP
>>connections just when a JS function is called (I think...). I've seen that
>>by monitoring with TCPView the number of connections opened.
> 
> 
>    Can you tell what it's opening (I assume it's requesting classes
> from the originating server).  I would suspect that this is caused by
> Rhino, it allows you to access Java classes from JavaScript, however
> usually this only happens when you want it to.  You might be able
> to find something 'odd' in your JS by looking at the server logs to
> know what it is requesting (if it's requesting a class in something
> like a mouseover handler it could open lots of connections in a short
> period).
> 
> 
>>Please note I'm quite new with batik and don't know if this problem is in
>>some way related to it. 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 



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



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


Re: R: batik opens too TCP connections?

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Massimo,

Massimo Signori wrote:

> Thank you Thomas, i guess you're right. Let me know if I'm right now :)
> This is what my applet does:
> 
> 1. downloads a zip file from server in which there are the SVG and the JS
> files
> 
> 2. saves and unzip this zip file in a local directory
> 
> 3. loads the SVG in browser
> 
> 4. at this point I can make some svg browsing using some js functions
> 
> 5. these js functions use rhino to call some java classes
> 
> You are telling me that calling java classes on server causes this opening
> of so many TCP connections, aren't you?

    Are the Java class in the Applet Jar(s)?  If so it shouldn't
hit the server.

> It seems that Tomcat doesn't log this passage... you know if there is a
> possible solution? 

    Is Tomcat acting as your http server as well?  Or do you mean that
the 'calling java classes' is calling a JSP or the like?  You
should be able to add System.err.println statements to get an idea
when you are contacting the server in your code.

    You might also want to discuss with Bartosz since he seems to
be having a similar issue with Batik in an Applet.


> Thank you very much for your help,
> Kind regards
> Massimo
> 
> -----Messaggio originale-----
> Da: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com] 
> Inviato: martedì 26 ottobre 2004 15.43
> A: Batik Users
> Oggetto: Re: batik opens too TCP connections?
> 
> Massimo Signori wrote:
> 
> 
>>Hi everybody, i'm using batik to display an SVG in my java applet. This
> 
> SVG
> 
>>contains some links to javascript functions as shown:
> 
> 
> [...]
> 
> 
>>My applet downloads this file from server and then opens this file from
> 
> the
> 
>>hard drive.
>>It seems that when SVG rendering is complete and I start browsing this svg
>>using some JS functions, my applet opens an incredible number of TCP
>>connections just when a JS function is called (I think...). I've seen that
>>by monitoring with TCPView the number of connections opened.
> 
> 
>    Can you tell what it's opening (I assume it's requesting classes
> from the originating server).  I would suspect that this is caused by
> Rhino, it allows you to access Java classes from JavaScript, however
> usually this only happens when you want it to.  You might be able
> to find something 'odd' in your JS by looking at the server logs to
> know what it is requesting (if it's requesting a class in something
> like a mouseover handler it could open lots of connections in a short
> period).
> 
> 
>>Please note I'm quite new with batik and don't know if this problem is in
>>some way related to it. 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 



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


R: batik opens too TCP connections?

Posted by Massimo Signori <si...@webscience.it>.
Thank you Thomas, i guess you're right. Let me know if I'm right now :)
This is what my applet does:

1. downloads a zip file from server in which there are the SVG and the JS
files

2. saves and unzip this zip file in a local directory

3. loads the SVG in browser

4. at this point I can make some svg browsing using some js functions

5. these js functions use rhino to call some java classes

You are telling me that calling java classes on server causes this opening
of so many TCP connections, aren't you?
It seems that Tomcat doesn't log this passage... you know if there is a
possible solution? 

Thank you very much for your help,
Kind regards
Massimo

-----Messaggio originale-----
Da: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com] 
Inviato: martedì 26 ottobre 2004 15.43
A: Batik Users
Oggetto: Re: batik opens too TCP connections?

Massimo Signori wrote:

> Hi everybody, i'm using batik to display an SVG in my java applet. This
SVG
> contains some links to javascript functions as shown:

[...]

> My applet downloads this file from server and then opens this file from
the
> hard drive.
> It seems that when SVG rendering is complete and I start browsing this svg
> using some JS functions, my applet opens an incredible number of TCP
> connections just when a JS function is called (I think...). I've seen that
> by monitoring with TCPView the number of connections opened.

   Can you tell what it's opening (I assume it's requesting classes
from the originating server).  I would suspect that this is caused by
Rhino, it allows you to access Java classes from JavaScript, however
usually this only happens when you want it to.  You might be able
to find something 'odd' in your JS by looking at the server logs to
know what it is requesting (if it's requesting a class in something
like a mouseover handler it could open lots of connections in a short
period).

> Please note I'm quite new with batik and don't know if this problem is in
> some way related to it. 


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



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


Re: batik opens too TCP connections?

Posted by Thomas DeWeese <Th...@Kodak.com>.
Massimo Signori wrote:

> Hi everybody, i'm using batik to display an SVG in my java applet. This SVG
> contains some links to javascript functions as shown:

[...]

> My applet downloads this file from server and then opens this file from the
> hard drive.
> It seems that when SVG rendering is complete and I start browsing this svg
> using some JS functions, my applet opens an incredible number of TCP
> connections just when a JS function is called (I think...). I've seen that
> by monitoring with TCPView the number of connections opened.

   Can you tell what it's opening (I assume it's requesting classes
from the originating server).  I would suspect that this is caused by
Rhino, it allows you to access Java classes from JavaScript, however
usually this only happens when you want it to.  You might be able
to find something 'odd' in your JS by looking at the server logs to
know what it is requesting (if it's requesting a class in something
like a mouseover handler it could open lots of connections in a short
period).

> Please note I'm quite new with batik and don't know if this problem is in
> some way related to it. 


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