You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by go...@apache.org on 2017/08/22 16:06:22 UTC
incubator-slider git commit: SLIDER-1238 Remove unused private method
in AMWebClient
Repository: incubator-slider
Updated Branches:
refs/heads/develop 43887868b -> 1563ad8b4
SLIDER-1238 Remove unused private method in AMWebClient
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/1563ad8b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/1563ad8b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/1563ad8b
Branch: refs/heads/develop
Commit: 1563ad8b456ce23820984522c337d4d2a5457f7a
Parents: 4388786
Author: Gour Saha <go...@apache.org>
Authored: Tue Aug 22 09:04:41 2017 -0700
Committer: Gour Saha <go...@apache.org>
Committed: Tue Aug 22 09:05:30 2017 -0700
----------------------------------------------------------------------
.../core/registry/retrieve/AMWebClient.java | 64 +-------------------
1 file changed, 2 insertions(+), 62 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/1563ad8b/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java b/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
index 40fa217..497e71d 100644
--- a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
+++ b/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
@@ -18,31 +18,16 @@
package org.apache.slider.core.registry.retrieve;
-import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.GenericType;
import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.api.json.JSONConfiguration;
-import com.sun.jersey.client.urlconnection.HttpURLConnectionFactory;
-import com.sun.jersey.client.urlconnection.URLConnectionClientHandler;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.security.ssl.SSLFactory;
import org.apache.slider.client.rest.BaseRestClient;
import org.apache.slider.core.restclient.HttpVerb;
import org.apache.slider.core.restclient.UgiJerseyBinding;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLSocketFactory;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URI;
-import java.net.URL;
/**
* Class to retrieve artifacts from the AM's web site. This sets up
@@ -63,52 +48,6 @@ public class AMWebClient {
}
-
- private static URLConnectionClientHandler getUrlConnectionClientHandler() {
- return new URLConnectionClientHandler(new HttpURLConnectionFactory() {
- @Override
- public HttpURLConnection getHttpURLConnection(URL url)
- throws IOException {
- HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- if (connection.getResponseCode() == HttpURLConnection.HTTP_MOVED_TEMP) {
- // is a redirect - are we changing schemes?
- String redirectLocation = connection.getHeaderField(HttpHeaders.LOCATION);
- String originalScheme = url.getProtocol();
- String redirectScheme = URI.create(redirectLocation).getScheme();
- if (!originalScheme.equals(redirectScheme)) {
- // need to fake it out by doing redirect ourselves
- log.info("Protocol change during redirect. Redirecting {} to URL {}",
- url, redirectLocation);
- URL redirectURL = new URL(redirectLocation);
- connection = (HttpURLConnection) redirectURL.openConnection();
- }
- }
- if (connection instanceof HttpsURLConnection) {
- log.debug("Attempting to configure HTTPS connection using client "
- + "configuration");
- final SSLFactory factory;
- final SSLSocketFactory sf;
- final HostnameVerifier hv;
-
- try {
- HttpsURLConnection c = (HttpsURLConnection) connection;
- factory = new SSLFactory(SSLFactory.Mode.CLIENT, new Configuration());
- factory.init();
- sf = factory.createSSLSocketFactory();
- hv = factory.getHostnameVerifier();
- c.setSSLSocketFactory(sf);
- c.setHostnameVerifier(hv);
- } catch (Exception e) {
- log.info("Unable to configure HTTPS connection from "
- + "configuration. Using JDK properties.");
- }
-
- }
- return connection;
- }
- });
- }
-
public WebResource resource(String url) {
return restClient.resource(url);
}
@@ -126,7 +65,8 @@ public class AMWebClient {
* @return an instance of the type T
* @throws IOException on any failure
*/
- public <T> T exec(HttpVerb method, WebResource resource, Class<T> c) throws IOException {
+ public <T> T exec(HttpVerb method, WebResource resource, Class<T> c)
+ throws IOException {
return restClient.exec(method, resource, c);
}