I solved the task 1) implementing my own class for the GET method 2) reading response bytes which represents file's content. I'd prefer to find a simpler solution in Jackrabbit still.
public class MyGetMethod extends DavMethodBase {
public MyGetMethod(String uri) {
super(uri);
}
public String getName() {
return DavMethods.METHOD_GET;
}
public boolean isSuccess(int statusCode) {
return statusCode == 200;
}
}
static void jackrabbitGet() throws Exception {
HttpClient client = new HttpClient();
Credentials creds = new UsernamePasswordCredentials("user", "pass");
client.getState().setCredentials(AuthScope.ANY, creds);
MyGetMethod method = new MyGetMethod(url goes here);
client.executeMethod(method);
if (method.isSuccess(method.getStatusCode())) {
byte[] resp = method.getResponseBody();
System.out.println("Got response: " + resp.length + " bytes");
}
}