private String upload() throws Exception { String url = fedoraClient.getUploadURL(); HttpPost post = new HttpPost(url); post.setHeader(HttpHeaders.CONNECTION, "Keep-Alive"); post.setHeader(HttpHeaders.TRANSFER_ENCODING, "chunked"); MultipartEntity entity = new MultipartEntity(); entity.addPart("file", new InputStreamBody(new SizedInputStream(), "file")); post.setEntity(entity); HttpClient client = fedoraClient.getHttpClient(); HttpResponse response = null; try { response = client.execute(post); int status = response.getStatusLine().getStatusCode(); String body = EntityUtils.toString(response.getEntity()); if (status != HttpStatus.SC_CREATED) { throw new IOException("Upload failed: " + response.getStatusLine().getReasonPhrase() + ": " + replaceNewlines(body, " ")); } else { body = body.replaceAll("\r", "").replaceAll("\n", ""); return body; } } finally { if (response != null && response.getEntity() != null) { response.getEntity().getContent().close(); } } }
try { post = new HttpPost(getUploadURL()); post.getParams().setParameter("Connection", "Keep-Alive");
URL rUrl = new URL(getUploadURL()); if (rUrl.getPort() != url.getPort()) { Scheme scheme = m_cManager.getSchemeRegistry().getScheme("https");
+ fc.getUploadURL(); Dimension d = Administrator.PROGRESS.getSize(); Administrator.PROGRESS.setString(msg);