Package org.apache.commons.httpclient.methods

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


      }
    }

    public DoReauthorizationResponseType doReauthorization(DoReauthorizationReq doReauthorizationRequest) throws RemoteException {
      PostMethod post = new PostMethod(getApiAAUrl().toExternalForm());
      post.addParameters(doReauthorizationRequest.getDoReauthorizationRequest().getNVPFields(getCredentials()));
      try {
        client.executeMethod(post);
        if (post.getStatusCode() == HttpStatus.SC_OK) {
          return new DoReauthorizationResponseType(post.getResponseBodyAsStream());
        }
View Full Code Here


      }
    }

    public DoVoidResponseType doVoid(DoVoidReq doVoidRequest) throws RemoteException {
      PostMethod post = new PostMethod(getApiAAUrl().toExternalForm());
      post.addParameters(doVoidRequest.getDoVoidRequest().getNVPFields(getCredentials()));
      try {
        client.executeMethod(post);
        if (post.getStatusCode() == HttpStatus.SC_OK) {
          return new DoVoidResponseType(post.getResponseBodyAsStream());
        }
View Full Code Here

      }
    }

    public GetExpressCheckoutDetailsResponseType getExpressCheckoutDetails(GetExpressCheckoutDetailsReq getExpressCheckoutDetailsRequest) throws RemoteException {
      PostMethod post = new PostMethod(getApiAAUrl().toExternalForm());
      post.addParameters(getExpressCheckoutDetailsRequest.getGetExpressCheckoutDetailsRequest().getNVPFields(getCredentials()));
      try {
        client.executeMethod(post);
        if (post.getStatusCode() == HttpStatus.SC_OK) {
          return new GetExpressCheckoutDetailsResponseType(post.getResponseBodyAsStream());
        }
View Full Code Here

        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

    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

        }

        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

      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

          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

   * @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

   * @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

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.