Examples of UrlEncodedFormEntity


Examples of org.apache.http.client.entity.UrlEncodedFormEntity

                subpath, junitServletUrl);
        final Request r = builder
        .buildPostRequest(subpath.toString())
        .withCredentials(username, password)
        .withCustomizer(requestCustomizer)
        .withEntity(new UrlEncodedFormEntity(opt));
        executor.execute(r).assertStatus(200);

        return executor;
    }
View Full Code Here

Examples of org.apache.http.client.entity.UrlEncodedFormEntity

  public static Map<String, Object> post(String url, Map<String, Object> body, Integer connectionTimeout, Integer soTimeout) throws Exception
  {
    HttpClient client = getHttpClient(url, connectionTimeout, soTimeout);
    HttpPost httppost = new HttpPost(url);
    List<NameValuePair> formParams = setParams(httppost, body);
    UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, "UTF-8");
    httppost.setEntity(entity);
    long t1 = System.currentTimeMillis();
    HttpResponse response = client.execute(httppost);
    long t2 = System.currentTimeMillis();
    NewRelic.addCustomParameter(System.currentTimeMillis()+"--"+url, (t2 - t1) + " ms");
View Full Code Here

Examples of org.apache.http.client.entity.UrlEncodedFormEntity

            if (!serverName.equals("localhost")) {
                httpPost.getParams().setParameter(ClientPNames.VIRTUAL_HOST, new HttpHost(serverName, 8080));
            }
            List<NameValuePair> formparams = new ArrayList<NameValuePair>();
            formparams.add(new BasicNameValuePair(name, value));
            UrlEncodedFormEntity entity;
            try {
                entity = new UrlEncodedFormEntity(formparams, "UTF-8");
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            }
            httpPost.setEntity(entity);
            request = httpPost;
View Full Code Here

Examples of org.apache.http.client.entity.UrlEncodedFormEntity

    authenticateParameterList(params);
    WSResponse wsResponse;
    HttpClient httpClient = getHttpClient();
    try {
      HttpPost httpPost = new HttpPost(getURI(params));
      httpPost.setEntity(new UrlEncodedFormEntity(params, CharSet.UTF8));
      HttpResponse response = httpClient.execute(httpPost);
      int statusCode = response.getStatusLine().getStatusCode();
      HttpEntity responseEntity = response.getEntity();
      String responseBody = EntityUtils.toString(responseEntity);
      EntityUtils.consume(responseEntity);
View Full Code Here

Examples of org.apache.http.client.entity.UrlEncodedFormEntity

          HttpPost httppost = new HttpPost("http://" + this.strurl+ "/higo/insert.jsp");
          List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
          nameValuePairs.add(new BasicNameValuePair("project",parser.tablename));
          nameValuePairs.add(new BasicNameValuePair("json", parser.jsons));

          httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs,"UTF-8"));

          HttpResponse response = httpclient.execute(httppost);

          InputStream is = response.getEntity().getContent();
          BufferedInputStream bis = new BufferedInputStream(is);
View Full Code Here

Examples of org.apache.http.client.entity.UrlEncodedFormEntity

      if (parser.order != null) {
        nameValuePairs
            .add(new BasicNameValuePair("order", parser.order));
      }

      httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs,"UTF-8"));

      HttpResponse response = httpclient.execute(httppost);

      InputStream is = response.getEntity().getContent();
      BufferedInputStream bis = new BufferedInputStream(is);
View Full Code Here

Examples of org.apache.http.client.entity.UrlEncodedFormEntity

      if (param[0] != null && param[1] != null) {
    formparams.add(new BasicNameValuePair(param[0], param[1]));
      }
  }

  UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");

  return executePost(url, entity, headerParams);
    }
View Full Code Here

Examples of org.apache.http.client.entity.UrlEncodedFormEntity

                NameValuePair nameValuePair = new BasicNameValuePair(entry.getKey(), effectiveValue);
                nameValuePairs.add(nameValuePair);
            }

            HttpEntity encodedFormEntity = new UrlEncodedFormEntity(nameValuePairs, Consts.UTF_8);
            request.setEntity(encodedFormEntity);
        }

        return request;
    }
View Full Code Here

Examples of org.apache.http.client.entity.UrlEncodedFormEntity

                  entity.addPart(p);
                }
                post.setEntity(entity);
              } else {
                //not using multipart
                post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
              }

              method = post;
            }
            // It is has one stream, it is the post body, put the params in the URL
View Full Code Here

Examples of org.apache.http.client.entity.UrlEncodedFormEntity

            nvps.add(new BasicNameValuePair(param,value));
          }
        }
        try
        {
          postMethod.setEntity(new UrlEncodedFormEntity(nvps,HTTP.UTF_8));
        }
        catch (java.io.UnsupportedEncodingException e)
        {
          throw new ManifoldCFException("Unsupported UTF-8 encoding: "+e.getMessage(),e);
        }
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.