当前位置: 首页>>代码示例>>Java>>正文


Java RESTClient类代码示例

本文整理汇总了Java中com.geeksville.apiproxy.rest.RESTClient的典型用法代码示例。如果您正苦于以下问题:Java RESTClient类的具体用法?Java RESTClient怎么用?Java RESTClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RESTClient类属于com.geeksville.apiproxy.rest包,在下文中一共展示了RESTClient类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doInBackground

import com.geeksville.apiproxy.rest.RESTClient; //导入依赖的package包/类
@Override
protected JSONObject doInBackground(String... params) {
    final String username = params[0];
    final String password = params[1];

    JSONObject userData = null;
    try {
        userData = RESTClient.getUserData(username, password, dpPrefs.getDroneshareApiKey());
    } catch (IOException e) {
        Log.e(TAG, e.getMessage(), e);
    }
    return userData;
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:14,代码来源:DroneshareAccountFragment.java

示例2: doUploads

import com.geeksville.apiproxy.rest.RESTClient; //导入依赖的package包/类
private void doUploads(List<Pair<Long, Uri>> dataToUpload) {
	String login = dpPrefs.getDroneshareLogin();
	String password = dpPrefs.getDronesharePassword();

	if (!login.isEmpty() && !password.isEmpty()) {
           final Notification notification = generateNotificationBuilder()
               .setContentText("Uploading tlog data")
               .build();
           startForeground(ONGOING_UPLOAD_NOTIFICATION_ID, notification);

           try {
               int numUploaded = 0;
               for (Pair<Long, Uri> datumInfo : dataToUpload) {
                   long uploadId = datumInfo.first;

                   Uri dataUri = datumInfo.second;
                   File uploadFile = new File(dataUri.getPath());
                   if (uploadFile.isFile()) {
                       Timber.i("Starting upload for " + uploadFile);

                       String url = RESTClient.doUpload(uploadFile, login, password, null, apiKey, DRONESHARE_PRIVACY);
                       if (url != null) {
                           numUploaded++;
                       }

                       onUploadSuccess(uploadFile, url, numUploaded);
                   }
                   else{
                       Timber.w("TLog data file is not available.");
                   }

                   droneShareDb.commitUploadedData(uploadId, System.currentTimeMillis());
               }
           } catch (IOException e) {
               Timber.e(e, "Unable to complete tlog data upload");
               onUploadFailure(e);
           }
           stopForeground(true);
	}
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:41,代码来源:UploaderService.java

示例3: run

import com.geeksville.apiproxy.rest.RESTClient; //导入依赖的package包/类
public void run() {

		File[] files = srcDir.listFiles(new FilenameFilter() {
			public boolean accept(File dir, String name) {
				return name.endsWith(".tlog");
			}
		});

        File processing = null;
		try {
			for (File f : files) {
                processing = f;
				callback.onUploadStart(f);
				String url = RESTClient.doUpload(f, userId, userPass,
						vehicleId, apiKey, privacy);

				destDir.mkdirs();
				File newName = new File(destDir, f.getName());
				f.renameTo(newName);

				callback.onUploadSuccess(f, url);
			}
		} catch (IOException ex) {
			// If the server returns any IO or HTTP exceptions, report _one_
			// failure to the application
			// but then stop scanning until asked to scan again.

			callback.onUploadFailure(processing, ex);
		}
	}
 
开发者ID:3drobotics,项目名称:droneapi-java,代码行数:31,代码来源:DirectoryUploader.java

示例4: runRESTTest

import com.geeksville.apiproxy.rest.RESTClient; //导入依赖的package包/类
/**
	 * Test simple REST uploads
	 * 
	 * @throws Exception
	 */
	public static void runRESTTest() throws Exception {
//		RESTClient.doUpload(testTlog, login, password, vehicleId, apiKey, "DEFAULT");

		JSONObject userData = RESTClient.getUserData("test", "test", apiKey);
		System.out.println("User data: " + userData);
	}
 
开发者ID:3drobotics,项目名称:droneapi-java,代码行数:12,代码来源:TestClient.java


注:本文中的com.geeksville.apiproxy.rest.RESTClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。