tryToLogin must get parameters now
authorLennart Rosam <lennart@familie-rosam.de>
Tue, 3 Jul 2012 22:47:31 +0000 (00:47 +0200)
committerLennart Rosam <lennart@familie-rosam.de>
Tue, 3 Jul 2012 22:47:31 +0000 (00:47 +0200)
src/eu/alefzero/webdav/WebdavClient.java

index a8cfee8..797bad4 100644 (file)
@@ -193,15 +193,23 @@ public class WebdavClient extends HttpClient {
         return result;\r
     }\r
 \r
-    public int tryToLogin() {\r
-        int r = 0;\r
-        HeadMethod head = new HeadMethod(mUri.toString());\r
+    /**\r
+     * Tries to log in to the given WedDavURI, with the given credentials\r
+     * @param uri To test\r
+     * @param username Username to check\r
+     * @param password Password to verify\r
+     * @return A {@link HttpStatus}-Code of the result. SC_OK is good.\r
+     */\r
+    public int tryToLogin(Uri uri, String username, String password) {\r
+        int returnCode = 0;\r
+        setCredentials(username, password);\r
+        HeadMethod head = new HeadMethod(uri.toString());\r
         try {\r
-            r = executeMethod(head);\r
+            returnCode = executeMethod(head);\r
         } catch (Exception e) {\r
             Log.e(TAG, "Error: " + e.getMessage());\r
         }\r
-        return r;\r
+        return returnCode;\r
     }\r
 \r
     public boolean createDirectory(String path) {\r