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 Steven Vetzal <st...@threewisemen.ca> on 2007/02/01 12:59:03 UTC

URIResolver and Batik

Hi All,

I want to make local graphics from our JSR170 repository available  
using the <svg:image> tag. While I can do this neatly using Apache  
FOP using my own URIResolver, I can't find any way to do this same  
thing with Batik.

Has anyone out there attempted attaching a custom URIResolver or  
otherwise hooked into the URI lookups in Batik? What approach did you  
take?

Thanks!

Steve


-- 
Steven Vetzal <st...@threewisemen.ca>
President
Three Wise Men Software Development and Consulting
http://www.threewisemen.ca/

+1 905 436 2319 x 204 (Oshawa)
+1 416 848 0709 x 204 (Toronto)
+1 905 436 2319 (Fax)

--
Mark Your Calendars: March 23 & 24, 2007 - Metro East Information and  
Technology Trade Exhibit - Showcasing IT in Durham ( http:// 
metroeastit.ca )




RE: URIResolver and Batik

Posted by Peter <pc...@gmail.com>.
Thanks..I was afraid this was going to be the "solution".

 

Peter

 

  _____  

From: archie.cobbs@gmail.com [mailto:archie.cobbs@gmail.com] On Behalf Of
Archie Cobbs
Sent: Thursday, June 28, 2007 4:17 PM
To: batik-users@xmlgraphics.apache.org
Subject: Re: URIResolver and Batik

 

On 6/27/07, thomas.deweese@kodak.com <th...@kodak.com> wrote:

   Essentially you can use the current Thread as a key to
a HashTable to lookup the context in your resolver.  You can 
also subclass Thread to add this information as well (Although
that might be tricky in a Servlet).


Or, just use a java.lang.ThreadLocal  :-)


__________________________________________________________________________ 
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com 


Re: URIResolver and Batik

Posted by Archie Cobbs <ar...@awarix.com>.
On 6/27/07, thomas.deweese@kodak.com <th...@kodak.com> wrote:
>
>    Essentially you can use the current Thread as a key to
> a HashTable to lookup the context in your resolver.  You can
> also subclass Thread to add this information as well (Although
> that might be tricky in a Servlet).


Or, just use a java.lang.ThreadLocal  :-)

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com

Re: URIResolver and Batik

Posted by th...@kodak.com.
Hi Peter,

   Let me start by saying that this is ugly but will work...

   Essentially you can use the current Thread as a key to
a HashTable to lookup the context in your resolver.  You can
also subclass Thread to add this information as well (Although
that might be tricky in a Servlet).

   As a total aside, I've come around to the belief that you need
to pass context information to the URL classes for them to be
fully functional.  It's a shame we don't...

Peter Coppens <pc...@gmail.com> wrote on 06/27/2007 04:57:27 
AM:

> Could one use the ParsedURL approach to have a different URI resolution
> mechanism for each "rendering" invocation of Batik in a multi threaded
> server environment.
> 
> I was using
>     ParsedURL.registerHandler(myUriResolver);
> 
> but I guess that won't work in a multi threaded environment.
> 
> The need arises because I want to support relative uri's for e.g.
> svg:image's where the href's should be resolved relative to a path that 
is
> different for each user of the (servlet) service.
> 
> What would be my options?
> 
> Thanks
> 
> Peter
> 
> 
> thomas.deweese wrote:
> > 
> > Hi Steven,
> > 
> > Steven Vetzal <st...@threewisemen.ca> wrote on 02/01/2007 06:59:03 AM:
> > 
> >> I want to make local graphics from our JSR170 repository available 
> >> using the <svg:image> tag. While I can do this neatly using Apache 
> >> FOP using my own URIResolver, I can't find any way to do this same 
> >> thing with Batik.
> > 
> >    Correct we aren't tied into the URIResolver stuff.
> > 
> >> Has anyone out there attempted attaching a custom URIResolver or 
> >> otherwise hooked into the URI lookups in Batik? What approach did you 

> > take?
> > 
> >    All of our URI lookups go through our local class 
> > "batik.util.ParsedURL" which roughly replaces java.net.URL.  It 
> > has the ability to specify custom protocols which you might use 
> > to redirect lookups to your URI resolver.
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: 
batik-users-help@xmlgraphics.apache.org
> > 
> > 
> > 
> 
> 
> 
> 
> -- 
> View this message in context: http://www.nabble.com/URIResolver-and-
> Batik-tf3154421.html#a11320753
> Sent from the Batik - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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: URIResolver and Batik

Posted by Peter Coppens <pc...@gmail.com>.
Could one use the ParsedURL approach to have a different URI resolution
mechanism for each "rendering" invocation of Batik in a multi threaded
server environment.

I was using

    ParsedURL.registerHandler(myUriResolver);

but I guess that won't work in a multi threaded environment.

The need arises because I want to support relative uri's for e.g.
svg:image's where the href's should be resolved relative to a path that is
different for each user of the (servlet) service.

What would be my options?

Thanks

Peter


thomas.deweese wrote:
> 
> Hi Steven,
> 
> Steven Vetzal <st...@threewisemen.ca> wrote on 02/01/2007 06:59:03 AM:
> 
>> I want to make local graphics from our JSR170 repository available 
>> using the <svg:image> tag. While I can do this neatly using Apache 
>> FOP using my own URIResolver, I can't find any way to do this same 
>> thing with Batik.
> 
>    Correct we aren't tied into the URIResolver stuff.
> 
>> Has anyone out there attempted attaching a custom URIResolver or 
>> otherwise hooked into the URI lookups in Batik? What approach did you 
> take?
> 
>    All of our URI lookups go through our local class 
> "batik.util.ParsedURL" which roughly replaces java.net.URL.  It 
> has the ability to specify custom protocols which you might use 
> to redirect lookups to your URI resolver.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> 




-- 
View this message in context: http://www.nabble.com/URIResolver-and-Batik-tf3154421.html#a11320753
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: URIResolver and Batik

Posted by th...@kodak.com.
Hi Steven,

Steven Vetzal <st...@threewisemen.ca> wrote on 02/01/2007 06:59:03 AM:

> I want to make local graphics from our JSR170 repository available 
> using the <svg:image> tag. While I can do this neatly using Apache 
> FOP using my own URIResolver, I can't find any way to do this same 
> thing with Batik.

   Correct we aren't tied into the URIResolver stuff.

> Has anyone out there attempted attaching a custom URIResolver or 
> otherwise hooked into the URI lookups in Batik? What approach did you 
take?

   All of our URI lookups go through our local class 
"batik.util.ParsedURL" which roughly replaces java.net.URL.  It 
has the ability to specify custom protocols which you might use 
to redirect lookups to your URI resolver.


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