ui/src/main/java/ucar/nc2/util/net/HttpClientManager.java
public static int putContent(String urlencoded, String content) throws IOException
  {
    try (HTTPMethod m = HTTPFactory.Put(urlencoded)) {

      m.setRequestContent(new StringEntity(content, "application/text", "UTF-8"));
      m.execute();

      int resultCode = m.getStatusCode();

      // followRedirect wont work for PUT
      if (resultCode == 302) {
        String redirectLocation;
        Header locationHeader = m.getResponseHeader("location");
        if (locationHeader != null) {
          redirectLocation = locationHeader.getValue();
          resultCode = putContent(redirectLocation, content);
        }
      }
      return resultCode;
    }
  }
public static int putContent(String urlencoded, String content) throws IOException
  {
    try (HTTPMethod m = HTTPFactory.Put(urlencoded)) {

      m.setRequestContent(new StringEntity(content, "application/text", "UTF-8"));
      m.execute();

      int resultCode = m.getStatusCode();

      // followRedirect wont work for PUT
      if (resultCode == 302) {
        String redirectLocation;
        Header locationHeader = m.getResponseHeader("location");
        if (locationHeader != null) {
          redirectLocation = locationHeader.getValue();
          resultCode = putContent(redirectLocation, content);
        }
      }
      return resultCode;
    }
  }
Put content to a url, using HTTP PUT. Handles one level of 302 redirection.

@param urlencoded url as a String
@param content    PUT this content at the given url.
@return the HTTP status return code
@throws java.io.IOException on error