mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 02:17:41 +00:00 
			
		
		
		
	Implement get quota with new architecture and refactoring
This commit is contained in:
		
							parent
							
								
									bd82537045
								
							
						
					
					
						commit
						25bba85ee1
					
				| @ -35,7 +35,7 @@ import com.owncloud.android.lib.common.authentication.OwnCloudCredentialsFactory | |||||||
| import com.owncloud.android.lib.common.authentication.OwnCloudCredentialsFactory.OwnCloudAnonymousCredentials; | import com.owncloud.android.lib.common.authentication.OwnCloudCredentialsFactory.OwnCloudAnonymousCredentials; | ||||||
| import com.owncloud.android.lib.common.interceptors.HttpInterceptor; | import com.owncloud.android.lib.common.interceptors.HttpInterceptor; | ||||||
| import com.owncloud.android.lib.common.interceptors.UserAgentInterceptor; | import com.owncloud.android.lib.common.interceptors.UserAgentInterceptor; | ||||||
| import com.owncloud.android.lib.common.methods.HttpBaseMethod; | import com.owncloud.android.lib.common.http.HttpBaseMethod; | ||||||
| import com.owncloud.android.lib.common.network.RedirectionPath; | import com.owncloud.android.lib.common.network.RedirectionPath; | ||||||
| import com.owncloud.android.lib.common.utils.Log_OC; | import com.owncloud.android.lib.common.utils.Log_OC; | ||||||
| import com.owncloud.android.lib.resources.status.OwnCloudVersion; | import com.owncloud.android.lib.resources.status.OwnCloudVersion; | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| package com.owncloud.android.lib.common.methods; | package com.owncloud.android.lib.common.http; | ||||||
| 
 | 
 | ||||||
| import okhttp3.Request; | import okhttp3.Request; | ||||||
| import okhttp3.Response; | import okhttp3.Response; | ||||||
							
								
								
									
										126
									
								
								src/com/owncloud/android/lib/common/http/HttpConstants.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								src/com/owncloud/android/lib/common/http/HttpConstants.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,126 @@ | |||||||
|  | package com.owncloud.android.lib.common.http; | ||||||
|  | 
 | ||||||
