Package org.apache.commons.httpclient.params

Examples of org.apache.commons.httpclient.params.HttpParams


   * @param authManager
   *            the <code>AuthManager</code> containing all the authorisations for
   *            this <code>UrlConfig</code>
   */
  void setConnectionAuthorization(HttpClient client, URL u, AuthManager authManager) {
    HttpParams params = client.getParams();
    if (authManager != null) {
            Authorization auth = authManager.getAuthForURL(u);
            if (auth != null) {
                    String username = auth.getUser();
                    String realm = auth.getRealm();
                    String domain = auth.getDomain();
                    if (log.isDebugEnabled()){
                        log.debug(username + " >  D="+ username + " D="+domain+" R="+realm);
                    }
          client.getState().setCredentials(
                            new AuthScope(u.getHost(),u.getPort(),
                                realm.length()==0 ? null : realm //"" is not the same as no realm
                                ,AuthScope.ANY_SCHEME),
                            // NT Includes other types of Credentials
                            new NTCredentials(
                  username,
                                    auth.getPass(),
                                    localHost,
                  domain
              ));
          // We have credentials - should we set pre-emptive authentication?
          if (canSetPreEmptive){
            log.debug("Setting Pre-emptive authentication");
            params.setBooleanParameter(HTTP_AUTHENTICATION_PREEMPTIVE, true);
          }
      }
            else
            {
                client.getState().clearCredentials();
                if (canSetPreEmptive){
                  params.setBooleanParameter(HTTP_AUTHENTICATION_PREEMPTIVE, false);
                }
            }
    }
        else
        {
View Full Code Here


    public HttpClientOutTransport(PostMethod postMethod) {
        this.postMethod = postMethod;
    }

    public void setVersion(HTTP_VERSION http_version) {
        HttpParams params = postMethod.getParams();

        switch (http_version) {
            case HTTP1_0:
                params.setParameter("http.protocol.version", HttpVersion.HTTP_1_0);
                break;
            case HTTP1_1:
                params.setParameter("http.protocol.version", HttpVersion.HTTP_1_1);
                break;
        }
    }
View Full Code Here

    public void invoke(PartnerRoleMessageExchange odeMex) {
        if (log.isDebugEnabled()) log.debug("Preparing " + getClass().getSimpleName() + " invocation...");
        try {
            // note: don't make this map an instance attribute, so we always get the latest version
            final Map<String, String> properties = pconf.getEndpointProperties(endpointReference);
            final HttpParams params = Properties.HttpClient.translate(properties);

            // base baseUrl
            String mexEndpointUrl = ((MutableEndpoint) odeMex.getEndpointReference()).getUrl();
            String baseUrl = mexEndpointUrl;
            // The endpoint URL might be overridden from the properties file(s)
            // The order of precedence is (in descending order): process, property, wsdl.
            if(endpointUrl.equals(new URL(mexEndpointUrl))){
                String address = (String) params.getParameter(Properties.PROP_ADDRESS);
                if(address!=null) {
                    if (log.isDebugEnabled()) log.debug("Endpoint URL overridden by property files. "+mexEndpointUrl+" => "+address);
                    baseUrl = address;
                }
            }else{
View Full Code Here

    public void invoke(PartnerRoleMessageExchange odeMex) {
        if (log.isDebugEnabled()) log.debug("Preparing " + getClass().getSimpleName() + " invocation...");
        try {
            // note: don't make this map an instance attribute, so we always get the latest version
            final Map<String, String> properties = pconf.getEndpointProperties(endpointReference);
            final HttpParams params = Properties.HttpClient.translate(properties);

            // base baseUrl
            String mexEndpointUrl = ((MutableEndpoint) odeMex.getEndpointReference()).getUrl();
            String baseUrl = mexEndpointUrl;
            // The endpoint URL might be overridden from the properties file(s)
            // The order of precedence is (in descending order): process, property, wsdl.
            if(endpointUrl.equals(new URL(mexEndpointUrl))){
                String address = (String) params.getParameter(Properties.PROP_ADDRESS);
                if(address!=null) {
                    if (log.isDebugEnabled()) log.debug("Endpoint URL overridden by property files. "+mexEndpointUrl+" => "+address);
                    baseUrl = address;
                }
            }else{
View Full Code Here

        return response.toString();
    }

    public InputStream executeCometRequest(String url) throws Exception {
        HttpClient httpClient = HttpClientHelper.createClient(this.beesClientConfiguration);
        HttpParams params = httpClient.getParams();
        params.setIntParameter(HttpConnectionParams.SO_TIMEOUT, 0);
        GetMethod getMethod = new GetMethod(url);
        httpClient.executeMethod(getMethod);
        return getMethod.getResponseBodyAsStream();
    }   
View Full Code Here

   * @param authManager
   *            the <code>AuthManager</code> containing all the authorisations for
   *            this <code>UrlConfig</code>
   */
    private void setConnectionAuthorization(HttpClient client, URL u, AuthManager authManager) {
    HttpParams params = client.getParams();
    if (authManager != null) {
            Authorization auth = authManager.getAuthForURL(u);
            if (auth != null) {
                    String username = auth.getUser();
                    String realm = auth.getRealm();
                    String domain = auth.getDomain();
                    if (log.isDebugEnabled()){
                        log.debug(username + " >  D="+ username + " D="+domain+" R="+realm);
                    }
          client.getState().setCredentials(
                            new AuthScope(u.getHost(),u.getPort(),
                                realm.length()==0 ? null : realm //"" is not the same as no realm
                                ,AuthScope.ANY_SCHEME),
                            // NT Includes other types of Credentials
                            new NTCredentials(
                  username,
                                    auth.getPass(),
                                    localHost,
                  domain
              ));
          // We have credentials - should we set pre-emptive authentication?
          if (canSetPreEmptive){
            log.debug("Setting Pre-emptive authentication");
            params.setBooleanParameter(HTTP_AUTHENTICATION_PREEMPTIVE, true);
          }
      }
            else
            {
                client.getState().clearCredentials();
                if (canSetPreEmptive){
                  params.setBooleanParameter(HTTP_AUTHENTICATION_PREEMPTIVE, false);
                }
            }
    }
        else
        {
View Full Code Here

        AuthPolicy.registerAuthScheme(SecretAuthScheme.NAME, SecretAuthScheme.class);

        // include the scheme in the AuthPolicy.AUTH_SCHEME_PRIORITY preference,
        // this can be done on a per-client or per-method basis but we'll do it
        // globally for this example
        HttpParams params = DefaultHttpParams.getDefaultParams();       
        ArrayList schemes = new ArrayList();
        schemes.add(SecretAuthScheme.NAME);
        schemes.addAll((Collection) params.getParameter(AuthPolicy.AUTH_SCHEME_PRIORITY));
        params.setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, schemes);
       
        // now that our scheme has been registered we can execute methods against
        // servers that require "Secret" authentication...
    }
View Full Code Here

        return response.toString();
    }

    public InputStream executeCometRequest(String url) throws Exception {
        HttpClient httpClient = HttpClientHelper.createClient(this.beesClientConfiguration);
        HttpParams params = httpClient.getParams();
        params.setIntParameter(HttpConnectionParams.SO_TIMEOUT, 0);
        GetMethod getMethod = new GetMethod(url);
        int code = httpClient.executeMethod(getMethod);
        if (code >= 300) {
            processError(getResponseString(getMethod.getResponseBodyAsStream()), code);
        }
View Full Code Here

        return response.toString();
    }

    public InputStream executeCometRequest(String url) throws Exception {
        HttpClient httpClient = HttpClientHelper.createClient(this.beesClientConfiguration);
        HttpParams params = httpClient.getParams();
        params.setIntParameter(HttpConnectionParams.SO_TIMEOUT, 0);
        GetMethod getMethod = new GetMethod(url);
        decorateWithAuthorization(getMethod);
        int code = httpClient.executeMethod(getMethod);
        if (code >= 300) {
            processError(getResponseString(getMethod.getResponseBodyAsStream()), code);
View Full Code Here

    public void invoke(PartnerRoleMessageExchange odeMex) {
        if (log.isDebugEnabled()) log.debug("Preparing " + getClass().getSimpleName() + " invocation...");
        try {
            // note: don't make this map an instance attribute, so we always get the latest version
            final Map<String, String> properties = pconf.getEndpointProperties(endpointReference);
            final HttpParams params = Properties.HttpClient.translate(properties);

            // base baseUrl
            String mexEndpointUrl = ((MutableEndpoint) odeMex.getEndpointReference()).getUrl();
            String baseUrl = mexEndpointUrl;
            // The endpoint URL might be overridden from the properties file(s)
            // The order of precedence is (in descending order): process, property, wsdl.
            if(endpointUrl.equals(new URL(mexEndpointUrl))){
                String address = (String) params.getParameter(Properties.PROP_ADDRESS);
                if(address!=null) {
                    if (log.isDebugEnabled()) log.debug("Endpoint URL overridden by property files. "+mexEndpointUrl+" => "+address);
                    baseUrl = address;
                }
            }else{
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.params.HttpParams

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.