Repository: incubator-slider
Updated Branches:
  refs/heads/develop 4e7ef8b09 -> 5c6b0f10b


SLIDER-859 clean up some of the REST client code


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/5c6b0f10
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/5c6b0f10
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/5c6b0f10

Branch: refs/heads/develop
Commit: 5c6b0f10b90516879161d0f88ec00ec414ad5043
Parents: 4e7ef8b
Author: Steve Loughran <[email protected]>
Authored: Wed Apr 22 17:45:41 2015 +0100
Committer: Steve Loughran <[email protected]>
Committed: Wed Apr 22 17:45:41 2015 +0100

----------------------------------------------------------------------
 .../core/restclient/UgiJerseyBinding.java       |  1 +
 .../restclient/UrlConnectionOperations.java     | 48 --------------------
 .../web/rest/publisher/PublisherResource.java   |  2 +-
 3 files changed, 2 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5c6b0f10/slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java
----------------------------------------------------------------------
diff --git 
a/slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java
 
b/slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java
index cad3c69..2526684 100644
--- 
a/slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java
+++ 
b/slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java
@@ -52,6 +52,7 @@ public class UgiJerseyBinding implements
     HttpURLConnectionFactory {
   private static final Logger log =
       LoggerFactory.getLogger(UgiJerseyBinding.class);
+
   private final UrlConnectionOperations operations;
   private final URLConnectionClientHandler handler;
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5c6b0f10/slider-core/src/main/java/org/apache/slider/core/restclient/UrlConnectionOperations.java
----------------------------------------------------------------------
diff --git 
a/slider-core/src/main/java/org/apache/slider/core/restclient/UrlConnectionOperations.java
 
b/slider-core/src/main/java/org/apache/slider/core/restclient/UrlConnectionOperations.java
index e6b08c1..49fe5ea 100644
--- 
a/slider-core/src/main/java/org/apache/slider/core/restclient/UrlConnectionOperations.java
+++ 
b/slider-core/src/main/java/org/apache/slider/core/restclient/UrlConnectionOperations.java
@@ -96,54 +96,6 @@ public class UrlConnectionOperations extends Configured  {
   }
 
 
-  /**
-   * Opens a url.
-   * <p>
-   *   This implementation
-   *   <ol>
-   *     <li>Handles protocol switching during redirects</li>
-   *     <li>Handles 307 responses "redirect with same verb"</li>
-   *   </ol>
-   *
-   * @param url to open
-   * @return URLConnection
-   * @throws IOException
-   * @throws AuthenticationException authentication failure
-   */
-  public HttpURLConnection openConnectionRedirecting(URL url) throws
-      IOException,
-      AuthenticationException {
-    HttpURLConnection connection = innerOpenConnection(url);
-    connection.setUseCaches(false);
-    int responseCode = connection.getResponseCode();
-    if (responseCode == HttpServletResponse.SC_MOVED_TEMPORARILY 
-        || responseCode == HttpServletResponse.SC_TEMPORARY_REDIRECT) {
-      log.debug("Redirected with response {}", responseCode);
-      // is a redirect - are we changing schemes?
-      String redirectLocation = 
connection.getHeaderField(HttpHeaders.LOCATION);
-      String originalScheme = url.getProtocol();
-      String redirectScheme = URI.create(redirectLocation).getScheme();
-      boolean buildNewUrl = false;
-      if (!originalScheme.equals(redirectScheme)) {
-        // need to fake it out by doing redirect ourselves
-        log.debug("Protocol change during redirect");
-        buildNewUrl = true;
-      } else if (responseCode == HttpServletResponse.SC_TEMPORARY_REDIRECT) {
-        // 307 response
-        buildNewUrl = true;
-      }
-
-      if (buildNewUrl) {
-        // perform redirect ourselves
-        log.debug("Redirecting {} to URL {}",
-            url, redirectLocation);
-        URL redirectURL = new URL(redirectLocation);
-        connection = innerOpenConnection(url);
-      }
-    }
-
-    return connection;
-  }
 
   protected HttpURLConnection innerOpenConnection(URL url) throws
       IOException,

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/5c6b0f10/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java
----------------------------------------------------------------------
diff --git 
a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java
 
b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java
index 431d50f..b4a72b4 100644
--- 
a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java
+++ 
b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java
@@ -265,7 +265,7 @@ public class PublisherResource extends 
AbstractSliderResource {
           propertyName, config);
       throw new NotFoundException("Property not found: " + propertyName);
     }
-    Map<String, String> rtnVal = new HashMap<String, String>();
+    Map<String, String> rtnVal = new HashMap<>();
     rtnVal.put(propertyName, propVal);
 
     return rtnVal;

Reply via email to