You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Rob Norman <ro...@harveyroad.org> on 2005/09/28 11:58:44 UTC
PropertiesFileModule
Hi,
I'm having problems with the PropertiesFileModule in Cocoon 2.1.7 under
Tomcat 5.0. I'm trying to load a simple properties file from a cocoon
matcher (the URI in the cocoon.xconf is cocoon:/config.properties) I
figured that since it uses a SourceResolver and the examples use
resource:/, it should work. However, it keeps saying "Cannot load
properties file".
I then changed it to not have the cocoon:/ on the front so it was simply
specifying a file and that doesn't work either. I have the appropriate
file in the root of my webapp and in the WEB-INF directory and it still
can't find the file.
Can someone tell me where the file needs to be (or even better, how to
specify that it's in the WEB-INF directory) please?
Cheers,
Rob.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: PropertiesFileModule
Posted by Geert Josten <Ge...@daidalos.nl>.
You have written a cocoon matcher yourself? Can you delay the moment you are reading the config
file? I recall a setup function that is executed at loading, a configure that is executed at reading
(changed) sitemap and of course the match function itself. (correct me if i'm wrong, writing this
from the top of my head.) You might consider reading the config file each time a match is evaluated.
I'm not certain this will help you, but might be worth a try..
Cheers,
Geert
Rob Norman wrote:
> Thanks for the quick response. I tried using
> "context:/config.properties" in cocoon.xconf and that works for loading
> the file directly from WEB-INF.
>
> However, cocoon:/ doesn't work. I have a matcher in my sitemap that
> matches on config.properties (I can load it from the browser using the
> appropriate URL ok) but it doesn't want to work in the xconf. I'm
> gussing this is because the sitemap isn't properly loaded when cocoon
> reaches that part in it's initialisation. The problem is that I need to
> change config files depending on what host the user is loading the page
> from so I need to use the matcher.
>
> Cheers,
> Rob.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: PropertiesFileModule
Posted by Rob Norman <ro...@harveyroad.org>.
Thanks for the quick response. I tried using
"context:/config.properties" in cocoon.xconf and that works for loading
the file directly from WEB-INF.
However, cocoon:/ doesn't work. I have a matcher in my sitemap that
matches on config.properties (I can load it from the browser using the
appropriate URL ok) but it doesn't want to work in the xconf. I'm
gussing this is because the sitemap isn't properly loaded when cocoon
reaches that part in it's initialisation. The problem is that I need to
change config files depending on what host the user is loading the page
from so I need to use the matcher.
Cheers,
Rob.
> Hi,
>
> cocoon:/ represents the url part that matches your sitemap. cocoon://
> represents the root url for cocoon. note that when using cocoon: you
> need to have a match pattern that catches you request. In your case,
> you need a match for "config.properties".
>
> Alternatively, you could use context:/ (or was it context://?) which
> refers to the webapp _directory_ of cocoon.
>
> Refrain from using file: protocol when accessing files from within the
> webapp or web-inf. When you deploy the web application as a war and it
> is _not_ extracted but read directly by the application server, this
> results in file not found errors... :-P
>
> HTH,
> Geert
>
> Rob Norman wrote:
>
>> Hi,
>>
>> I'm having problems with the PropertiesFileModule in Cocoon 2.1.7
>> under Tomcat 5.0. I'm trying to load a simple properties file from a
>> cocoon matcher (the URI in the cocoon.xconf is
>> cocoon:/config.properties) I figured that since it uses a
>> SourceResolver and the examples use resource:/, it should work.
>> However, it keeps saying "Cannot load properties file".
>>
>> I then changed it to not have the cocoon:/ on the front so it was
>> simply specifying a file and that doesn't work either. I have the
>> appropriate file in the root of my webapp and in the WEB-INF
>> directory and it still can't find the file.
>>
>> Can someone tell me where the file needs to be (or even better, how
>> to specify that it's in the WEB-INF directory) please?
>>
>> Cheers,
>> Rob.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: PropertiesFileModule
Posted by Geert Josten <Ge...@daidalos.nl>.
>>Refrain from using file: protocol when accessing files from within the webapp or web-inf. When you
>>deploy the web application as a war and it is _not_ extracted but read directly by the application
>>server, this results in file not found errors... :-P
>
> Sorry to come back to an old thread, but I was wondering which
> application server is able to read directly from war, without
> extracting it when deploying a web application? Are Tomcat or Jetty
> able to do that? Where can I find out about this feature?
I have no real experience, but an application server is not obligated to extract the war instead of
reading it directly. I have worked recently with Oracle Application Server, but I believe that
extracts the war as well.
How to find out about the feature? Really don't know. It is an implementation detail you shouldn't
be caring about.. ;-)
Regards,
Geert
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: PropertiesFileModule
Posted by Fiouz <fi...@gmail.com>.
On 9/28/05, Geert Josten <Ge...@daidalos.nl> wrote:
> Refrain from using file: protocol when accessing files from within the webapp or web-inf. When you
> deploy the web application as a war and it is _not_ extracted but read directly by the application
> server, this results in file not found errors... :-P
Hi,
Sorry to come back to an old thread, but I was wondering which
application server is able to read directly from war, without
extracting it when deploying a web application? Are Tomcat or Jetty
able to do that? Where can I find out about this feature?
Cheers,
--
Fiouz
Re: PropertiesFileModule
Posted by Geert Josten <Ge...@daidalos.nl>.
Hi,
cocoon:/ represents the url part that matches your sitemap. cocoon:// represents the root url for
cocoon. note that when using cocoon: you need to have a match pattern that catches you request. In
your case, you need a match for "config.properties".
Alternatively, you could use context:/ (or was it context://?) which refers to the webapp
_directory_ of cocoon.
Refrain from using file: protocol when accessing files from within the webapp or web-inf. When you
deploy the web application as a war and it is _not_ extracted but read directly by the application
server, this results in file not found errors... :-P
HTH,
Geert
Rob Norman wrote:
> Hi,
>
> I'm having problems with the PropertiesFileModule in Cocoon 2.1.7 under
> Tomcat 5.0. I'm trying to load a simple properties file from a cocoon
> matcher (the URI in the cocoon.xconf is cocoon:/config.properties) I
> figured that since it uses a SourceResolver and the examples use
> resource:/, it should work. However, it keeps saying "Cannot load
> properties file".
>
> I then changed it to not have the cocoon:/ on the front so it was simply
> specifying a file and that doesn't work either. I have the appropriate
> file in the root of my webapp and in the WEB-INF directory and it still
> can't find the file.
>
> Can someone tell me where the file needs to be (or even better, how to
> specify that it's in the WEB-INF directory) please?
>
> Cheers,
> Rob.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
--
Drs. G.P.H. Josten
Consultant
Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665 JZ Bleiswijk
Tel: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is
uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken
wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org