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 Gregory <de...@yahoo.com> on 2005/07/05 06:25:56 UTC
Re: Custom protocol for pulling images from a db [SOLVED]
I just found the solution:
1- Create a custom ParsedURLData;
2- Create a custom ParsedURLProtocolHandler. I
override the parseURL methods and use a default
constructor that set the protocol field.
3- ParsedURL.registerHandler(new
CustumParsedURLProtocolHandler());
--- Gregory <de...@yahoo.com> wrote:
> Hi,
>
> I would like to use a custom protocol to pull binary
> data from a database. For example, I could have
> something like:
> <image x="0" y="0" width="612" height="792"
> xlink:href="db:/project.one/images/nice-pic.png"/>
> With that kind of href, I can return an InputStream
> that could be used by the transcoder.
>
> I have read
>
http://xml.apache.org/batik/extendingBatik.html#urlProtocols
> and read the docs of ParsedURL and the like.
>
>
> Can someone give me some details? Which classes do I
> need to extend? How do I make the new recognized by
> the transcoder. I have seen ParsedURL
> ParsedURL.registerHandler(ParsedURLProtocolHandler)
> but I don't see how to get there.
>
> I have tried to understand with trials/errors but
> some
> pointers, if possible a simple step by step how-to
> would be greatly appreciated.
>
>
> Thanks.
>
>
>
> __________________________________
> Discover Yahoo!
> Get on-the-go sports scores, stock quotes, news and
> more. Check it out!
> http://discover.yahoo.com/mobile.html
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>
>
____________________________________________________
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
http://football.fantasysports.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Transcoder, performance & thread safety
Posted by Gregory <de...@yahoo.com>.
Hi,
I have the following use case.
I have 10 base SVGDocument(s) that are made
essentially of a background <image/> and several
placeholders for text and other elements. All the base
documents have the same width, height and viewPort but
with different backgrounds and elements.
At any time the application needs to generate png
images from any base document but with custom text.
All generated image have the same width, height and
resolution.
Currently, when the application needs to generate a
custom image from a base document, it clones it,
update the placholders with the actual data and
transcode the new document.
What is the best strategy in term of performance and
thread safety?
1- Using the same transcoder for all the images?
2- Using a single transcoder for all the images
generated from a same base document (that is 10
different transcoders)?
3- Using a new transcoder each time I need a new
custom image because of potential thread safety
issues?
4- Any other solution...
Thanks
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: Custom protocol: batik vs. java API
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Gregory,
#1 is ok for applications but is incompatible with
Applets. This is the main reason Batik uses #2. Also
there are some things that are fairly annoying about
the java.net.URL class (it won't try and make sense of
'partial' URL's, always throwing errors etc).
Gregory wrote:
> I need to implement a custom protocol handler. I have
> tried two approaches:
>
> 1- The Java way:
> - extend java.net.URLStreamHandler
> - extend java.net.URLConnection
> - start java with the arg
> -Djava.protocol.handler.pkgs=my.handler.package
>
> or
>
> 2- The batik way:
> - create a custom ParsedURLData;
> - create a custom ParsedURLProtocolHandler.
> - ParsedURL.registerHandler(new
> CustomParsedURLProtocolHandler());
>
> Both seem to work fine with batik.
>
> I would prefer to use solution 1 because the custom
> protocol is used in other parts of my application.
>
> But is there a reason to prefer solution 2? Maybe in
> term or performance or to avoid some potential
> problems/exceptions?
>
>
> Thanks
>
>
>
> ____________________________________________________
> Start your day with Yahoo! - make it your home page
> http://www.yahoo.com/r/hs
>
>
> ---------------------------------------------------------------------
> 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
Custom protocol: batik vs. java API
Posted by Gregory <de...@yahoo.com>.
Hi,
I need to implement a custom protocol handler. I have
tried two approaches:
1- The Java way:
- extend java.net.URLStreamHandler
- extend java.net.URLConnection
- start java with the arg
-Djava.protocol.handler.pkgs=my.handler.package
or
2- The batik way:
- create a custom ParsedURLData;
- create a custom ParsedURLProtocolHandler.
- ParsedURL.registerHandler(new
CustomParsedURLProtocolHandler());
Both seem to work fine with batik.
I would prefer to use solution 1 because the custom
protocol is used in other parts of my application.
But is there a reason to prefer solution 2? Maybe in
term or performance or to avoid some potential
problems/exceptions?
Thanks
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org