[Prev] Thread [Next]  |  [Prev] Date [Next]

How can I use PropFindMethod? Tanakorn Leesatapornwongsa Mon May 04 05:05:04 2009

I want to use PropFindMethod to retrieves my interesting properties of the
file. When I used this, it didn't send XML properties name that I want to
the server.
My code like this,

       HttpClient http = new HttpClient();
>        Credentials credentials = new
> UsernamePasswordCredentials(SERVER_USERNAME, SERVER_PASSWORD);
>        http.getState().setCredentials(new
> AuthScope(SERVER_HOST,SERVER_PORT), credentials);
>        http.getParams().setAuthenticationPreemptive(true);
>        HostConfiguration hostConfig = new HostConfiguration();
>        PropFindMethod propFindMethod = new PropFindMethod();
>        propFindMethod.setDepth(DepthSupport.DEPTH_0);
>        propFindMethod.setPath(CALDAV_SERVER_WEBDAV_ROOT);
>        propFindMethod.setType(PropFindMethod.BY_NAME);
>        Vector<PropertyName> v = new Vector<PropertyName>();
>        v.add(new PropertyName("DAV", "resourcetype"));
>        v.add(new PropertyName("DAV", "calendar-home-set"));
>        propFindMethod.setPropertyNames(v.elements());
>        status = http.executeMethod(hostConfig, propFindMethod);
>        System.out.println(status);

But I found that my code didn't send properties "resourcetype" and
"calendar-home-set" to the server it only sent the header?
Is my code wrong?

Thank you.