Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HttpMethod.addRequestHeader()


            httpMethod.setPath(url.getPath());

            // FIXME
            for (Enumeration e = request.getHeaderNames(); e.hasMoreElements();) {
                String name = (String) e.nextElement();
                httpMethod.addRequestHeader(name, request.getHeader(name));
                log.debug("Header Name=" + name + "value=" + request.getHeader(name));
            }

            HostConfiguration hostConfiguration = new HostConfiguration();
            hostConfiguration.setHost(url.getHost(), url.getPort(), url.getProtocol());
View Full Code Here


        // propagate headers as HTTP headers
        for (String headerName : in.getHeaders().keySet()) {
            String headerValue = in.getHeader(headerName, String.class);
            if (strategy != null && !strategy.applyFilterToCamelHeaders(headerName, headerValue)) {
                method.addRequestHeader(headerName, headerValue);
            }
        }

        // lets store the result in the output message.
        try {
View Full Code Here

            } else if (READ_TIMEOUT.equals(name)) {
                httpMethod.getParams().setIntParameter(HttpMethodParams.SO_TIMEOUT, Integer.parseInt(value));
            }
        }
        for (Map.Entry<String, String> header : request.headers) {
            httpMethod.addRequestHeader(header.getKey(), header.getValue());
        }
        HttpClient client = clientPool.getHttpClient(new URL(httpMethod
                .getURI().toString()));
        client.executeMethod(httpMethod);
        return new HttpMethodResponse(httpMethod, excerpt, request.getContentCharset());
View Full Code Here

        // propagate headers as HTTP headers
        for (String headerName : in.getHeaders().keySet()) {
            String headerValue = in.getHeader(headerName, String.class);
            if (strategy != null && !strategy.applyFilterToCamelHeaders(headerName, headerValue)) {
                method.addRequestHeader(headerName, headerValue);
            }
        }

        // lets store the result in the output message.
        try {
View Full Code Here

   
    //TODO support other methods
    HttpMethod method = new GetMethod(url.getPathQuery());
    Header[] headers = conn.getHeaders();
    for (int i=0; i<headers.length; i++) {
      method.addRequestHeader(headers[i]);
    }
    if (method instanceof EntityEnclosingMethod) {
      EntityEnclosingMethod emethod = (EntityEnclosingMethod) method;
      emethod.setRequestBody(conn.getInputStream());
    }
View Full Code Here

    }

    public RobotRules getRulesForUrl(String url, String userAgent) throws IOException, RobotsUnavailableException {
        String robotsUrl = robotsUrlForUrl(url);
        HttpMethod method = new GetMethod(robotsUrl);
        method.addRequestHeader("User-Agent", userAgent);
        try {
            int code = http.executeMethod(method);
            // TODO: Constant 200
            if (code != 200) {
                throw new RobotsUnavailableException(robotsUrl);
View Full Code Here

        // propagate headers as HTTP headers
        for (Map.Entry<String, Object> entry : in.getHeaders().entrySet()) {
            String headerValue = in.getHeader(entry.getKey(), String.class);
            if (strategy != null && !strategy.applyFilterToCamelHeaders(entry.getKey(), headerValue, exchange)) {
                method.addRequestHeader(entry.getKey(), headerValue);
            }
        }

        // lets store the result in the output message.
        try {
View Full Code Here

      ((PostMethod)request_method).setRequestEntity(sre);
      if(action!=null) {
        request_method.setRequestHeader(SOAP_ACTION_HEADER, action);
            }
            // Adding charset also into header's Content-Type
      request_method.addRequestHeader(CONTENT_TYPE_HEADER,
                                            requestContentType + "; charset=" + charsetName);
    }
    else{
      request_method=new GetMethod(url.toString());
      if(names_values!=null) ((GetMethod)request_method).setQueryString(names_values);
View Full Code Here

        // propagate headers as HTTP headers
        for (Map.Entry<String, Object> entry : in.getHeaders().entrySet()) {
            String headerValue = in.getHeader(entry.getKey(), String.class);
            if (strategy != null && !strategy.applyFilterToCamelHeaders(entry.getKey(), headerValue, exchange)) {
                method.addRequestHeader(entry.getKey(), headerValue);
            }
        }

        // lets store the result in the output message.
        try {
View Full Code Here

    catch( IOException ex ) {
      throw new SolrServerException("error reading streams", ex );
    }

    method.setFollowRedirects( _followRedirects );
    method.addRequestHeader( "User-Agent", AGENT );
    if( _allowCompression ) {
      method.setRequestHeader( new Header( "Accept-Encoding", "gzip,deflate" ) );
    }

    try {
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.