drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/utils/webdav/WebDavClient.java
public ResourceProperties queryProperties(String resource) throws Exception {
        IResponse response = null;
        try {
            IContext context = createContext();
            context.put("Depth", "1"); //$NON-NLS-1$ //$NON-NLS-2$
            ILocator locator = WebDAVFactory.locatorFactory.newLocator(resource);
            response = client.propfind(locator, context, null);
            if (response.getStatusCode() != IResponse.SC_MULTI_STATUS
               && response.getStatusCode() != IResponse.SC_OK) {
                throw new WebDavException(response);
            }
            Map<String, ResourceProperties> props =
                StreamProcessingUtils.parseListing("", response.getInputStream()); //$NON-NLS-1$
            if (props.keySet().size() != 1) {
                throw new Exception(props.keySet().size() + " entries found for " + resource); //$NON-NLS-1$
            }
            String fullpath = props.keySet().iterator().next();
            ResourceProperties res = props.get(fullpath);
            String filename = new Path(fullpath).lastSegment();
            addGuvnorResourceProperties(res, filename, resource);
            return res;
        } finally {
            if (response != null) {
                response.close();
            }
        }
    }
public ResourceProperties queryProperties(String resource) throws Exception {
        IResponse response = null;
        try {
            IContext context = createContext();
            context.put("Depth", "1"); //$NON-NLS-1$ //$NON-NLS-2$
            ILocator locator = WebDAVFactory.locatorFactory.newLocator(resource);
            response = client.propfind(locator, context, null);
            if (response.getStatusCode() != IResponse.SC_MULTI_STATUS
               && response.getStatusCode() != IResponse.SC_OK) {
                throw new WebDavException(response);
            }
            Map<String, ResourceProperties> props =
                StreamProcessingUtils.parseListing("", response.getInputStream()); //$NON-NLS-1$
            if (props.keySet().size() != 1) {
                throw new Exception(props.keySet().size() + " entries found for " + resource); //$NON-NLS-1$
            }
            String fullpath = props.keySet().iterator().next();
            ResourceProperties res = props.get(fullpath);
            String filename = new Path(fullpath).lastSegment();
            addGuvnorResourceProperties(res, filename, resource);
            return res;
        } finally {
            if (response != null) {
                response.close();
            }
        }
    }
public ResourceProperties queryProperties ( String resource ) throws Exception { IResponse response = null ; try { IContext context = createContext ( ) ; context . put ( "Depth" , "1" ) ; //$NON-NLS-1$ //$NON-NLS-2$ ILocator locator = WebDAVFactory . locatorFactory . newLocator ( resource ) ; response = client . propfind ( locator , context , null ) ; if ( response . getStatusCode ( ) != IResponse . SC_MULTI_STATUS && response . getStatusCode ( ) != IResponse . SC_OK ) { throw new WebDavException ( response ) ; } Map < String , ResourceProperties > props = StreamProcessingUtils . parseListing ( "" , response . getInputStream ( ) ) ; //$NON-NLS-1$ if ( props . keySet ( ) . size ( ) != 1 ) { throw new Exception ( props . keySet ( ) . size ( ) + " entries found for " + resource ) ; //$NON-NLS-1$ } String fullpath = props . keySet ( ) . iterator ( ) . next ( ) ; ResourceProperties res = props . get ( fullpath ) ; String filename = new Path ( fullpath ) . lastSegment ( ) ; addGuvnorResourceProperties ( res , filename , resource ) ; return res ; } finally { if ( response != null ) { response . close ( ) ; } } }
/*
(non-Javadoc)
@see org.guvnor.tools.utils.webdav.IWebDavClient#queryProperties(java.lang.String)
/ * ( non - Javadoc )