cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robby Pelssers" <robby.pelss...@ciber.com>
Subject RE: Accessing resource from reader
Date Thu, 17 Sep 2009 13:21:36 GMT
Small correction:

importClass(Packages.java.io.File);

Function doSomeStuffWithConfigFile() {
    
    var pathToFile = ....;  //hard code it OR

    //you could configure some bean and do sth like ....
    /**
    var myBean = cocoon.getComponent("myBean");
    var pathToFile = myBean.getConfigFilePath();
    **/
    var file = new File(pathToFile);

    //...do some other stuff
}

-----Original Message-----
From: Robby Pelssers [mailto:robby.pelssers@ciber.com] 
Sent: Thursday, September 17, 2009 3:19 PM
To: users@cocoon.apache.org
Subject: RE: Accessing resource from reader

Not sure what you're trying to accomplish here but you can READ the file
from within the sitemap with flowscript:

      <map:match pattern="configfile">
        <map:call function="doSomeStuffWithConfigFile" />
      </map:match>

In flowscript:
----------------------------------------------------
importClass(Packages.java.io.File);

Function doSomeStuffWithConfigFile() {
    String pathToFile = ....;  //hard code it OR
    //you could configure some bean and do sth like ....
    /**
    var myBean = cocoon.getComponent("myBean");
    var configFilePath = myBean.getConfigFilePath();
    **/
    File file = new File(pathToFile);

    //...do some other stuff
}
----------------------------------------------------

Cheers,
Robby Pelssers

-----Original Message-----
From: Radaven [mailto:gagarin61@centrum.cz] 
Sent: Thursday, September 17, 2009 2:56 PM
To: users@cocoon.apache.org
Subject: Accessing resource from reader


Hi, I am working on my BarcodeImageReader which generates barcode image.
The
parameters of barcode are loaded from xml config file (saved on same
place
as other resources like jx templates, etc.). 

How can I get to this file to have it as java.io.File? I guess I cannot
use
something like 

File file = new File("barcode-cfg.xml");

Is there some getResource method or something like that available?
-- 
View this message in context:
http://www.nabble.com/Accessing-resource-from-reader-tp25490717p25490717
.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
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


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message