Hi Tonny and Thomas, Thanks both for the comprehensive replies. I'll be putting it into practice later so I'll let the list know if this resolves my problem (which of course I'm sure it will!)
Thanks again, Dylan -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 21 April 2006 11:47 To: [email protected] Cc: [email protected] Subject: Re: CSS and JS being access as a webapp resource by SVG Hi Dylan, Tonny, To extend on Tonny's answer a little. In Batik all references are resolved relative to the Document's base URL (Document.getURL). The problem you have is that when you build the document 'in memory' it doesn't have any base URL. There are two main ways to 'fix' this. First is to give the Document a base url by calling: batik.dom.svg.SVGOMDocument.setURLObject This is a Batik specific method for providing the Document's base url. You can also set the 'xml:base' attribute on the root SVG element, which is a standard. Then the questions becomes what to set it too. I think you can get the URL of the servlet which would probably be a good choice. Tonny Kohar <[EMAIL PROTECTED]> wrote on 04/20/2006 10:59:10 PM: > For simple workaround in the client side, you could use baseURL on the > document to resolve the resources eg: css,js stuff, assuming that those > files are located in tree folder / directory structure inside the > baseURL. > > Regards > Tonny Kohar > -- > Sketsa > SVG Graphics Editor > http://www.kiyut.com > > On Thu, 2006-04-20 at 14:47 +0100, Dylan Browne wrote: > > Further to my original posting (which was resolved) I have another question > > regarding the locating of resources such as CSS/JS so that an SVG document > > (created in memory using the Batik DOM, and streamed via servlet to the > > browser) can access them. > > > > For example, I currently have the following set up: > > > > String CSS_LOCATION = "type=\"text/css\" href=\"file:///C:/SVG/style.css\""; > > > > This works fine locally. However, if this code were to be placed in a > > webapp, the only way this would work would be if I was accessing via a > > browser on the webserver itself. All remote access would obviously fail, > > (unless the referenced file also existed locally on the client). > > > > I understand that I could use something like: > > > > String CSS_LOCATION = "type=\"text/css\" href=\"http://myserver:123 > > /style.css\""; > > > > But then my deployment becomes dependant on server name and port number. > > > > Is there any way to make this reference to the location relative in the same > > way that my JSPs in this deployment have relative references to the same > > resources in the EAR file? For example: > > > > <script src="resources/js/common.js"></script> > > > > Thanks in advance for any help, > > > > Kind regards, > > > > Dylan B. > > > > > > > > > > --------------------------------------------------------------------- > > 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]
