[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jetspeed-user
Subject:    Getting a jndi URL from JetspeedResources.properties
From:       "Daniel Farinha" <daniel () ktorn ! com>
Date:       2004-05-26 18:18:41
Message-ID: 20040526181727.A428D80C3F () mail2 ! ktorn ! com
[Download RAW message or body]

I'm trying to get a jndi URL to a local directory from JetspeedResources.
Ultimately this URL is to be used to read the contents of files from that
directory (using JetspeedDiskCache.getEntry()).

In JetspeedResources.properties I have:

mydir.url=/WEB-INF/mydir/staticfiles/

In the code I then do:

String dir = JetspeedResources.getString("mydir.url");

dir = TurbineServlet.getRealPath(dir);

dir += "somestaticfile.txt";

// at this stage dir is the full path to the directory
(c:\tomcat\jetspeed\WEB-INF\mydir\etc)

URL url = new URL(dir);    
        
Reader rdr = JetspeedDiskCache.getInstance()
    .getEntry( url.toString() ).getReader();

// then read file contents

---------------

My problem is in converting the path to a URL. I would normally read the URL
from a portlet's URL property (which is then of protocol "jndi") but I'm now
using an ActionEvent and don't have any other way of specifing the dir path.

Is there a neat way of getting a URL from a dir path, that can be used in
the JetspeedDiskCache.getEntry(), i.e with the JNDI protocol?

Regards

Daniel


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic