Package org.apache.http.client.entity

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


      if (verifytoken !=null)
        nvps.add(new BasicNameValuePair("hub.verify_token", verifytoken));
         
      webserver.addAction("subscribe",topic_url, verifytoken);
       
      httppost.setEntity(new UrlEncodedFormEntity(nvps));
      httppost.setHeader("Content-type", "application/x-www-form-urlencoded");
      httppost.setHeader("User-agent", "RSS pubsubhubbub 0.3");

      //create the thread and start it running
      GetThread thread = new GetThread(httpClient, httppost);
View Full Code Here


      if (verifytoken !=null)
        nvps.add(new BasicNameValuePair("hub.verify_token", verifytoken));
             
      webserver.addAction("unsubscribe",topic_url,verifytoken);

      httppost.setEntity(new UrlEncodedFormEntity(nvps));

      httppost.setHeader("Content-type", "application/x-www-form-urlencoded");
      httppost.setHeader("User-agent", "ERGO RSS pubsubhubbub 0.3");

      //create the thread and start it running
View Full Code Here

        String responseStr = null;
        try
        {
            HttpPost httpost = new HttpPost(host + urlPostfix);
      httpost.addHeader("Accept-Encoding", "gzip");
            httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));

            // execute postMethod
            HttpResponse postResponse = httpClient.execute(httpost);
      HttpEntity entity = postResponse.getEntity();
     
View Full Code Here

     List <NameValuePair> nvps = new ArrayList<NameValuePair>();
        nvps.add(new BasicNameValuePair("Email", login));
        nvps.add(new BasicNameValuePair("Passwd", pwd));

        try {
      httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
    } catch (UnsupportedEncodingException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      return false;
    }
View Full Code Here

   
    for (String key : params.keySet()) {
      pairs.add(new BasicNameValuePair(key, params.get(key)));
    }
   
    method.setEntity(new UrlEncodedFormEntity(pairs, HTTP.UTF_8));
   
    return method;
  }
View Full Code Here

            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

    {
        try {
            List<NameValuePair> nvps = new ArrayList<NameValuePair>() ;
            for (Pair p : params.pairs())
                nvps.add(new BasicNameValuePair(p.getName(), p.getValue())) ;
            HttpEntity e = new UrlEncodedFormEntity(nvps, "UTF-8") ;
            return e ;
        } catch (UnsupportedEncodingException e)
        { throw new ARQInternalErrorException("Platform does not support required UTF-8") ; }
    }
View Full Code Here

            List<NameValuePair> nvps = new ArrayList<NameValuePair>();
            nvps.add(new BasicNameValuePair("j_username", user));
            nvps.add(new BasicNameValuePair("j_password", pass));

            httpPost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));

            response = httpclient.execute(httpPost);
            entity = response.getEntity();
            if (entity != null)
                EntityUtils.consume(entity);
View Full Code Here

            List<NameValuePair> pairs = new ArrayList<>(2);
            pairs.add(new BasicNameValuePair("j_username", "allowed"));
            pairs.add(new BasicNameValuePair("j_password", "password"));

            login.setEntity(new UrlEncodedFormEntity(pairs, "UTF-8"));
            response = client.execute(login);
            try {
                Assert.assertEquals(HttpServletResponse.SC_FOUND, response.getStatusLine().getStatusCode());
            } finally {
                HttpClientUtils.closeQuietly(response);
View Full Code Here

        formPost.addHeader("Referer", baseURLNoAuth + "restricted/login.html");

        List<NameValuePair> formparams = new ArrayList<NameValuePair>();
        formparams.add(new BasicNameValuePair("j_username", "baduser"));
        formparams.add(new BasicNameValuePair("j_password", "badpass"));
        formPost.setEntity(new UrlEncodedFormEntity(formparams, "UTF-8"));

        log.info("Executing request " + formPost.getRequestLine());
        HttpResponse postResponse = httpclient.execute(formPost);

        statusCode = postResponse.getStatusLine().getStatusCode();
View Full Code Here

TOP

Related Classes of org.apache.http.client.entity.UrlEncodedFormEntity

Copyright © 2018 www.massapicom. 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.