Package org.apache.commons.httpclient.methods

Examples of org.apache.commons.httpclient.methods.PostMethod.addParameter()


          URLEncoder.encode(description, "UTF-8")
      });
      final PostMethod filePost = new PostMethod(url + fullpath);
      if (username != null)
      {
        filePost.addParameter("user", username);
      }
      if (password != null)
      {
        filePost.addParameter("password", password);
      }
View Full Code Here


                            if (authCount++ > 3) {
                                log.hyperlink(getCredentialPageUrl(),"Your Oracle account doesn't appear valid. Please specify a valid username/password\n");
                                throw new AbortException("Unable to install JDK unless a valid username/password is provided.");
                            }
                        }
                        post.addParameter(n, v);
                    }

                    m = post;
                } else {
                    log.getLogger().println("Downloading " + m.getResponseContentLength() + "bytes");
View Full Code Here

    public void testPostCantAddParamAfterBodySet() throws Exception {
        PostMethod post = new PostMethod("/foo");
        post.setRequestBody("this+is+the+body");
        try {
            post.addParameter("name","value");
            fail("Expected IllegalStateException");
        } catch(IllegalStateException e) {
            // expected
        }
    }
View Full Code Here

    }

    /** Ensure setRequestBody fails after addParameter is called. */
    public void testPostCantSetBodyAfterAddParam() throws Exception {
        PostMethod post = new PostMethod("/foo");
        post.addParameter("name","value");
        try {
            post.setRequestBody("this+is+the+body");
            fail("Expected IllegalStateException");
        } catch(IllegalStateException e) {
            // expected
View Full Code Here

        //no parameters
        assertNull(post.getParameter("non-existant"));
        assertEquals(0, post.getParameters().length);

        //add one parameter
        post.addParameter(NAME,VALUE);
        assertEquals(PAIR, post.getParameter(NAME));
        assertEquals(1, post.getParameters().length);

        //add another parameter
        post.addParameter(PAIR0);
View Full Code Here

        post.addParameter(NAME,VALUE);
        assertEquals(PAIR, post.getParameter(NAME));
        assertEquals(1, post.getParameters().length);

        //add another parameter
        post.addParameter(PAIR0);
        assertEquals(PAIR0, post.getParameter(PAIR0.getName()));
        assertEquals(2, post.getParameters().length);

        //add two more parameters
        post.addParameters(new NameValuePair[]{ PAIR1, PAIR2 });
View Full Code Here

    public void testPostAddParameterErrorCases() {
        PostMethod post = new PostMethod();

        //add null paramters
        try{
            post.addParameter(null);
            fail("Expected IllegalArgumentException");
        } catch(IllegalArgumentException e) { }

        try{
            post.addParameter(null, "value");
View Full Code Here

            post.addParameter(null);
            fail("Expected IllegalArgumentException");
        } catch(IllegalArgumentException e) { }

        try{
            post.addParameter(null, "value");
            fail("Expected IllegalArgumentException");
        } catch(IllegalArgumentException e) { }

        try{
            post.addParameter("name", null);
View Full Code Here

            post.addParameter(null, "value");
            fail("Expected IllegalArgumentException");
        } catch(IllegalArgumentException e) { }

        try{
            post.addParameter("name", null);
            fail("Expected IllegalArgumentException");
        } catch(IllegalArgumentException e) { }
    }

    /** Adding the same parameter twice should be OK. */
 
View Full Code Here

    /** Adding the same parameter twice should be OK. */
    public void testPostAddSameParameter() {
        PostMethod post = new PostMethod();

        //add same parameter twice
        post.addParameter(PAIR0);
        post.addParameter(PAIR0);

        assertEquals(2, post.getParameters().length);
        NameValuePair[] pairs = post.getParameters();
        assertEquals(pairs[0], pairs[1]);
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.