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:

<[EMAIL PROTECTED] 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:[EMAIL PROTECTED] 
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:[EMAIL PROTECTED] 
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to