Examples of addParameters()


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

        post.addParameter(PAIR0);
        assertEquals(PAIR0, post.getParameter(PAIR0.getName()));
        assertEquals(2, post.getParameters().length);

        //add two more parameters
        post.addParameters(new NameValuePair[]{ PAIR1, PAIR2 });
        assertEquals(4, post.getParameters().length);
        NameValuePair[] parameters = post.getParameters();
        for (int i=0; i<parameters.length; i++){
            NameValuePair pair = parameters[i];
            assertEquals(pair, post.getParameter(pair.getName()));
View Full Code Here

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

    public void testPostParametersEncoding() throws IOException {
        PostMethod post = new PostMethod();
        post.addParameter(PAIR);
        assertEquals("name=value", post.getRequestBodyAsString());

        post.addParameters(new NameValuePair[]{ PAIR1, PAIR2 });
        assertEquals("name=value&name1=value1&name2=value2",
            post.getRequestBodyAsString());

        post.addParameter("hasSpace", "a b c d");
        assertEquals("name=value&name1=value1&name2=value2&hasSpace=a%20b%20c%20d",
View Full Code Here

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

        }

        HttpMethodBase method;
        if (request.getMethodName() == HttpMethodName.POST) {
            PostMethod postMethod = new PostMethod(uri);
            if (nameValuePairs != null) postMethod.addParameters(nameValuePairs);
            method = postMethod;
        } else if (request.getMethodName() == HttpMethodName.GET) {
            GetMethod getMethod = new GetMethod(uri);
            if (nameValuePairs != null) getMethod.setQueryString(nameValuePairs);
            method = getMethod;
View Full Code Here

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

      fLogger.debug("POST to " + url); //$NON-NLS-1$
      PostMethod method = new PostMethod(url);
      method.setDoAuthentication(true);
     
      if(this.parameters.length > 0) {
        method.addParameters(this.parameters);
      } else {
        method.setRequestEntity(new InputStreamRequestEntity(request.getInputStream()));
      }
     
      return executeMethod(method, request, properties);
View Full Code Here

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

          new NameValuePair("lgdomain", user.getDomain()) };
    } else {
      params = new NameValuePair[] { new NameValuePair("action", "login"), new NameValuePair("format", "xml"),
          new NameValuePair("lgname", userName), new NameValuePair("lgpassword", user.getPassword()) };
    }
    method.addParameters(params);

    try {
      int responseCode = client.executeMethod(method);
      if (responseCode == HttpStatus.SC_OK) {
        String responseBody = method.getResponseBodyAsString();
View Full Code Here

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

   * @return the raw XML string produced by the query; <code>null</code>
   *         otherwise
   */
  private String sendXML(User user, RequestBuilder requestBuilder) {
    PostMethod method = createAuthenticatedPostMethod(user);
    method.addParameters(requestBuilder.getParameters());
    // if (params != null && !params.isEmpty()) {
    // for (Map.Entry entry : params.entrySet()) {
    // method.addParameter(new NameValuePair((String) entry.getKey(), (String)
    // entry.getValue()));
    // }
View Full Code Here

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

   * @return the raw XML string produced by the query; <code>null</code>
   *         otherwise
   */
  private String sendXML(User user, RequestBuilder requestBuilder) {
    PostMethod method = createAuthenticatedPostMethod(user);
    method.addParameters(requestBuilder.getParameters());
    // if (params != null && !params.isEmpty()) {
    // for (Map.Entry entry : params.entrySet()) {
    // method.addParameter(new NameValuePair((String) entry.getKey(), (String)
    // entry.getValue()));
    // }
View Full Code Here

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

        new NameValuePair(WP_SECTION, ""), new NameValuePair(WP_STARTTIME, fPageData.getStartTime()),
        new NameValuePair(WP_EDITTIME, fPageData.getEditTime()), new NameValuePair(WP_SCROLLTOP, ""),
        new NameValuePair(WP_TEXTBOX1, newEditText), new NameValuePair(WP_SUMMARY, ""), new NameValuePair(WP_SAVE, "Save page"),
        new NameValuePair(WP_EDITTOKEN, fPageData.getEditToken()), new NameValuePair(WP_AUTOSUMMARY, fPageData.getAutoSummary())
    };
    method.addParameters(params);

    try {

      // Execute the request.
      responseCode = fHttpClient.executeMethod(method);
View Full Code Here

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

        new NameValuePair("title", "Special:Userlogin"), new NameValuePair("action", "submit"), new NameValuePair("wpName", user),
        new NameValuePair("wpPassword", password), new NameValuePair("wpRemember", remember ? "1" : "0"),
        // new NameValuePair("wpDomain", domain),
        new NameValuePair("wpLoginattempt", "submit")
    };
    method.addParameters(params);

    boolean result;
    try {
      int responseCode = fHttpClient.executeMethod(method);
      String responseBody = method.getResponseBodyAsString();
View Full Code Here

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

          new NameValuePair("lgdomain", user.getDomain()) };
    } else {
      params = new NameValuePair[] { new NameValuePair("action", "login"), new NameValuePair("format", "xml"),
          new NameValuePair("lgname", userName), new NameValuePair("lgpassword", user.getPassword()) };
    }
    method.addParameters(params);

    try {
      int responseCode = client.executeMethod(method);
      if (responseCode == HttpStatus.SC_OK) {
        String responseBody = getAsXmlString(method);
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.