|  | public class HttpConstants { | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 1xx Informational | ||||||
|  |      */ | ||||||
|  | 
 | ||||||
|  |     // 100 Continue (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_CONTINUE = 100; | ||||||
|  |     // 101 Switching Protocols (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_SWITCHING_PROTOCOLS = 101; | ||||||
|  |     // 102 Processing (WebDAV - RFC 2518) | ||||||
|  |     public static final int HTTP_PROCESSING = 102; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 2xx Success | ||||||
|  |      */ | ||||||
|  | 
 | ||||||
|  |     // 200 OK (HTTP/1.0 - RFC 1945) | ||||||
|  |     public static final int HTTP_OK = 200; | ||||||
|  |     // 201 Created (HTTP/1.0 - RFC 1945) | ||||||
|  |     public static final int HTTP_CREATED = 201; | ||||||
|  |     // 202 Accepted (HTTP/1.0 - RFC 1945) | ||||||
|  |     public static final int HTTP_ACCEPTED = 202; | ||||||
|  |     // 203 Non Authoritative Information (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_NON_AUTHORITATIVE_INFORMATION = 203; | ||||||
|  |     // 204 No Content</tt> (HTTP/1.0 - RFC 1945) | ||||||
|  |     public static final int HTTP_NO_CONTENT = 204; | ||||||
|  |     // 205 Reset Content</tt> (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_RESET_CONTENT = 205; | ||||||
|  |     // 206 Partial Content</tt> (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_PARTIAL_CONTENT = 206; | ||||||
|  |     //207 Multi-Status (WebDAV - RFC 2518) or 207 Partial Update OK (HTTP/1.1 - draft-ietf-http-v11-spec-rev-01?) | ||||||
|  |     public static final int HTTP_MULTI_STATUS = 207; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 3xx Redirection | ||||||
|  |      */ | ||||||
|  | 
 | ||||||
|  |     // 300 Mutliple Choices</tt> (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_MULTIPLE_CHOICES = 300; | ||||||
|  |     // 301 Moved Permanently</tt> (HTTP/1.0 - RFC 1945) | ||||||
|  |     public static final int HTTP_MOVED_PERMANENTLY = 301; | ||||||
|  |     // 302 Moved Temporarily</tt> (Sometimes <tt>Found) (HTTP/1.0 - RFC 1945) | ||||||
|  |     public static final int HTTP_MOVED_TEMPORARILY = 302; | ||||||
|  |     // 303 See Other (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_SEE_OTHER = 303; | ||||||
|  |     // 304 Not Modified (HTTP/1.0 - RFC 1945) | ||||||
|  |     public static final int HTTP_NOT_MODIFIED = 304; | ||||||
|  |     // 305 Use Proxy (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_USE_PROXY = 305; | ||||||
|  |     // 307 Temporary Redirect (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_TEMPORARY_REDIRECT = 307; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 4xx Client Error | ||||||
|  |      */ | ||||||
|  | 
 | ||||||
|  |     // 400 Bad Request (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_BAD_REQUEST = 400; | ||||||
|  |     // 401 Unauthorized (HTTP/1.0 - RFC 1945) | ||||||
|  |     public static final int HTTP_UNAUTHORIZED = 401; | ||||||
|  |     // 402 Payment Required (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_PAYMENT_REQUIRED = 402; | ||||||
|  |     // 403 Forbidden (HTTP/1.0 - RFC 1945) | ||||||
|  |     public static final int HTTP_FORBIDDEN = 403; | ||||||
|  |     // 404 Not Found (HTTP/1.0 - RFC 1945) | ||||||
|  |     public static final int HTTP_NOT_FOUND = 404; | ||||||
|  |     // 405 Method Not Allowed (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_METHOD_NOT_ALLOWED = 405; | ||||||
|  |     // 406 Not Acceptable (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_NOT_ACCEPTABLE = 406; | ||||||
|  |     // 407 Proxy Authentication Required (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_PROXY_AUTHENTICATION_REQUIRED = 407; | ||||||
|  |     // 408 Request Timeout (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_REQUEST_TIMEOUT = 408; | ||||||
|  |     // 409 Conflict (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_CONFLICT = 409; | ||||||
|  |     // 410 Gone (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_GONE = 410; | ||||||
|  |     // 411 Length Required (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_LENGTH_REQUIRED = 411; | ||||||
|  |     // 412 Precondition Failed (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_PRECONDITION_FAILED = 412; | ||||||
|  |     // 413 Request Entity Too Large (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_REQUEST_TOO_LONG = 413; | ||||||
|  |     // 414 Request-URI Too Long (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_REQUEST_URI_TOO_LONG = 414; | ||||||
|  |     // 415 Unsupported Media Type (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_UNSUPPORTED_MEDIA_TYPE = 415; | ||||||
|  |     // 416 Requested Range Not Satisfiable (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416; | ||||||
|  |     // 417 Expectation Failed (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_EXPECTATION_FAILED = 417; | ||||||
|  |     // 419 Insufficient Space on Resource (WebDAV - draft-ietf-webdav-protocol-05?) | ||||||
|  |     // or <tt>419 Proxy Reauthentication Required (HTTP/1.1 drafts?) | ||||||
|  |     public static final int HTTP_INSUFFICIENT_SPACE_ON_RESOURCE = 419; | ||||||
|  |     // 420 Method Failure (WebDAV - draft-ietf-webdav-protocol-05?) | ||||||
|  |     public static final int HTTP_METHOD_FAILURE = 420; | ||||||
|  |     // 422 Unprocessable Entity (WebDAV - RFC 2518) | ||||||
|  |     public static final int HTTP_UNPROCESSABLE_ENTITY = 422; | ||||||
|  |     // 423 Locked (WebDAV - RFC 2518) | ||||||
|  |     public static final int HTTP_LOCKED = 423; | ||||||
|  |     // 424 Failed Dependency (WebDAV - RFC 2518) | ||||||
|  |     public static final int HTTP_FAILED_DEPENDENCY = 424; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 5xx Client Error | ||||||
|  |      */ | ||||||
|  | 
 | ||||||
|  |     // 500 Server Error (HTTP/1.0 - RFC 1945) | ||||||
|  |     public static final int HTTP_INTERNAL_SERVER_ERROR = 500; | ||||||
|  |     // 501 Not Implemented (HTTP/1.0 - RFC 1945) | ||||||
|  |     public static final int HTTP_NOT_IMPLEMENTED = 501; | ||||||
|  |     // 502 Bad Gateway (HTTP/1.0 - RFC 1945) | ||||||
|  |     public static final int HTTP_BAD_GATEWAY = 502; | ||||||
|  |     // 503 Service Unavailable (HTTP/1.0 - RFC 1945) | ||||||
|  |     public static final int HTTP_SERVICE_UNAVAILABLE = 503; | ||||||
|  |     // 504 Gateway Timeout (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_GATEWAY_TIMEOUT = 504; | ||||||
|  |     // 505 HTTP Version Not Supported (HTTP/1.1 - RFC 2616) | ||||||
|  |     public static final int HTTP_HTTP_VERSION_NOT_SUPPORTED = 505; | ||||||
|  |     // 507 Insufficient Storage (WebDAV - RFC 2518) | ||||||
|  |     public static final int HTTP_INSUFFICIENT_STORAGE = 507; | ||||||
|  | } | ||||||
| @ -1,10 +1,9 @@ | |||||||
| package com.owncloud.android.lib.common.methods.nonwebdav; | package com.owncloud.android.lib.common.http.nonwebdav; | ||||||
| 
 | 
 | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| 
 | 
 | ||||||
| import okhttp3.OkHttpClient; | import okhttp3.OkHttpClient; | ||||||
| import okhttp3.Request; | import okhttp3.Request; | ||||||
| import okhttp3.Response; |  | ||||||
| 
 | 
 | ||||||
