Package com.adito.vfs.utils

Examples of com.adito.vfs.utils.URI$MalformedURIException


    /* (non-Javadoc)
     * @see com.adito.vfs.VFSStore#createURIFromPath(java.lang.String)
     */
    public URI createURIFromPath(String path) throws IllegalArgumentException {
    try {
      URI uri = new URI(DAVUtilities.processAndEncodeURI(path, getRepository().getSession()));
      if (HTTP_SCHEME.equals(uri.getScheme()) || HTTPS_SCHEME.equals(uri.getScheme())){
        return uri;
      }
    }
    catch (MalformedURIException e) {
    }
View Full Code Here


        return options;
    }

    public FileObject createVFSFileObject(String path, PasswordCredentials credentials) throws IOException {
        try {
            URI uri = getRootVFSURI();
            if (credentials != null) {
                uri.setUserinfo(DAVUtilities.encodeURIUserInfo(credentials.getUsername() + (credentials.getPassword() != null ? ":" + new String(credentials.getPassword()) : "")));
            }
            uri.setPath(uri.getPath() + (uri.getPath().endsWith("/") ? "" : "/") + DAVUtilities.encodePath(path));
            FileObject fileObject = this.getStore().getRepository().getFileSystemManager().resolveFile(uri.toString(), getOptions(uri));
            return fileObject;
        } catch (FileSystemException fse) {
            if (fse.getCode().equals("vfs.provider.ftp/connect.error")) {
                throw new DAVAuthenticationRequiredException(getMountString());
            }
View Full Code Here

        super(launchSession, store);
    }

    public FileObject createVFSFileObject(String path, PasswordCredentials credentials) throws IOException {
        try {
            URI uri = getRootVFSURI();
            if (credentials != null) {
                uri.setUserinfo(DAVUtilities.encodeURIUserInfo(credentials.getUsername() + (credentials.getPassword() != null ? ":" + new String(credentials.getPassword()) : "")));
            }
            uri.setPath(uri.getPath() + (uri.getPath().endsWith("/") ? "" : "/") + DAVUtilities.encodePath(path));
            FileObject fileObject = this.getStore().getRepository().getFileSystemManager().resolveFile(uri.toString());
            return fileObject;
        } catch (FileSystemException fse) {
            if (fse.getCode().equals("vfs.provider.ftp/connect.error")) {
                throw new DAVAuthenticationRequiredException(getMountString());
            }
View Full Code Here

        /* (non-Javadoc)
         * @see com.adito.vfs.AbstractVFSMount#createVFSFileObject(java.lang.String, com.adito.security.PasswordCredentials)
         */
        public FileObject createVFSFileObject(String path, PasswordCredentials credentials) throws IOException {
            URI uri = new URI(getRootVFSURI());
            uri.setPath(DAVUtilities.concatenatePaths(uri.getPath(), path));
            FileObject root = getStore().getRepository().getFileSystemManager().resolveFile(uri.toString());
            return root;
        }
View Full Code Here

        /* (non-Javadoc)
         * @see com.adito.vfs.AbstractVFSMount#getRootVFSURI(java.lang.String)
         */
        public URI getRootVFSURI(String charset) throws MalformedURIException {
          return new URI(dir.toURI().toString());
        }
View Full Code Here

    /* (non-Javadoc)
     * @see com.adito.networkplaces.AbstractNetworkPlaceMount#createVFSFileObject(java.lang.String, com.adito.security.PasswordCredentials)
     */
    public FileObject createVFSFileObject(String path, PasswordCredentials credentials) throws IOException {
        URI uri = getRootVFSURI();
        uri.setPath(DAVUtilities.concatenatePaths(uri.getPath(), path));
        if(uri.getPath().startsWith("./")) {
          FileObject root = getStore().getRepository().getFileSystemManager().resolveFile(new File(SystemProperties.get("user.dir")), uri.getPath().substring(2));
          return root;
        }
        else {
          FileObject root = getStore().getRepository().getFileSystemManager().resolveFile(uri.toString());
          return root;
        }
    }
View Full Code Here

     * @throws MalformedURIException
     */
    public static URI processAndEncodeURI(String uri, SessionInfo session, String charset) throws MalformedURIException {
        // TODO We have problems with passwords containing @ characters here
        String path = session == null ? uri : SessionInfoReplacer.replace(session, uri);
        URI nuri = new URI(path);
        if(nuri.getUserinfo() != null) {
            nuri.setUserinfo(encodeURIUserInfo(nuri.getUserinfo()));
        }
        if(nuri.getPath() != null && !nuri.getPath().equals("")) {
            nuri.setPath(encodePath(nuri.getPath(), charset));
        }
        return nuri;
    }
View Full Code Here

        return options;
    }

    public FileObject createVFSFileObject(String path, PasswordCredentials credentials) throws IOException {
        try {
            URI uri = getRootVFSURI();
            if (credentials != null) {
                uri.setUserinfo(DAVUtilities.encodeURIUserInfo(credentials.getUsername() + (credentials.getPassword() != null ? ":" + new String(credentials.getPassword()) : "")));
            }
            uri.setPath(uri.getPath() + (uri.getPath().endsWith("/") ? "" : "/") + DAVUtilities.encodePath(path));
            FileObject fileObject = this.getStore().getRepository().getFileSystemManager().resolveFile(uri.toString(), getOptions(uri));
            return fileObject;
        } catch (FileSystemException fse) {
            if (fse.getCode().equals("vfs.provider.http/connect.error")) {
                throw new DAVAuthenticationRequiredException(getMountString());
            }
View Full Code Here

            File f = new File(basedir);
            if(f.exists()) {
              baseDir = f;
            }
          }
      return new URI(baseDir.toURI().toString());
    }
View Full Code Here

          }
      return new URI(baseDir.toURI().toString());
    }

    protected FileObject createVFSFileObject(String path, PasswordCredentials credentials) throws IOException {
      URI uri = getRootVFSURI();
      uri.setPath(DAVUtilities.concatenatePaths(uri.getPath(), path));
      FileObject root = getStore().getRepository().getFileSystemManager().resolveFile(uri.toString());
      return root;
    }
View Full Code Here

TOP

Related Classes of com.adito.vfs.utils.URI$MalformedURIException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.