commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <rgo...@apache.org>
Subject Re: Have Hit A Wall
Date Tue, 27 Apr 2010 04:49:22 GMT
All requests for help should go to the commons user list. Please don't email me privately.

The way I use VFS is the same way it is done in the unit tests:

        WebdavFileSystemConfigBuilder builder =
            (WebdavFileSystemConfigBuilder)manager.getFileSystemConfigBuilder("webdav");
        final String uri = System.getProperty(TEST_URI);
        FileSystemOptions opts = new FileSystemOptions();
        builder.setRootURI(opts, uri);
        return manager.resolveFile(uri, opts);

or the way it is done in Commons Configuration

    public InputStream getInputStream(String basePath, String fileName)
        throws ConfigurationException
    {
        try
        {
            FileSystemManager manager = VFS.getManager();
            FileName path;
            if (basePath != null)
            {
                FileName base = manager.resolveURI(basePath);
                path = manager.resolveName(base, fileName);
            }
            else
            {
                FileName file = manager.resolveURI(fileName);
                FileName base = file.getParent();
                path = manager.resolveName(base, file.getBaseName());
            }
            FileSystemOptions opts = getOptions(path.getScheme());
            FileObject file = (opts == null) ? manager.resolveFile(path.getURI())
                    : manager.resolveFile(path.getURI(), opts);
            FileContent content = file.getContent();
            if (content == null)
            {
                String msg = "Cannot access content of " + file.getName().getFriendlyURI();
                throw new ConfigurationException(msg);
            }
            return content.getInputStream();
        }
        catch (ConfigurationException e)
        {
            throw e;
        }
        catch (Exception e)
        {
            throw new ConfigurationException("Unable to load the configuration file " + fileName,
e);
        }
    }

Ralph

On Apr 26, 2010, at 7:29 AM, tmgstewart@aol.com wrote:

> 
> Hi, Ralph.
>  
> I keep running into an invalid absolute URI error.  However, I use the standard method
of
>  
> fo = VFSUtils.resolveFileObject(uri, m_username, m_password);
>  
> (a new version of resolveFileObject method so I may pass username and password per the
format described on the website)
>  
> Should I be using
>  
> WebdavFileObject resource = (WebdavFileObject)VFSUtils.resolveFileObject(uri, m_username,
m_password);
>  
> ?
>  
> I have tried this and still cannot get past the line of code
>  
> return getFileSystemManager().resolveFile(filePath, opts);
>  
> Also.....since I did the following in VFSJFileChooser.java:
>  
> WebdavFileProvider webDavFP = new WebdavFileProvider();
> sfs.addProvider(Protocol.WEBDAV.getName(), webDavFP):
>  
> would I have to use
>  
> WebdavFileObject resource = (WebdavFileObject)VFSUtils.resolveFileObject(uri, m_username,
m_password);
>  
> ?
>  
> Thanks for any and all help (I have hit a wall),
> Theresa


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message