| public class GetMethod extends HttpMethod { | public class GetMethod extends HttpMethod { | ||||||
| 
 | 
 | ||||||
| @ -1,6 +1,6 @@ | |||||||
| package com.owncloud.android.lib.common.methods.nonwebdav; | package com.owncloud.android.lib.common.http.nonwebdav; | ||||||
| 
 | 
 | ||||||
| import com.owncloud.android.lib.common.methods.HttpBaseMethod; | import com.owncloud.android.lib.common.http.HttpBaseMethod; | ||||||
| 
 | 
 | ||||||
| import okhttp3.OkHttpClient; | import okhttp3.OkHttpClient; | ||||||
| import okhttp3.Request; | import okhttp3.Request; | ||||||
| @ -1,6 +1,6 @@ | |||||||
| package com.owncloud.android.lib.common.methods.webdav; | package com.owncloud.android.lib.common.http.webdav; | ||||||
| 
 | 
 | ||||||
| import com.owncloud.android.lib.common.methods.HttpBaseMethod; | import com.owncloud.android.lib.common.http.HttpBaseMethod; | ||||||
| 
 | 
 | ||||||
| import at.bitfire.dav4android.DavOCResource; | import at.bitfire.dav4android.DavOCResource; | ||||||
| import at.bitfire.dav4android.DavResource; | import at.bitfire.dav4android.DavResource; | ||||||
| @ -1,12 +1,8 @@ | |||||||
| package com.owncloud.android.lib.common.methods.webdav; | package com.owncloud.android.lib.common.http.webdav; | ||||||
| 
 |  | ||||||
| import com.owncloud.android.lib.common.network.WebdavUtils; |  | ||||||
| 
 | 
 | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.util.ArrayList; |  | ||||||
| import java.util.Set; | import java.util.Set; | ||||||
| 
 | 
 | ||||||
| import at.bitfire.dav4android.DavOCResource; |  | ||||||
| import at.bitfire.dav4android.DavResource; | import at.bitfire.dav4android.DavResource; | ||||||
| import at.bitfire.dav4android.PropertyUtils; | import at.bitfire.dav4android.PropertyUtils; | ||||||
| import at.bitfire.dav4android.exception.DavException; | import at.bitfire.dav4android.exception.DavException; | ||||||
| @ -25,7 +25,7 @@ | |||||||
| package com.owncloud.android.lib.resources.files; | package com.owncloud.android.lib.resources.files; | ||||||
| 
 | 
 | ||||||
| import com.owncloud.android.lib.common.OwnCloudClient; | import com.owncloud.android.lib.common.OwnCloudClient; | ||||||
| import com.owncloud.android.lib.common.methods.webdav.PropfindMethod; | import com.owncloud.android.lib.common.http.webdav.PropfindMethod; | ||||||
| import com.owncloud.android.lib.common.network.RedirectionPath; | import com.owncloud.android.lib.common.network.RedirectionPath; | ||||||
| import com.owncloud.android.lib.common.network.WebdavUtils; | import com.owncloud.android.lib.common.network.WebdavUtils; | ||||||
| import com.owncloud.android.lib.common.operations.RemoteOperation; | import com.owncloud.android.lib.common.operations.RemoteOperation; | ||||||
|  | |||||||
| @ -25,15 +25,13 @@ | |||||||
| package com.owncloud.android.lib.resources.users; | package com.owncloud.android.lib.resources.users; | ||||||
| 
 | 
 | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| 
 |  | ||||||
| import org.apache.commons.httpclient.HttpStatus; |  | ||||||
| import org.json.JSONObject; | import org.json.JSONObject; | ||||||
| 
 |  | ||||||
| import com.owncloud.android.lib.common.OwnCloudClient; | import com.owncloud.android.lib.common.OwnCloudClient; | ||||||
|  | import com.owncloud.android.lib.common.http.HttpConstants; | ||||||
| import com.owncloud.android.lib.common.operations.RemoteOperation; | import com.owncloud.android.lib.common.operations.RemoteOperation; | ||||||
| import com.owncloud.android.lib.common.operations.RemoteOperationResult; | import com.owncloud.android.lib.common.operations.RemoteOperationResult; | ||||||
| import com.owncloud.android.lib.common.utils.Log_OC; | import com.owncloud.android.lib.common.utils.Log_OC; | ||||||
| import com.owncloud.android.lib.common.methods.nonwebdav.GetMethod; | import com.owncloud.android.lib.common.http.nonwebdav.GetMethod; | ||||||
| 
 | 
 | ||||||
| import okhttp3.Request; | import okhttp3.Request; | ||||||
| 
 | 
 | ||||||
| @ -116,7 +114,7 @@ public class GetRemoteUserInfoOperation extends RemoteOperation { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private boolean isSuccess(int status) { |     private boolean isSuccess(int status) { | ||||||
|         return (status == HttpStatus.SC_OK); |         return (status == HttpConstants.HTTP_OK); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public static class UserInfo { |     public static class UserInfo { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user