Package org.apache.webdav.lib

Examples of org.apache.webdav.lib.WebdavResource


     */
    static public List getAllProperties(String uri)
    throws HttpException, IOException {

        List sourceproperties = new ArrayList();
        WebdavResource resource = WebDAVUtil.getWebdavResource(uri);
        Enumeration responses = resource.propfindMethod(0);
        Enumeration props = null;
        Property prop = null;
        while (responses.hasMoreElements()) {
            ResponseEntity response = (ResponseEntity)responses.nextElement();
            props = response.getProperties();
View Full Code Here


     * @throws IOException
     */
    static public void setProperty(String uri, String name, String namespace, String value)
    throws HttpException, IOException {

        WebdavResource resource = WebDAVUtil.getWebdavResource(uri);
        if(!resource.proppatchMethod(new PropertyName(namespace, name), value, true)) {
            throw new HttpException("Error setting property " + namespace + ":" + name + " on resource: " + uri
                                    + " Status: " + resource.getStatusCode()
                                    + " Message: " + resource.getStatusMessage());
        }
    }
View Full Code Here

     * @throws IOException
     */
    static public void setProperties(String uri, Map properties)
    throws HttpException, IOException {

        WebdavResource resource = WebDAVUtil.getWebdavResource(uri);
        if (!resource.proppatchMethod(new Hashtable(properties), true)) {
            throw new HttpException("Error setting properties on resource: " + uri
                                    + " Status: " + resource.getStatusCode()
                                    + " Message: " + resource.getStatusMessage());
        }
    }
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

        //try {
            HttpURL httpURL = new HttpURL(this.systemId);
            httpURL.setUserInfo(principal, password);
           
            if (createNew)
               this.resource = new WebdavResource(httpURL,
                   WebdavResource.NOACTION,
                   DepthSupport.DEPTH_1);
            else
               this.resource = new WebdavResource(httpURL);
           
            WebdavResource.setGetUseDisk(false);
        //} catch (IOException ioe) {
        //    throw new IllegalStateException(ioe.getMessage());
        //}
View Full Code Here

     * Refresh the content of this object after the underlying data
     * content has changed.
     */
    public void refresh() {
        try {
            this.resource = new WebdavResource(this.systemId);

            if (sourcecredential != null)
                resource.setUserInfo(
                    sourcecredential.getPrincipal(),
                    sourcecredential.getPassword());
View Full Code Here

        try {
            HttpURL httpURL = new HttpURL(this.systemId);
            httpURL.setUserInfo(
                sourcecredential.getPrincipal(),
                sourcecredential.getPassword());
            this.resource = new WebdavResource(httpURL);
        } catch (HttpException he) {
            throw new SourceException("Could not set credentials", he);
        } catch (IOException ioe) {
            throw new IllegalStateException(ioe.getMessage());
        }
View Full Code Here

        try {
            // Set up for processing WebDAV resources
            httpURL = uriToHttpURL(uri);
            if (webdavResource == null) {
                webdavResource = new WebdavResource(httpURL);
                webdavResource.setDebug(debugLevel);
            } else {
                webdavResource.close();
                webdavResource.setHttpURL(httpURL);
            }
            setPath(webdavResource.getPath());
        }
        catch (HttpException we) {
            if (we.getReasonCode() == HttpStatus.SC_UNAUTHORIZED) {
                try {
                    out.print("UserName: ");
                    BufferedReader in =
                        new BufferedReader(new InputStreamReader(System.in));
                    String userName = in.readLine();
                    if ((userName==null) || (userName.length()==0)) {
                        disconnect();
                        return;
                    }
                    userName = userName.trim();
                    System.out.print("Password: ");
                    String password = in.readLine();
                    if (password != null)
                        password= password.trim();
                    try {
                        if (webdavResource != null)
                            webdavResource.close();
                    } catch (IOException e) {
                    } finally {
                        httpURL = null;
                        webdavResource = null;
                    }
                    httpURL = uriToHttpURL(uri);
                    // It should be used like this way.
                    httpURL.setUserinfo(userName, password);
                    webdavResource = new WebdavResource(httpURL);
                    webdavResource.setDebug(debugLevel);
                    setPath(webdavResource.getPath());
                }
                catch (Exception ex) {
                    handleException(ex);
View Full Code Here

        //try {
            HttpURL httpURL = new HttpURL(this.systemId);
            httpURL.setUserInfo(principal, password);
           
            if (createNew)
               this.resource = new WebdavResource(httpURL,
                   WebdavResource.NOACTION,
                   DepthSupport.DEPTH_1);
            else
               this.resource = new WebdavResource(httpURL);
           
            WebdavResource.setGetUseDisk(false);
        //} catch (IOException ioe) {
        //    throw new IllegalStateException(ioe.getMessage());
        //}
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.