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 Sebastien Just <se...@free.fr> on 2004/08/07 15:44:01 UTC

Java applet for browser integration using Batik

Hi,

I'm currently working on a web application whose needs can be fullfilled with a SVG plugin.
I didn't currently found a correct SVG plugin displaying SVG because :
- all plugin doesn't work on all browsers
- are difficult to install for end-user
- doesn't interpret SVG the same way ... so I can't rely on them for displaying business data and have the same behaviour.

So I started to look after Batik and JSVGCanvas and made an applet which displays SVG.
The goal is to take all the necessary jar files and make a "bigger" jar so that the usage is as simple as possible. 

Altough quite difficult I  managed to do so, so an example for usage is :

<applet width="600" height="600" code="SVGApplet.class" 
	archive="jsvgapplet.jar">
	<param name="fileName" value="http://192.168.0.1/images/catalogueDate.svg" />
</applet>

It works fine under IE / Mozilla / Thunderbird and can display all SVG Files batik is able to.

Last problemes are : 
- do I really need to sign the applet ( if I do not I cannot use ecmascript) ? 
- 5Mo is a bit heavy for an applet ... are

Future improvements :
- make applet communicate with the browser DOM so that the HTML side can interact with SVG Applet .

So is anyone interested in this work ?
Has anybody made this before (so this work is maybe useless) ? 
What do u think about it ?

Sebastien

NB : sorry for my poor english




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


Re: Java applet for browser integration using Batik

Posted by Thomas DeWeese <Th...@Kodak.com>.
 >From: Sebastien Just <se...@free.fr>
 >>
 >> I'm currently working on a web application whose needs can be
 >> fullfilled with a SVG plugin.


 >> Last problemes are :
 >> - do I really need to sign the applet
 >>   ( if I do not I cannot use ecmascript) ?


    No you should not have to sign the applet.  As Stan referenced,
the easiest and in your case probably best solution to this problem is
to remove the  org/mozilla/javascript/optimizer directory from the
lib/js.jar jar file.  While you are at it you might also want to
remove the tools directory as well.

    It has been reported that this works although I myself have
never tried it.


 >> - 5Mo is a bit heavy for an applet ... are


     Tonny already gave a bunch of good ideas for stripping down
the size of the applet.  You could probably go further but if
this is _really_ of interest you might consider using a tool that
is designed to pack down and strip java for applet distribution.


 >> Future improvements :
 >> - make applet communicate with the browser DOM so that the HTML side
 >>   can interact with SVG Applet .
 >>
 >> So is anyone interested in this work ?

     It does sound interesting.  What would probably be most
interesting would be a patch to the build.xml file that
builds a JSVGCanvas applet jar, stripping out as much code
as possible.  Then even if people wanted something slightly
different they would have a solid starting point.  Of course
for this to be really useful a test to ensure that everything
needed was included probably needs to be written...


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


Re: Java applet for browser integration using Batik

Posted by Stan Dickerson <en...@energycontrolsystems.com>.
For ecmascript without applet signing, there was a thread in January on
the Batik Users' List.  Search message bodies for "optimizer" and
message subjects for "Rhino".

Stan Dickerson

On Sat, 2004-08-07 at 09:44, Sebastien Just wrote:
> Hi,
> 
> I'm currently working on a web application whose needs can be fullfilled with a SVG plugin.
> I didn't currently found a correct SVG plugin displaying SVG because :
> - all plugin doesn't work on all browsers
> - are difficult to install for end-user
> - doesn't interpret SVG the same way ... so I can't rely on them for displaying business data and have the same behaviour.
> 
> So I started to look after Batik and JSVGCanvas and made an applet which displays SVG.
> The goal is to take all the necessary jar files and make a "bigger" jar so that the usage is as simple as possible. 
> 
> Altough quite difficult I  managed to do so, so an example for usage is :
> 
> <applet width="600" height="600" code="SVGApplet.class" 
> 	archive="jsvgapplet.jar">
> 	<param name="fileName" value="http://192.168.0.1/images/catalogueDate.svg" />
> </applet>
> 
> It works fine under IE / Mozilla / Thunderbird and can display all SVG Files batik is able to.
> 
> Last problemes are : 
> - do I really need to sign the applet ( if I do not I cannot use ecmascript) ? 
> - 5Mo is a bit heavy for an applet ... are
> 
> Future improvements :
> - make applet communicate with the browser DOM so that the HTML side can interact with SVG Applet .
> 
> So is anyone interested in this work ?
> Has anybody made this before (so this work is maybe useless) ? 
> What do u think about it ?
> 
> Sebastien
> 
> NB : sorry for my poor english
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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: Java applet for browser integration using Batik

