Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 42322 invoked by uid 500); 5 Sep 2001 09:38:10 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 42311 invoked from network); 5 Sep 2001 09:38:09 -0000 From: "Piroumian, Konstantin" To: cocoon-dev@xml.apache.org Message-ID: <0ce401c135ee$5a97a220$9d0a000a@flagship.ru> References: <999679606.3b95e67610911@mail.otego.com> Subject: Context source Date: Wed, 5 Sep 2001 13:37:17 +0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi, all! I am again bothering you with source resolution problems. As I could get from ContextURLFactory implementation, the 'context://' protocol is resolved as a resource source: -- ContextURLFactory.java -- ... 51. URL u = envContext.getResource("/" + location); ... This results in calling the HttpContext.getResource() (in case of servlet environment). This is fine for static resources, such as images etc., but it cannot be used for obtaining a dynamic content, such as a response from a JSP page. (This is also mentioned in Servlet 2.3 specification). For whatever reason the returned value is a system dependent path, and more over (although, I'm not sure about this), but it seems that the format is incorrect. Example: ... String contextDir = new File(httpContext.getRealPath("/")).toURL().toExternalForm(); System.out.println("--> context path: " + contextDir); String source = "context://jsp/index.jsp"; System.out.println("--> original source: " + source); Source src = this.resolver.resolve(this.source); System.out.println("--> resloved to " + src.getSystemId()); ... Output: --> context path: file:/D:/tomcat/webapps/cocoon2/ --> original source: context://jsp/welcome.jsp --> resloved to: file:D:\tomcat\webapps\cocoon2\jsp\welcome.jsp As you can see: file:D:\tomcat\webapps\cocoon2\jsp\welcome.jsp - is a system dependent path and there is no a leading '/' (or '\') before the drive name (compare with the context path). Are there any hints/comments/suggestions about this behavior? Of course, I can anylise the protocol myself, strip 'file:' part, append a '\', etc., but it's not the correct way, isn't it? I think, that the result of source resolution must be a correct system independent URL, or I am wrong? Thanks for any opinions. Regards, Konstantin Piroumian --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org