think I have a solution:

I was loading the stylesheet in my sitemap using

<map:transform src="stylesheet.xsl"/>

I changed this to

<map:transform src="cocoon:/stylesheet.xsl"/>

and added 
<map:match pattern="*.xsl">
        <map:generate src="{1}.xsl"/>
        <map:serialize/>
</map:match>

I guess when you load the stylesheet using the cocoon protocol it sets
the proper protocol handler, versus when you directly access the
stylesheet as a file on disk.

Don't know if this is the best answer but at least it's a work around. 

-----Original Message-----
From: Simon Stanlake [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 24, 2006 10:51 AM
To: [email protected]
Subject: RE: using resource:// protocol

new and related problem: using the resource:// protocol from within a
stylesheet (using xsl:include). I get :

java.net.MalformedURLException: unknown protocol: resource 

the interesting part of the stack trace looks like...

        at java.net.URL.<init>(URL.java:574)
        at java.net.URL.<init>(URL.java:464)
        at java.net.URL.<init>(URL.java:413)
        at
org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown
Source)
        at
org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
        at
org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at
org.apache.xalan.processor.ProcessorInclude.parse(ProcessorInclude.java:
284)

There are numerous examples of using the resource:// protocol in
stylesheets in the samples, so there must be some way to get it to work.
I read something about setting the protocolhandler in tomcat (I'm using
version 5.5.9) in the dev mailing list, but the thread kinda stops
before an answer comes out.

Can anyone help?

thanks - simon


-----Original Message-----
From: Simon Stanlake [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 09, 2006 1:43 PM
To: [email protected]
Subject: RE: using resource:// protocol

That worked - thanks for your quick reply!

I had thought earlier that they would be pulled out of a jar file, and
was confused since the sample I was using (form.css) was in fact in a
jar file under the lib directory. The path however was
org/apache/cocoon/forms/resources/css/form.css, which obviously did not
match up with the path that my matcher would generate.

Thanks everyone for your help

Regards - simon

-----Original Message-----
From: Simone Gianni [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 09, 2006 1:26 PM
To: [email protected]
Subject: Re: using resource:// protocol

Hi Simon
the resource protocol gives access to the java resource system, that is
files which reside inside the classpath, so or packed in a jar or in a
"classes" directory.

In a web application context, this mean tou can put your files inside
the WEB-INF/classes/ directory, so for example :

tomcat
  webapps
    cocoon
      WEB-INF
        classes
          myresources
             mystyle.css

can then be access with resource://myresources/mystyle.css

OR, you can put them inside a jar, with all their folders, for example :

# jar -tf resjar.jar
/myresources/mystyle.css

The you put the jar in WEB-INF/lib/ and you can access them same as
above.

Mind that when accessing resources in a jar (and maybe also in the
classes directory), you will have probably to restart the server, or
reload the context or something similar to have them loaded correctly if
you modify them, but this depends on your container. With the default
jetty that comes with cocoon you have to reload it when you modify a
jar.


Regards,
Simone

--
Simone Gianni

Simon Stanlake wrote:

>Hi,
>I'm having trouble using the 'resource://' protocol from my web-app.
> 
>I've got the default cocoon web-app installed (2.1.8) on tomcat 5.5.9. 
>I have a sub-directory called myApp containing my application like:
>
>tomcat
>  |
>   ->webapps
>     |
>      ->cocoon
>          |
>           ->myApp
>
>I have copied some stuff from the samples in order to get cforms to 
>work.
>
>myApp/sitemap.xmap:
>
>       <map:pipeline>
>            <map:match pattern="resources/*/**">
>              <map:read
>src="resource://org/apache/cocoon/{1}/resources/{2}"/>
>            </map:match>
>       </map:pipeline>
>
>I then want to have stuff like CSS's in a resources folder. What I 
>don't understand is where to put the resources folder, and if I have to

>configure something else (in web.xml?) to get it to work.
>
>if I browse to http://localhost:8080/cocoon/myApp/resources/css/my.css
>I get "Resource Not Found". I've tried putting the css under...
>
>cocoon/resources/css
>cocoon/WEB-INF/resources/css
>cocoon/WEB-INF/css
>cocoon/myApp/resources/css
>
>all with no luck.
>
>I've stepped through all the ResourceReader code down until it passes 
>off to the Tomcat WebappClassLoader, which returns null.
>
>Thanks -
>Simon Stanlake
>
>---------------------------------------------------------------------
>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]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to