Posted by George Armhold <ar...@cs.rutgers.edu>.
Thomas DeWeese wrote:

 > There are a couple of ways to do this.  One is to override
 > bridge.UserAgent.getXMLParserClassName to return the name of any
 > SAX2 parser.

Hi Thomas.  I actually took the approach of including my own
org/apache/batik/util/resources/XMLResourceDescriptor.properties in my
project's jar file.

 > The default implementation looks at:
 > batik/util/resources/XMLResourceDescriptor.properties for the
 > "org.xml.sax.driver" property.  I think the JVM parser is
 > "javax.xml.parsers.SAXParser"

That didn't work for me, I had to use
org.apache.crimson.parser.XMLReaderImpl.  This seemed to work fine for
part of my application.  However with one of our tools I get the
following stacktrace.  Any idea what this could be about?  Is there
some other resource I need to change?


java.io.IOException: Illegal Namespace prefix: "xml".
	at 
org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:418)
	at 
org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:341)
	at 
org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(SAXSVGDocumentFactory.java:228)
	at 
edu.rutgers.elearning.scribble.ScribbleRecorder.<init>(ScribbleRecorder.java:99)
	at edu.rutgers.elearning.presenter.Presenter.<init>(Presenter.java:196)
	at edu.rutgers.elearning.presenter.Presenter.main(Presenter.java:1071)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at com.sun.javaws.Launcher.executeApplication(Launcher.java:837)
	at com.sun.javaws.Launcher.executeMainClass(Launcher.java:797)
	at com.sun.javaws.Launcher.continueLaunch(Launcher.java:675)
	at com.sun.javaws.Launcher.handleApplicationDesc(Launcher.java:390)
	at com.sun.javaws.Launcher.handleLaunchFile(Launcher.java:199)
	at com.sun.javaws.Launcher.run(Launcher.java:167)
	at java.lang.Thread.run(Thread.java:534)


Thanks.

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


Re: Java applet for browser integration using Batik

Posted by Thomas DeWeese <Th...@Kodak.com>.
George Armhold wrote:
> Tonny Kohar wrote:
> 
>  > - if the client have their own xml parses eg: JVM 1.4 or higher you
>  > can exclude xerces and use that parser with some properties files
>  > modification.
> 
> Tonny, this sound very interesting.  Do you have a "recipe" for how to
> make this work?

    There are a couple of ways to do this.  One is to override
bridge.UserAgent.getXMLParserClassName to return the name of
any SAX2 parser.  The default implementation looks at:

    batik/util/resources/XMLResourceDescriptor.properties
for the "org.xml.sax.driver" property.  I think the JVM parser is
"javax.xml.parsers.SAXParser"


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


Re: Java applet for browser integration using Batik

Posted by George Armhold <ar...@cs.rutgers.edu>.
Tonny Kohar wrote:

 > - if the client have their own xml parses eg: JVM 1.4 or higher you
 > can exclude xerces and use that parser with some properties files
 > modification.

Tonny, this sound very interesting.  Do you have a "recipe" for how to
make this work?

And to the original poster- you might want to investigate
http://proguard.sourceforge.net for generating a minimal jar file that
contains everything you need.  I haven't had time to fully evaluate
this yet, but it looks promising.

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


Re: Java applet for browser integration using Batik

Posted by Tonny Kohar <to...@kiyut.com>.
Hi,

> - 5Mo is a bit heavy for an applet ... are

You can cut down batik size
- if you do not need pdftranscoder, exclude it from the jar
- if you only use it for display, I think you can exclude svggenerator
- if the client have their own xml parses eg: JVM 1.4 or higher you can
exclude xerces and use that parser with some properties files
modification.

or You can use Java Webstart, it only download the whole bunch one time
after that it only download if version change.

Best Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com



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