Package java.net

Examples of java.net.HttpURLConnection.addRequestProperty()


              "/webhdfs/v1/{0}?user.name={1}&permission={2}&op=CREATE",
              filename, user, perms);
    }
    URL url = new URL(TestJettyHelper.getJettyURL(), pathOps);
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.addRequestProperty("Content-Type", "application/octet-stream");
    conn.setRequestMethod("PUT");
    conn.connect();
    Assert.assertEquals(HttpURLConnection.HTTP_CREATED, conn.getResponseCode());
  }
View Full Code Here


        + "/mapOutput?job=job_12345_0001&reduce=0&map=attempt_12345_1_m_1_0");
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    String encHash = SecureShuffleUtils.hashFromString(
        SecureShuffleUtils.buildMsgFrom(url),
        JobTokenSecretManager.createSecretKey(jt.getPassword()));
    conn.addRequestProperty(
        SecureShuffleUtils.HTTP_HEADER_URL_HASH, encHash);
    conn.setRequestProperty(ShuffleHeader.HTTP_HEADER_NAME,
        ShuffleHeader.DEFAULT_HTTP_HEADER_NAME);
    conn.setRequestProperty(ShuffleHeader.HTTP_HEADER_VERSION,
        ShuffleHeader.DEFAULT_HTTP_HEADER_VERSION);
View Full Code Here

      String msgToEncode = SecureShuffleUtils.buildMsgFrom(url);
      String encHash = SecureShuffleUtils.hashFromString(msgToEncode,
          shuffleSecretKey);
     
      // put url hash into http header
      connection.addRequestProperty(
          SecureShuffleUtils.HTTP_HEADER_URL_HASH, encHash);
      // set the read timeout
      connection.setReadTimeout(readTimeout);
      connect(connection, connectionTimeout);
      input = new DataInputStream(connection.getInputStream());
View Full Code Here

                      continue;
                  }
                  // Ensure that the header is allowed
                  if(true/*isHeaderAllowed(headerName)*/) {
                      String headerValue = request.getHeader(headerName);
                      httpCon.addRequestProperty(headerName, headerValue);
                  }
              }
            }
           
            httpCon.connect();
View Full Code Here

        // replace value
        conn.setRequestProperty("Key", "value2");
        h.check(conn.getRequestProperty("Key").equals("value2"));
       
        // add some stuff
        conn.addRequestProperty("Anotherkey", "value");
        conn.addRequestProperty("Anotherkey", "value2");
       
        // the last is returned
        h.check(conn.getRequestProperty("Anotherkey").equals("value2"));
       
View Full Code Here

        conn.setRequestProperty("Key", "value2");
        h.check(conn.getRequestProperty("Key").equals("value2"));
       
        // add some stuff
        conn.addRequestProperty("Anotherkey", "value");
        conn.addRequestProperty("Anotherkey", "value2");
       
        // the last is returned
        h.check(conn.getRequestProperty("Anotherkey").equals("value2"));
       
       
View Full Code Here

        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");
    
        h.checkPoint("LowerUpperCase request properties tests");
       
        conn.addRequestProperty("Key", "value");
       
        // getRequestProperty is case insensitiv
        h.check(conn.getRequestProperty("key").equals("value"));
       
        // replacement of value does not replace the key name
View Full Code Here

        // however replacement is case insensitiv
        conn.setRequestProperty("key", "value2");
        h.check(conn.getRequestProperty("key").equals("value2"));
          
        // add some stuff
        conn.addRequestProperty("Anotherkey", "value");
        conn.addRequestProperty("anotherkey", "value2");
        conn.addRequestProperty("anotherkey", "value3");
       
        // get is case insensitiv
        h.check(conn.getRequestProperty("Anotherkey").equals("value3"));
View Full Code Here

        conn.setRequestProperty("key", "value2");
        h.check(conn.getRequestProperty("key").equals("value2"));
          
        // add some stuff
        conn.addRequestProperty("Anotherkey", "value");
        conn.addRequestProperty("anotherkey", "value2");
        conn.addRequestProperty("anotherkey", "value3");
       
        // get is case insensitiv
        h.check(conn.getRequestProperty("Anotherkey").equals("value3"));
             
View Full Code Here

        h.check(conn.getRequestProperty("key").equals("value2"));
          
        // add some stuff
        conn.addRequestProperty("Anotherkey", "value");
        conn.addRequestProperty("anotherkey", "value2");
        conn.addRequestProperty("anotherkey", "value3");
       
        // get is case insensitiv
        h.check(conn.getRequestProperty("Anotherkey").equals("value3"));
             
        Map props = conn.getRequestProperties();           
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.