Re: Prob. referring XSL over URI (Pls. consider this out of conte xt p ost)
Dutta, Sumanta wrote: Thanks for the response. I understand that part of passing any URL, but my problem is, when I deploy the application, the XSLs get deployed under the httpRoot, and I want to read them without any specific reference to the deployment area(i.e. webserver, filesystem, etc.). My servlet is reading XSL filename (/x/y/z.xsl) from a file, but it don't know in advance where it will be deployed. If I understand you correctly, you can use getServletConfig().getRealPath("/x/y/z.xsl") to be independent of servlet context. public java.lang.String getRealPath(java.lang.String path) Returns a String containing the real path for a given virtual path. For example, the virtual path "/index.html" has a real path of whatever file on the server's filesystem would be served by a request for "/index.html". The real path returned will be in a form appropriate to the computer and operating system on which the servlet container is running, including the proper path separators. This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive). Parameters: path - a String specifying a virtual path Returns: a String specifying the real path, or null if the translation cannot be performed -- Oleg Tkachenko Multiconn International, Israel
RE: Prob. referring XSL over URI (Pls. consider this out of conte xt p ost)
I have the smae set up. I include the XSL in my application deployment and they are then available via my web server, i.e. http://mysite/mywebroot/xsl/stylesheet.xsl This makes the URI independent of the actual deployment directory. It is mapped by the deployment desciptor for my web root. /Dominic -Original Message- From: Dutta, Sumanta [mailto:[EMAIL PROTECTED] Sent: 22 May 2002 00:15 To: '[EMAIL PROTECTED]' Subject: RE: Prob. referring XSL over URI (Pls. consider this out of conte xt p ost) Thanks for the response. I understand that part of passing any URL, but my problem is, when I deploy the application, the XSLs get deployed under the httpRoot, and I want to read them without any specific reference to the deployment area(i.e. webserver, filesystem, etc.). My servlet is reading XSL filename (/x/y/z.xsl) from a file, but it don't know in advance where it will be deployed. I hope it's clear this time. Thanks again, Sumanta Dutta -Original Message- From: J.Pietschmann [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 21, 2002 5:54 PM To: [EMAIL PROTECTED] Subject: Re: Prob. referring XSL over URI (Pls. consider this out of context p ost) Dutta, Sumanta wrote: > I am trying to refer my XSL, which generates the FO, over a URI, relative to > my http codebase. If I create the XSL source by passing /x/y/z.xsl, the > transformer tries to find file://x/y/z.xsl. Is there any way to resolve this > in reference to my current http codebase. I tried to do get the servername > from http request, and append the URI, which is working in my local test > setup, but not good for actual installation, as requests may be coming > through different proxies. I suppose you are implementing a servlet. If you create the transformer yourself, you can pass any URL to the StreamSource for the XSL, including HTTP URLs. How you determine the URL is a matter of your servlet. I don't understand this part of the problem, usually servlets read XSL from files instead from HTTP requests. You'll have to supply some more details. J.Pietschmann -- This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice.
RE: Prob. referring XSL over URI (Pls. consider this out of conte xt p ost)
Thanks for the response. I understand that part of passing any URL, but my problem is, when I deploy the application, the XSLs get deployed under the httpRoot, and I want to read them without any specific reference to the deployment area(i.e. webserver, filesystem, etc.). My servlet is reading XSL filename (/x/y/z.xsl) from a file, but it don't know in advance where it will be deployed. I hope it's clear this time. Thanks again, Sumanta Dutta -Original Message- From: J.Pietschmann [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 21, 2002 5:54 PM To: [EMAIL PROTECTED] Subject: Re: Prob. referring XSL over URI (Pls. consider this out of context p ost) Dutta, Sumanta wrote: > I am trying to refer my XSL, which generates the FO, over a URI, relative to > my http codebase. If I create the XSL source by passing /x/y/z.xsl, the > transformer tries to find file://x/y/z.xsl. Is there any way to resolve this > in reference to my current http codebase. I tried to do get the servername > from http request, and append the URI, which is working in my local test > setup, but not good for actual installation, as requests may be coming > through different proxies. I suppose you are implementing a servlet. If you create the transformer yourself, you can pass any URL to the StreamSource for the XSL, including HTTP URLs. How you determine the URL is a matter of your servlet. I don't understand this part of the problem, usually servlets read XSL from files instead from HTTP requests. You'll have to supply some more details. J.Pietschmann -- This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice.
RE: Prob. referring XSL over URI (Pls. consider this out of conte xt p ost)
Thanks for your effective suggestion. My primary objective was to load XSL files independent of any deployment area. Thanks again, it will certainly help. Sumanta Dutta -Original Message- From: Jack Donohue [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 21, 2002 5:14 PM To: '[EMAIL PROTECTED]' Subject: RE: Prob. referring XSL over URI (Pls. consider this out of conte xt p ost) I don't know if this is the most efficient way, but this works for me: If your stylesheet is "/xsl/mystylesheet.xsl" String filename = Thread.currentThread().getContextClassLoader().getResource("/xsl/mystyleshee t.xsl").getFile(); template = TransformerFactory.newInstance().newTemplates(new StreamSource(new File(filename))); -Original Message- From: Dutta, Sumanta [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 21, 2002 1:58 PM To: '[EMAIL PROTECTED]' Subject: Prob. referring XSL over URI (Pls. consider this out of context p ost) I am trying to refer my XSL, which generates the FO, over a URI, relative to my http codebase. If I create the XSL source by passing /x/y/z.xsl, the transformer tries to find file://x/y/z.xsl. Is there any way to resolve this in reference to my current http codebase. I tried to do get the servername from http request, and append the URI, which is working in my local test setup, but not good for actual installation, as requests may be coming through different proxies. Any help will be highly appreciated. Thanks, Sumanta Dutta -- This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. -- This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice.
RE: Prob. referring XSL over URI (Pls. consider this out of conte xt p ost)
I don't know if this is the most efficient way, but this works for me: If your stylesheet is "/xsl/mystylesheet.xsl" String filename = Thread.currentThread().getContextClassLoader().getResource("/xsl/mystyleshee t.xsl").getFile(); template = TransformerFactory.newInstance().newTemplates(new StreamSource(new File(filename))); -Original Message- From: Dutta, Sumanta [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 21, 2002 1:58 PM To: '[EMAIL PROTECTED]' Subject: Prob. referring XSL over URI (Pls. consider this out of context p ost) I am trying to refer my XSL, which generates the FO, over a URI, relative to my http codebase. If I create the XSL source by passing /x/y/z.xsl, the transformer tries to find file://x/y/z.xsl. Is there any way to resolve this in reference to my current http codebase. I tried to do get the servername from http request, and append the URI, which is working in my local test setup, but not good for actual installation, as requests may be coming through different proxies. Any help will be highly appreciated. Thanks, Sumanta Dutta -- This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice.