@Override public void eventOccurred(final SendingRequestEvent event) { if(event.getConnectionObject() instanceof HttpsURLConnection) { final HttpsURLConnection connection = (HttpsURLConnection) event.getConnectionObject(); connection.setSSLSocketFactory(new CustomTrustSSLProtocolSocketFactory(trust, key)); connection.setHostnameVerifier(new DisabledX509HostnameVerifier()); } } });
@Override public void eventOccurred(SendingRequestEvent eventArg) { HttpURLConnection connection = (HttpURLConnection) eventArg.getConnectionObject(); String userAgentInfo = String.format(Utility.LOCALE_US, "WASB/%s (%s) %s", VersionInfo.getVersion(), userAgentId, BaseRequest.getUserAgent()); connection.setRequestProperty(Constants.HeaderConstants.USER_AGENT, userAgentInfo); } });
@Override public void eventOccurred(SendingRequestEvent eventArg) { HttpURLConnection request = (HttpURLConnection) eventArg.getConnectionObject(); request.setRequestProperty(Constants.HeaderConstants.PREFIX_FOR_STORAGE_METADATA + "key1", ""); } });
@Override public void eventOccurred(SendingRequestEvent eventArg) { HttpURLConnection connection = (HttpURLConnection) eventArg .getConnectionObject(); connection.setRequestProperty("x-ms-foo", ""); } });
@Override public void eventOccurred(SendingRequestEvent eventArg) { HttpURLConnection connection = (HttpURLConnection) eventArg.getConnectionObject(); connection.setRequestProperty("x-ms-foo", ""); } });
@Override public void eventOccurred(SendingRequestEvent eventArg) { HttpURLConnection connection = (HttpURLConnection) eventArg.getConnectionObject(); connection.setRequestProperty("x-ms-foo", ""); } });
@Override public void eventOccurred(SendingRequestEvent eventArg) { HttpURLConnection connection = (HttpURLConnection) eventArg.getConnectionObject(); connection.setFixedLengthStreamingMode(0); } });
@Override public void eventOccurred(SendingRequestEvent eventArg) { HttpURLConnection connection = (HttpURLConnection) eventArg.getConnectionObject(); connection.setRequestProperty("x-ms-foo", ""); } });
/** * Called before the Azure Storage SDK sends a request. * * @param event The connection, operation, and request state. */ private void sendingRequest(SendingRequestEvent event) { this.lastOperationTypeSent = BlobOperationDescriptor.getOperationType( (HttpURLConnection) event.getConnectionObject()); }
@Override public void eventOccurred(SendingRequestEvent eventArg) { assertNotNull(((HttpURLConnection) eventArg.getConnectionObject()) .getRequestProperty(BlobConstants.BLOB_CONTENT_MD5_HEADER)); callList.add(true); } };
@Override public void eventOccurred(SendingRequestEvent eventArg) { HttpURLConnection conn = (HttpURLConnection)eventArg.getConnectionObject(); assertNull(conn.getRequestProperty("Content-MD5")); } });
@Override public void eventOccurred(SendingRequestEvent eventArg) { HttpURLConnection conn = (HttpURLConnection)eventArg.getConnectionObject(); assertNotNull(conn.getRequestProperty("Content-MD5")); } });
@Override public void eventOccurred(SendingRequestEvent eventArg) { HttpURLConnection connection = (HttpURLConnection) eventArg.getConnectionObject(); assertEquals("no-cache", connection.getHeaderField(Constants.HeaderConstants.CACHE_CONTROL)); assertEquals("attachment; filename=\"fname.ext\"", connection.getHeaderField(Constants.HeaderConstants.CONTENT_DISPOSITION)); assertEquals("gzip", connection.getHeaderField(Constants.HeaderConstants.CONTENT_ENCODING)); assertEquals("da", connection.getHeaderField(Constants.HeaderConstants.CONTENT_LANGUAGE)); assertEquals("text/html; charset=utf-8", connection.getHeaderField(Constants.HeaderConstants.CONTENT_TYPE)); } });
@Override public void eventOccurred(SendingRequestEvent eventArg) { HttpURLConnection connection = (HttpURLConnection) eventArg.getConnectionObject(); assertEquals("no-cache", connection.getHeaderField(Constants.HeaderConstants.CACHE_CONTROL)); assertEquals("attachment; filename=\"fname.ext\"", connection.getHeaderField(Constants.HeaderConstants.CONTENT_DISPOSITION)); assertEquals("gzip", connection.getHeaderField(Constants.HeaderConstants.CONTENT_ENCODING)); assertEquals("da", connection.getHeaderField(Constants.HeaderConstants.CONTENT_LANGUAGE)); assertEquals("text/html; charset=utf-8", connection.getHeaderField(Constants.HeaderConstants.CONTENT_TYPE)); } });
@Override public void eventOccurred(SendingRequestEvent eventArg) { HttpURLConnection con = (HttpURLConnection) eventArg.getConnectionObject(); // Test the copy destination request url assertEquals(CloudBlockBlobTests.this.container.getUri() + "/destchinesecharsblob%E9%98%BF%E4%B6%B5.txt", con.getURL().toString()); // Test the copy source request property assertEquals(CloudBlockBlobTests.this.container.getUri() + "/sourcechinescharsblob%E9%98%BF%E4%B6%B5.txt", con.getRequestProperty("x-ms-copy-source")); } });
@Override public void eventOccurred(SendingRequestEvent eventArg) { if (((HttpURLConnection) eventArg.getConnectionObject()).getRequestMethod().equals("DELETE")) { try { table.delete(); assertFalse(table.exists()); } catch (StorageException e) { fail("Delete should succeed."); } } } });
@Override public void eventOccurred(SendingRequestEvent eventArg) { if (((HttpURLConnection) eventArg.getConnectionObject()).getRequestMethod().equals("DELETE")) { try { directory.delete(); assertFalse(directory.exists()); } catch (Exception e) { fail("Delete should succeed."); } } } });
@Override public void eventOccurred(SendingRequestEvent eventArg) { HttpURLConnection connection = (HttpURLConnection) eventArg.getConnectionObject(); assertNotNull(connection.getRequestProperty("If-Unmodified-Since")); assertNotNull(connection.getRequestProperty("If-Match")); } };
@Override public void eventOccurred(SendingRequestEvent eventArg) { HttpURLConnection connection = (HttpURLConnection) eventArg.getConnectionObject(); assertNull(connection.getRequestProperty("x-ms-foo")); assertNull(connection.getRequestProperty("x-ms-hello")); } });
@Override public void eventOccurred(SendingRequestEvent eventArg) { HttpURLConnection connection = (HttpURLConnection) eventArg.getConnectionObject(); assertNotNull(connection.getRequestProperty("x-ms-foo")); assertNotNull(connection.getRequestProperty("x-ms-hello")); } };