mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-30 18:07:38 +00:00 
			
		
		
		
	Use callback to get okhttp response
This commit is contained in:
		
							parent
							
								
									4968ca6e62
								
							
						
					
					
						commit
						e0e6d3da49
					
				| @ -175,8 +175,6 @@ public class OwnCloudClient extends HttpClient { | |||||||
|         return status; |         return status; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     public RedirectionPath followRedirection(HttpBaseMethod method) throws Exception { |     public RedirectionPath followRedirection(HttpBaseMethod method) throws Exception { | ||||||
|         int redirectionsCount = 0; |         int redirectionsCount = 0; | ||||||
|         int status = method.getStatusCode(); |         int status = method.getStatusCode(); | ||||||
|  | |||||||
| @ -24,7 +24,6 @@ | |||||||
| 
 | 
 | ||||||
| package com.owncloud.android.lib.common.http.methods.webdav; | package com.owncloud.android.lib.common.http.methods.webdav; | ||||||
| 
 | 
 | ||||||
| import com.owncloud.android.lib.common.http.HttpClient; |  | ||||||
| import com.owncloud.android.lib.common.http.methods.HttpBaseMethod; | import com.owncloud.android.lib.common.http.methods.HttpBaseMethod; | ||||||
| 
 | 
 | ||||||
| import java.net.URL; | import java.net.URL; | ||||||
| @ -32,7 +31,6 @@ import java.util.concurrent.TimeUnit; | |||||||
| 
 | 
 | ||||||
| import at.bitfire.dav4android.Constants; | import at.bitfire.dav4android.Constants; | ||||||
| import at.bitfire.dav4android.DavOCResource; | import at.bitfire.dav4android.DavOCResource; | ||||||
| import at.bitfire.dav4android.DavResource; |  | ||||||
| import at.bitfire.dav4android.exception.RedirectException; | import at.bitfire.dav4android.exception.RedirectException; | ||||||
| import okhttp3.HttpUrl; | import okhttp3.HttpUrl; | ||||||
| 
 | 
 | ||||||
| @ -61,8 +59,8 @@ public abstract class DavMethod extends HttpBaseMethod { | |||||||
|     @Override |     @Override | ||||||
|     public int execute() throws Exception { |     public int execute() throws Exception { | ||||||
|         try { |         try { | ||||||
|              return onExecute(); |             return onExecute(); | ||||||
|         } catch(RedirectException e) { |         } catch (RedirectException e) { | ||||||
|             return getStatusCode(); |             return getStatusCode(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -28,6 +28,7 @@ import java.io.IOException; | |||||||
| import java.net.URL; | import java.net.URL; | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  | 
 | ||||||
| import at.bitfire.dav4android.Property; | import at.bitfire.dav4android.Property; | ||||||
| import at.bitfire.dav4android.Response; | import at.bitfire.dav4android.Response; | ||||||
| import at.bitfire.dav4android.exception.DavException; | import at.bitfire.dav4android.exception.DavException; | ||||||
| @ -71,18 +72,17 @@ public class PropfindMethod extends DavMethod { | |||||||
|                             case OTHER: |                             case OTHER: | ||||||
|                             default: |                             default: | ||||||
|                         } |                         } | ||||||
| 
 |  | ||||||
|                         return Unit.INSTANCE; |                         return Unit.INSTANCE; | ||||||
|             }, response -> { |                     }, response -> { | ||||||
|                 mResponse = response; |                         mResponse = response; | ||||||
|                 return Unit.INSTANCE; |                         return Unit.INSTANCE; | ||||||
|             }); |                     }); | ||||||
|         } catch (UnauthorizedException davException) { |         } catch (UnauthorizedException davException) { | ||||||
|             // Do nothing, we will use the 401 code to handle the situation |             // Do nothing, we will use the 401 code to handle the situation | ||||||
|             return davException.getCode(); |             return davException.getCode(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         return super.getStatusCode(); |         return getStatusCode(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public int getDepth() { |     public int getDepth() { | ||||||
|  | |||||||
| @ -77,7 +77,6 @@ public class ExistenceCheckRemoteOperation extends RemoteOperation { | |||||||
|     @Override |     @Override | ||||||
|     protected RemoteOperationResult run(OwnCloudClient client) { |     protected RemoteOperationResult run(OwnCloudClient client) { | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|         try { |         try { | ||||||
|             client.setFollowRedirects(true); |             client.setFollowRedirects(true); | ||||||
|             PropfindMethod propfindMethod = new PropfindMethod( |             PropfindMethod propfindMethod = new PropfindMethod( | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user