Package org.apache.webdav.lib

Examples of org.apache.webdav.lib.WebdavResource


        int fileNameStart = destination.lastIndexOf('/');
        String baseUrl = destination.substring(0, fileNameStart + 1);
        String destinationFileName =  destination.substring(fileNameStart + 1);
        HttpsURL hrl = new HttpsURL(baseUrl);
        hrl.setUserinfo(user, userPassword);
        WebdavResource wdr = new WebdavResource(hrl);
        wdr.putMethod(wdr.getPath() + '/' + destinationFileName, source);
        wdr.close();
    }
View Full Code Here


                hostname,
                port,
                "/");

            // WebdavResource resource = null;
            WebdavResource resource = new WebdavResource()
            {
            };

            if (fileSystemOptions != null)
            {
                String proxyHost = WebdavFileSystemConfigBuilder.getInstance().getProxyHost(fileSystemOptions);
                int proxyPort = WebdavFileSystemConfigBuilder.getInstance().getProxyPort(fileSystemOptions);

                if (proxyHost != null && proxyPort > 0)
                {
                    // resource = new WebdavResource(url, proxyHost, proxyPort);
                    resource.setProxy(proxyHost, proxyPort);
                }
            }

            /*
            if (resource == null)
            {
                resource = new WebdavResource(url);
            }
            resource.setProperties(WebdavResource.NOACTION, 1);
            */
            resource.setHttpURL(url, WebdavResource.NOACTION, 1);

            client = resource.retrieveSessionInstance();
            client.setHttpConnectionManager(new WebdavConnectionManager());
        }
        catch (final IOException e)
        {
            throw new FileSystemException("vfs.provider.webdav/connect.error", hostname, e);
View Full Code Here

        {
            // HttpURL url = new HttpURL(name.getHostName(), name.getPort(), name.getPath());
            String pathEncoded = name.getPathQueryEncoded(urlCharset);
            HttpURL url = new HttpURL(name.getUserName(), name.getPassword(), name.getHostName(), name.getPort());
            url.setEscapedPath(pathEncoded);
            resource = new WebdavResource(fileSystem.getClient())
            {
            };
            resource.setHttpURL(url, WebdavResource.NOACTION, 1);
        }
View Full Code Here

        List vfs = new ArrayList(children.length);
        // WebdavFileObject[] vfs = new WebdavFileObject[children.length];
        for (int i = 0; i < children.length; i++)
        {
            WebdavResource dav = children[i];

            String davName = dav.getHttpURL().getEscapedName();
            if ("".equals(davName))
            {
                // current file
                continue;
            }
View Full Code Here

    }

    private WebdavResource getWebdavResource() {
        if (null == webdavResource)
            try {
                webdavResource = new WebdavResource(httpURL,
                        WebdavResource.NOACTION, 0);
                webdavResource.setFollowRedirects(true);
            } catch (HttpException e) {
                lastError = e.getMessage() + "(" + e.getReasonCode() + ")";
            } catch (IOException e) {
View Full Code Here

        String description = httpURL.toString();
        return (description != null) ? description : url;
    }

    public boolean canRead() {
        WebdavResource res = getWebdavResource();
        return (null == res) ? false : (res.exists() && !res.isCollection());
    }
View Full Code Here

        WebdavResource res = getWebdavResource();
        return (null == res) ? false : (res.exists() && !res.isCollection());
    }

    public boolean canWrite() {
        WebdavResource res = getWebdavResource();
        if (null == res)
            return false;

        try {
            res.setProperties(0);
        } catch (HttpException e) {
            if (404 != e.getReasonCode())
                return false;
        } catch (IOException e) {
            return false;
        }

        if (res.exists()) {
            return (!res.isCollection());
        } else {
            try {
                HttpURL parentURL = new HttpURL(httpURL.toString());
                String user = httpURL.getUser();
                String pass = httpURL.getPassword();
                if (user != null)
                    parentURL.setUserinfo(user, pass);
                String currentHierPath = httpURL.getCurrentHierPath();
                if (!currentHierPath.endsWith("/"))
                    currentHierPath = currentHierPath + "/";
                parentURL.setPath(currentHierPath);
                WebdavResource parentRes = new WebdavResource(parentURL);
                if (!parentRes.isCollection())
                    return false;
                return true;
            } catch (Exception e) {
                return false;
            }
View Full Code Here

      item_.setImage(ResourceManager.getImageFromResource("/sos/scheduler/editor/icon_directory_up.gif"));

      //directories
      while(it.hasNext()) {

        WebdavResource keys = (WebdavResource)it.next();
        String key = keys.toString();
        key = key.replaceAll("%20", " ");
        key = new File(key).getName();

        if(h.get(keys).equals("dir")) {
          TableItem item = new TableItem(table, SWT.NONE);
View Full Code Here

      //files
      String localFile = "";
      while(it.hasNext()) {
        //ok = true;
        //String key = sosString.parseToString(it.next());
        WebdavResource key = (WebdavResource)it.next();
        if(h.get(key).equals("file")) {
          if(isLifeElement(sosString.parseToString(key))) {
            localFile = listener.getCurrProfile().getProperty("localdirectory");
            if(!localFile.endsWith("/"))
              localFile = localFile + "/";
            localFile = localFile + tempSubHotFolder + "/";
            if(!new File(localFile).exists())
              new File(localFile).mkdirs();
            String slocalFile = localFile + new File(sosString.parseToString(key)).getName();
            key.getMethod(new File(slocalFile));
            //key.getMethod(new File("c:/temp/job8.job.xml"));
            //String file = listener.getFile(sosString.parseToString(key), tmpDirname + "/" + tempSubHotFolder);
            //nameOfLifeElement.add(File);
            nameOfLifeElement.add(slocalFile);
          }
View Full Code Here

    try {    



     
      WebdavResource wdr = connect(url);
      //Datei holen                 
      fn = new File(currProfile.getProperty("localdirectory") + "//" new File(url).getName());
      boolean retVal = wdr.getMethod(fn);

      hasError = !retVal;
      wdr.close();

      if(logtext != nulllogtext.append("..webdav server reply [getfile] [status= "  + wdr.getStatusMessage() );
     
      return fn.getCanonicalPath();
    } catch (Exception e) {
      try {
        new ErrorLog("error in " + sos.util.SOSClassUtil.getMethodName() + " ;could not get File [" + url + "]", e);
View Full Code Here

TOP

Related Classes of org.apache.webdav.lib.WebdavResource

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.