cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Piroumian, Konstantin" <KPiroum...@flagship.ru>
Subject Context source
Date Wed, 05 Sep 2001 09:37:17 GMT
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


Mime
View raw message