Package org.apache.commons.httpclient.methods

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


    private void assertCustomPostOperation(String operationName, String markerPropertyName) throws Exception {
        final String jsonPath = testNode.nodeUrl + ".tidy.json";
        assertFalse("Expecting no marker before POST", getContent(jsonPath, CONTENT_TYPE_JSON).contains(markerPropertyName));
       
        final PostMethod post = new PostMethod(testNode.nodeUrl);
        post.addParameter(":operation", operationName);

        assertEquals("Expecting 200 status on POST", 200, httpClient.executeMethod(post));
        assertTrue("Expecting marker to be present after POST", getContent(jsonPath, CONTENT_TYPE_JSON).contains(markerPropertyName));
    }
View Full Code Here


        final PostMethod post = new PostMethod(url);
        post.setFollowRedirects(false);
       
        if(acceptHeaderValue != null) {
            if(useHttpEquiv) {
                post.addParameter(":http-equiv-accept", acceptHeaderValue);
            } else {
                post.addRequestHeader("Accept", acceptHeaderValue);
            }
        }
       
View Full Code Here

      // Perform a POST that fails: invalid PostServlet operation
      // with Accept header set to JSON 
      final String url = HTTP_BASE_URL + "/" + MY_TEST_PATH;
      final PostMethod post = new PostMethod(url);
      post.setFollowRedirects(false);
      post.addParameter(new NameValuePair(
          SlingPostConstants.RP_OPERATION,
          "InvalidTestOperationFor" + getClass().getSimpleName()));
      post.addRequestHeader("Accept", CONTENT_TYPE_JSON);

      final int status = httpClient.executeMethod(post);
View Full Code Here

            // GET and POST accept args differently
            if ( method instanceof PostMethod )
            {
                // add POST data
                PostMethod postMethod = (PostMethod)method ;
                postMethod.addParameter(userNameParam, userName);
                postMethod.addParameter(passwordParam, password);
            }
            else
            {
                // augment GET query string
View Full Code Here

            if ( method instanceof PostMethod )
            {
                // add POST data
                PostMethod postMethod = (PostMethod)method ;
                postMethod.addParameter(userNameParam, userName);
                postMethod.addParameter(passwordParam, password);
            }
            else
            {
                // augment GET query string
                NameValuePair[] authPairs = new NameValuePair[]{ new NameValuePair(userNameParam, userName), new NameValuePair(passwordParam, password) } ;
View Full Code Here

                if (vals != null) {
                  for (String v : vals) {
                    if (this.useMultiPartPost || isMultipart) {
                      parts.add(new StringPart(p, v, "UTF-8"));
                    } else {
                      post.addParameter(p, v);
                    }
                  }
                }
              }
View Full Code Here

    }
    StringWriter writer = new StringWriter();
   
    HttpClient client = new HttpClient();
    PostMethod post = new PostMethod(getURL());
    post.addParameter("day", _day);
    post.addParameter("month", _month);
    post.addParameter("year", _year);
    post.addParameter("uname", getDownloadUser());
    post.addParameter("pword", getDownloadPassword());
    if (LOG.isDebugEnabled()) {
View Full Code Here

    StringWriter writer = new StringWriter();
   
    HttpClient client = new HttpClient();
    PostMethod post = new PostMethod(getURL());
    post.addParameter("day", _day);
    post.addParameter("month", _month);
    post.addParameter("year", _year);
    post.addParameter("uname", getDownloadUser());
    post.addParameter("pword", getDownloadPassword());
    if (LOG.isDebugEnabled()) {
      LOG.debug("Downloading log from [" + getURL() + "]");
View Full Code Here

   
    HttpClient client = new HttpClient();
    PostMethod post = new PostMethod(getURL());
    post.addParameter("day", _day);
    post.addParameter("month", _month);
    post.addParameter("year", _year);
    post.addParameter("uname", getDownloadUser());
    post.addParameter("pword", getDownloadPassword());
    if (LOG.isDebugEnabled()) {
      LOG.debug("Downloading log from [" + getURL() + "]");
    }
View Full Code Here

    HttpClient client = new HttpClient();
    PostMethod post = new PostMethod(getURL());
    post.addParameter("day", _day);
    post.addParameter("month", _month);
    post.addParameter("year", _year);
    post.addParameter("uname", getDownloadUser());
    post.addParameter("pword", getDownloadPassword());
    if (LOG.isDebugEnabled()) {
      LOG.debug("Downloading log from [" + getURL() + "]");
    }
    try {
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.