Package org.apache.http.client.methods

Examples of org.apache.http.client.methods.HttpPost.addHeader()


    }
   
    @Test
    public void testPostConsumerUniqueResponseCode() throws Exception {
        HttpPost post = new HttpPost("http://localhost:9000/route/customerservice/customersUniqueResponseCode");
        post.addHeader("Accept" , "text/xml");
        StringEntity entity = new StringEntity(POST_REQUEST, "ISO-8859-1");
        entity.setContentType("text/xml; charset=ISO-8859-1");
        post.setEntity(entity);
        HttpClient httpclient = new DefaultHttpClient();
View Full Code Here


   */
  protected HttpPost createHttpPost(HttpInvokerClientConfiguration config) throws IOException {
    HttpPost httpPost = new HttpPost(config.getServiceUrl());
    LocaleContext locale = LocaleContextHolder.getLocaleContext();
    if (locale != null) {
      httpPost.addHeader(HTTP_HEADER_ACCEPT_LANGUAGE, StringUtils.toLanguageTag(locale.getLocale()));
    }
    if (isAcceptGzipEncoding()) {
      httpPost.addHeader(HTTP_HEADER_ACCEPT_ENCODING, ENCODING_GZIP);
    }
    return httpPost;
View Full Code Here

    LocaleContext locale = LocaleContextHolder.getLocaleContext();
    if (locale != null) {
      httpPost.addHeader(HTTP_HEADER_ACCEPT_LANGUAGE, StringUtils.toLanguageTag(locale.getLocale()));
    }
    if (isAcceptGzipEncoding()) {
      httpPost.addHeader(HTTP_HEADER_ACCEPT_ENCODING, ENCODING_GZIP);
    }
    return httpPost;
  }

  /**
 
View Full Code Here

   */
  protected HttpPost createHttpPost(HttpInvokerClientConfiguration config) throws IOException {
    HttpPost httpPost = new HttpPost(config.getServiceUrl());
    LocaleContext locale = LocaleContextHolder.getLocaleContext();
    if (locale != null) {
      httpPost.addHeader(HTTP_HEADER_ACCEPT_LANGUAGE, StringUtils.toLanguageTag(locale.getLocale()));
    }
    if (isAcceptGzipEncoding()) {
      httpPost.addHeader(HTTP_HEADER_ACCEPT_ENCODING, ENCODING_GZIP);
    }
    return httpPost;
View Full Code Here

    LocaleContext locale = LocaleContextHolder.getLocaleContext();
    if (locale != null) {
      httpPost.addHeader(HTTP_HEADER_ACCEPT_LANGUAGE, StringUtils.toLanguageTag(locale.getLocale()));
    }
    if (isAcceptGzipEncoding()) {
      httpPost.addHeader(HTTP_HEADER_ACCEPT_ENCODING, ENCODING_GZIP);
    }
    return httpPost;
  }

  /**
 
View Full Code Here

    }
   
    @Test
    public void testPostConsumer() throws Exception {
        HttpPost post = new HttpPost("http://localhost:9000/route/customerservice/customers");
        post.addHeader("Accept" , "text/xml");
        StringEntity entity = new StringEntity(POST_REQUEST, "ISO-8859-1");
        entity.setContentType("text/xml; charset=ISO-8859-1");
        post.setEntity(entity);
        HttpClient httpclient = new DefaultHttpClient();
View Full Code Here

        Assert.assertTrue(exists);

        // Prepare HTTP post
        // PostMethod post = new PostMethod( colUri.toString() );
        HttpPost post = new HttpPost(providerURI);
        post.addHeader("Content-Type", "image/gif");
        post.addHeader("Title", "Title " + receiptName + "");
        post.addHeader("Slug", "Slug " + receiptName + "");

        post.setEntity(new FileEntity(input, "image/gif"));
View Full Code Here

        // Prepare HTTP post
        // PostMethod post = new PostMethod( colUri.toString() );
        HttpPost post = new HttpPost(providerURI);
        post.addHeader("Content-Type", "image/gif");
        post.addHeader("Title", "Title " + receiptName + "");
        post.addHeader("Slug", "Slug " + receiptName + "");

        post.setEntity(new FileEntity(input, "image/gif"));

        // Get HTTP client
View Full Code Here

        // Prepare HTTP post
        // PostMethod post = new PostMethod( colUri.toString() );
        HttpPost post = new HttpPost(providerURI);
        post.addHeader("Content-Type", "image/gif");
        post.addHeader("Title", "Title " + receiptName + "");
        post.addHeader("Slug", "Slug " + receiptName + "");

        post.setEntity(new FileEntity(input, "image/gif"));

        // Get HTTP client
        org.apache.http.client.HttpClient httpclient = new HttpClientFactory().createHttpClient();
View Full Code Here

        //nvps.add(new BasicNameValuePair("force_render", "false"));
        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

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.