Package org.apache.http.client.methods

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


      request.setEntity(postBody);
    }

    if (headers != null) {
      for (Header header : headers) {
        request.addHeader(header);
      }
    }
    return execute(request);
  }
View Full Code Here


      }
    }

    if (headers != null) {
      for (Header header : headers) {
        request.addHeader(header);
      }
    }
    return execute(request);
  }
View Full Code Here

      request.setEntity(postBody);
    }

    if (headers != null) {
      for (Header header : headers) {
        request.addHeader(header);
      }
    }
    return execute(request);
  }
View Full Code Here

      }
    }

    if (headers != null) {
      for (Header header : headers) {
        request.addHeader(header);
      }
    }
    return execute(request);
  }
View Full Code Here

            HttpPost post = new HttpPost(endpointUri.toString());
            StringEntity contentEntity = new StringEntity(requestEnvelope);
            post.setEntity(contentEntity);
            if (requestEnvelope.contains(SOAP_1_1_NAMESPACE)) {
                soapAction = soapAction != null ? "\"" + soapAction + "\"" : "";
                post.addHeader(PROP_SOAP_ACTION_11, soapAction);
                post.addHeader(PROP_CONTENT_TYPE, MIMETYPE_TEXT_XML);
                client.getParams().setParameter(PROP_CONTENT_TYPE, MIMETYPE_TEXT_XML);
            } else if (requestEnvelope.contains(SOAP_1_2_NAMESPACE)) {
                String contentType = MIMETYPE_APPLICATION_XML;
                if (soapAction != null) {
View Full Code Here

            StringEntity contentEntity = new StringEntity(requestEnvelope);
            post.setEntity(contentEntity);
            if (requestEnvelope.contains(SOAP_1_1_NAMESPACE)) {
                soapAction = soapAction != null ? "\"" + soapAction + "\"" : "";
                post.addHeader(PROP_SOAP_ACTION_11, soapAction);
                post.addHeader(PROP_CONTENT_TYPE, MIMETYPE_TEXT_XML);
                client.getParams().setParameter(PROP_CONTENT_TYPE, MIMETYPE_TEXT_XML);
            } else if (requestEnvelope.contains(SOAP_1_2_NAMESPACE)) {
                String contentType = MIMETYPE_APPLICATION_XML;
                if (soapAction != null) {
                    contentType = contentType + PROP_DELIMITER + PROP_SOAP_ACTION_12 + "\"" + soapAction + "\"";
View Full Code Here

            } else if (requestEnvelope.contains(SOAP_1_2_NAMESPACE)) {
                String contentType = MIMETYPE_APPLICATION_XML;
                if (soapAction != null) {
                    contentType = contentType + PROP_DELIMITER + PROP_SOAP_ACTION_12 + "\"" + soapAction + "\"";
                }
                post.addHeader(PROP_CONTENT_TYPE, contentType);
            }
            return post;
        } catch (UnsupportedEncodingException ex) {
            throw new SoapClientException(ex);
        }
View Full Code Here

    }

    public static HttpPost getHttpPost(String uri, Map<String, String> parameters) throws UnsupportedEncodingException {

        HttpPost httpPost = new HttpPost(uri);
        httpPost.addHeader("User-Agent", "HTTP Client");
        httpPost.addHeader("Content-type", "application/x-www-form-urlencoded");
        //postMethod.addHeader("Content-Length", "0");

        HttpParams params = new BasicHttpParams();
        httpPost.setParams(params);
View Full Code Here

    public static HttpPost getHttpPost(String uri, Map<String, String> parameters) throws UnsupportedEncodingException {

        HttpPost httpPost = new HttpPost(uri);
        httpPost.addHeader("User-Agent", "HTTP Client");
        httpPost.addHeader("Content-type", "application/x-www-form-urlencoded");
        //postMethod.addHeader("Content-Length", "0");

        HttpParams params = new BasicHttpParams();
        httpPost.setParams(params);
View Full Code Here

            LinkedList<NameValuePair> postParams = new LinkedList<NameValuePair>();
            if (streams == null || isMultipart) {
              HttpPost post = new HttpPost(url);
              post.setHeader("Content-Charset", "UTF-8");
              if (!isMultipart) {
                post.addHeader("Content-Type",
                    "application/x-www-form-urlencoded; charset=UTF-8");
              }

              List<FormBodyPart> parts = new LinkedList<FormBodyPart>();
              Iterator<String> iter = params.getParameterNamesIterator();
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.