protected static int getBuilderNumber(Session session, String jsonWSPath) throws Exception { HttpUtil.setJSONWSPath(jsonWSPath); PortalService service = new PortalService(session); int version = PortalVersion.UNKNOWN; try { version = service.getBuildNumber(); } finally { HttpUtil.setJSONWSPath(HttpUtil.JSONWS_PATH_62); } return version; }
public static void download( Session session, OutputStream os, String URL, FileProgressCallback callback) throws Exception { HttpClientBuilder clientBuilder = HttpUtil.getClientBuilder(session); HttpGetHC4 request = HttpUtil.getHttpGet(session, URL); HttpResponse response = clientBuilder.build().execute(request); HttpUtil.checkStatusCode(request, response); InputStream is = response.getEntity().getContent(); try { transfer(request, is, os, callback); } finally { close(is); } }
@Override public JSONArray doInBackground(JSONObject... commands) { try { UploadAsyncTask task = null; if (_callback instanceof UploadProgressAsyncTaskCallback) { task = this; } Object result = HttpUtil.upload(_session, commands[0], task); JSONArray array = new JSONArray(); array.put(result); return _callback.inBackground(array); } catch (Exception e) { _exception = e; cancel(false); } return null; }