[httpclient] (3-rc3) How to set proxy host/port ?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[httpclient] (3-rc3) How to set proxy host/port ?

Nicolas De Loof-3

Hello,

I'd like to set HTTP proxy configuration from an Axis client.

I'm using a static bloc to setup commons-httpclient preferences (I'm
using PREEMPTIVE_AUTHENTICATION=true)
<code>
static
{
    DefaultHttpParams
            .setHttpParamsFactory(new CustomDefaultHttpParamsFactory());
}
</code>

Is they're any comparable property to set the proxy Host/Port to be used ?

Nico.

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [httpclient] (3-rc3) How to set proxy host/port ?

olegk
On Wed, Aug 24, 2005 at 04:14:31PM +0200, Nicolas De Loof wrote:

>
> Hello,
>
> I'd like to set HTTP proxy configuration from an Axis client.
>
> I'm using a static bloc to setup commons-httpclient preferences (I'm
> using PREEMPTIVE_AUTHENTICATION=true)
> <code>
> static
> {
>    DefaultHttpParams
>            .setHttpParamsFactory(new CustomDefaultHttpParamsFactory());
> }
> </code>
>
> Is they're any comparable property to set the proxy Host/Port to be used ?
>

Nico,

How about that?

HttpClient httpagent = new HttpClient();
httpagent.getHostConfiguration().setProxy("proxy",
        8080);

Oleg


> Nico.
>
> This message contains information that may be privileged or confidential
> and is the property of the Capgemini Group. It is intended only for the
> person to whom it is addressed. If you are not the intended recipient,  you
> are not authorized to read, print, retain, copy, disseminate,  distribute,
> or use this message or any part thereof. If you receive this  message in
> error, please notify the sender immediately and delete all  copies of this
> message.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[SOLVED] Re: [httpclient] (3-rc3) How to set proxy host/port ?

Nicolas De Loof-3

Thanks for reply,

My problem is I'm using commons-httpclient from an Axis-generated web
service client. I don't create HttpClient myself.
I've found a workaround by using :

static
{
        String proxyHost = System.getProperty("http.proxyHost");
        String proxyPort = System.getProperty("http.proxyPort");
        if (proxyHost != null && proxyPort != null)
        {
            int port = Integer.parseInt(proxyPort);
            HostConfiguration.ANY_HOST_CONFIGURATION.setProxy(host, port);
        }
}

Notice I've reused java 'standard' system properties for proxy
configuration.

I have to test it in real world but it seems to work. Thanks for help anyway

Nico.

Oleg Kalnichevski a ?crit :

>On Wed, Aug 24, 2005 at 04:14:31PM +0200, Nicolas De Loof wrote:
>  
>
>>Hello,
>>
>>I'd like to set HTTP proxy configuration from an Axis client.
>>
>>I'm using a static bloc to setup commons-httpclient preferences (I'm
>>using PREEMPTIVE_AUTHENTICATION=true)
>><code>
>>static
>>{
>>   DefaultHttpParams
>>           .setHttpParamsFactory(new CustomDefaultHttpParamsFactory());
>>}
>></code>
>>
>>Is they're any comparable property to set the proxy Host/Port to be used ?
>>
>>    
>>
>
>Nico,
>
>How about that?
>
>HttpClient httpagent = new HttpClient();
>httpagent.getHostConfiguration().setProxy("proxy",
> 8080);
>
>Oleg
>
>
>  
>
>>Nico.
>>
>>This message contains information that may be privileged or confidential
>>and is the property of the Capgemini Group. It is intended only for the
>>person to whom it is addressed. If you are not the intended recipient,  you
>>are not authorized to read, print, retain, copy, disseminate,  distribute,
>>or use this message or any part thereof. If you receive this  message in
>>error, please notify the sender immediately and delete all  copies of this
>>message.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [hidden email]
>>For additional commands, e-mail: [hidden email]
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>
>  
>

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [SOLVED] Re: [httpclient] (3-rc3) How to set proxy host/port ?

olegk
On Wed, Aug 24, 2005 at 04:55:37PM +0200, Nicolas De Loof wrote:

>
> Thanks for reply,
>
> My problem is I'm using commons-httpclient from an Axis-generated web
> service client. I don't create HttpClient myself.
> I've found a workaround by using :
>
> static
> {
>        String proxyHost = System.getProperty("http.proxyHost");
>        String proxyPort = System.getProperty("http.proxyPort");
>        if (proxyHost != null && proxyPort != null)
>        {
>            int port = Integer.parseInt(proxyPort);
>            HostConfiguration.ANY_HOST_CONFIGURATION.setProxy(host, port);
>        }
> }
>
> Notice I've reused java 'standard' system properties for proxy
> configuration.
>
> I have to test it in real world but it seems to work. Thanks for help anyway
>

Nico,

This will most certainly produce side-effects. Be advised to not use
this workaround with the multithreaded HTTP connection manager. I do not
know much about Axis. I am pretty sure, though, Axis should be able to
expose the underlying HttpClient instance for customization

Oleg

> Nico.
>
> Oleg Kalnichevski a ?crit :
>
> >On Wed, Aug 24, 2005 at 04:14:31PM +0200, Nicolas De Loof wrote:
> >
> >
> >>Hello,
> >>
> >>I'd like to set HTTP proxy configuration from an Axis client.
> >>
> >>I'm using a static bloc to setup commons-httpclient preferences (I'm
> >>using PREEMPTIVE_AUTHENTICATION=true)
> >><code>
> >>static
> >>{
> >>  DefaultHttpParams
> >>          .setHttpParamsFactory(new CustomDefaultHttpParamsFactory());
> >>}
> >></code>
> >>
> >>Is they're any comparable property to set the proxy Host/Port to be used ?
> >>
> >>  
> >>
> >
> >Nico,
> >
> >How about that?
> >
> >HttpClient httpagent = new HttpClient();
> >httpagent.getHostConfiguration().setProxy("proxy",
> > 8080);
> >
> >Oleg
> >
> >
> >
> >
> >>Nico.
> >>
> >>This message contains information that may be privileged or confidential
> >>and is the property of the Capgemini Group. It is intended only for the
> >>person to whom it is addressed. If you are not the intended recipient,  
> >>you are not authorized to read, print, retain, copy, disseminate,  
> >>distribute, or use this message or any part thereof. If you receive this  
> >>message in error, please notify the sender immediately and delete all  
> >>copies of this message.
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [hidden email]
> >>For additional commands, e-mail: [hidden email]
> >>
> >>
> >>  
> >>
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [hidden email]
> >For additional commands, e-mail: [hidden email]
> >
> >
> >
>
> This message contains information that may be privileged or confidential
> and is the property of the Capgemini Group. It is intended only for the
> person to whom it is addressed. If you are not the intended recipient,  you
> are not authorized to read, print, retain, copy, disseminate,  distribute,
> or use this message or any part thereof. If you receive this  message in
> error, please notify the sender immediately and delete all  copies of this
> message.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE : [SOLVED] Re: [httpclient] (3-rc3) How to set proxy host/port ?

LAMY Olivier
change the file called client-config.wsdd.
<transport name="http" pivot="java:fully class name"/>
fully class name can extends org.apache.axis.transport.http.HTTPSender
or org.apache.axis.handlers.BasicHandler
 
look at the file
http://cvs.apache.org/viewcvs.cgi/ws-axis/java/src/org/apache/axis/trans
port/http/CommonsHTTPSender.java?rev=1.42
<http://cvs.apache.org/viewcvs.cgi/ws-axis/java/src/org/apache/axis/tran
sport/http/CommonsHTTPSender.java?rev=1.42&view=markup> &view=markup
And made your own hack to configure what you want with httpclient.
I have done it in order to configure my own http soap/axis sender (with
httpclient)
Olivier
 

-----Message d'origine-----
De : Oleg Kalnichevski [mailto:[hidden email]]
Envoyé : mercredi 24 août 2005 17:01
À : [hidden email]
Objet : Re: [SOLVED] Re: [httpclient] (3-rc3) How to set proxy host/port
?



On Wed, Aug 24, 2005 at 04:55:37PM +0200, Nicolas De Loof wrote:

>
> Thanks for reply,
>
> My problem is I'm using commons-httpclient from an Axis-generated web
> service client. I don't create HttpClient myself.
> I've found a workaround by using :
>
> static
> {
>        String proxyHost = System.getProperty("http.proxyHost");
>        String proxyPort = System.getProperty("http.proxyPort");
>        if (proxyHost != null && proxyPort != null)
>        {
>            int port = Integer.parseInt(proxyPort);
>            HostConfiguration.ANY_HOST_CONFIGURATION.setProxy(host,
port);
>        }
> }
>
> Notice I've reused java 'standard' system properties for proxy
> configuration.
>
> I have to test it in real world but it seems to work. Thanks for help
anyway
>

Nico,

This will most certainly produce side-effects. Be advised to not use
this workaround with the multithreaded HTTP connection manager. I do not

know much about Axis. I am pretty sure, though, Axis should be able to
expose the underlying HttpClient instance for customization

Oleg

> Nico.
>
> Oleg Kalnichevski a ?crit :
>
> >On Wed, Aug 24, 2005 at 04:14:31PM +0200, Nicolas De Loof wrote:
> >
> >
> >>Hello,
> >>
> >>I'd like to set HTTP proxy configuration from an Axis client.
> >>
> >>I'm using a static bloc to setup commons-httpclient preferences (I'm

> >>using PREEMPTIVE_AUTHENTICATION=true)
> >><code>
> >>static
> >>{
> >>  DefaultHttpParams
> >>          .setHttpParamsFactory(new
CustomDefaultHttpParamsFactory());
> >>}
> >></code>
> >>
> >>Is they're any comparable property to set the proxy Host/Port to be
used ?

> >>
> >>  
> >>
> >
> >Nico,
> >
> >How about that?
> >
> >HttpClient httpagent = new HttpClient();
> >httpagent.getHostConfiguration().setProxy("proxy",
> >     8080);
> >
> >Oleg
> >
> >
> >
> >
> >>Nico.
> >>
> >>This message contains information that may be privileged or
confidential
> >>and is the property of the Capgemini Group. It is intended only for
the
> >>person to whom it is addressed. If you are not the intended
recipient,  
> >>you are not authorized to read, print, retain, copy, disseminate,  
> >>distribute, or use this message or any part thereof. If you receive
this  
> >>message in error, please notify the sender immediately and delete
all  
> >>copies of this message.
> >>
> >>
>
>>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [hidden email]
> >>For additional commands, e-mail:
[hidden email]
> >>
> >>
> >>  
> >>
> >
> >---------------------------------------------------------------------

> >To unsubscribe, e-mail: [hidden email]
> >For additional commands, e-mail: [hidden email]

> >
> >
> >
>
> This message contains information that may be privileged or
confidential
> and is the property of the Capgemini Group. It is intended only for
the
> person to whom it is addressed. If you are not the intended recipient,
you
> are not authorized to read, print, retain, copy, disseminate,
distribute,
> or use this message or any part thereof. If you receive this  message
in
> error, please notify the sender immediately and delete all  copies of
this
> message.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]



This e-mail, any attachments and the information contained therein ("this message") are confidential and intended solely for the use of the addressee(s). If you have received this message in error please send it back to the sender and delete it. Unauthorized publication, use, dissemination or disclosure of this message, either in whole or in part is strictly prohibited.
**********************************************************************
Ce message électronique et tous les fichiers joints ainsi que  les informations contenues dans ce message ( ci après "le message" ), sont confidentiels et destinés exclusivement à l'usage de la  personne à laquelle ils sont adressés. Si vous avez reçu ce message par erreur, merci  de le renvoyer à son émetteur et de le détruire. Toutes diffusion, publication, totale ou partielle ou divulgation sous quelque forme que se soit non expressément autorisées de ce message, sont interdites.
**********************************************************************

Reply | Threaded
Open this post in threaded view
|

Re: RE : [SOLVED] Re: [httpclient] (3-rc3) How to set proxy host/port ?

Nicolas De Loof-3

Thank, It works fine.

using this, I can force preemptive authentication and set proxy
configuration without ugly 'static' blocs.

    protected HostConfiguration getHostConfiguration(HttpClient client,
            MessageContext context, URL targetURL)
    {
        HostConfiguration hostConfiguration = super.getHostConfiguration(
            client, context, targetURL);

        if (proxyhost != null)
        {
            hostConfiguration.setProxy(proxyhost, proxyport);
        }
        hostConfiguration.getParams().setBooleanParameter(
            HttpClientParams.PREEMPTIVE_AUTHENTICATION, true);
        return hostConfiguration;
    }


Nico.

Olivier Lamy a ?crit :

>change the file called client-config.wsdd.
><transport name="http" pivot="java:fully class name"/>
>fully class name can extends org.apache.axis.transport.http.HTTPSender
>or org.apache.axis.handlers.BasicHandler
>
>look at the file
>http://cvs.apache.org/viewcvs.cgi/ws-axis/java/src/org/apache/axis/trans
>port/http/CommonsHTTPSender.java?rev=1.42
><http://cvs.apache.org/viewcvs.cgi/ws-axis/java/src/org/apache/axis/tran
>
>sport/http/CommonsHTTPSender.java?rev=1.42&view=markup> &view=markup
>And made your own hack to configure what you want with httpclient.
>I have done it in order to configure my own http soap/axis sender (with
>httpclient)
>Olivier
>
>
>-----Message d'origine-----
>De : Oleg Kalnichevski [mailto:[hidden email]]
>Envoy? : mercredi 24 ao?t 2005 17:01
>? : [hidden email]
>Objet : Re: [SOLVED] Re: [httpclient] (3-rc3) How to set proxy host/port
>?
>
>
>
>On Wed, Aug 24, 2005 at 04:55:37PM +0200, Nicolas De Loof wrote:
>  
>
>>Thanks for reply,
>>
>>My problem is I'm using commons-httpclient from an Axis-generated web
>>service client. I don't create HttpClient myself.
>>I've found a workaround by using :
>>
>>static
>>{
>>       String proxyHost = System.getProperty("http.proxyHost");
>>       String proxyPort = System.getProperty("http.proxyPort");
>>       if (proxyHost != null && proxyPort != null)
>>       {
>>           int port = Integer.parseInt(proxyPort);
>>           HostConfiguration.ANY_HOST_CONFIGURATION.setProxy(host,
>>    
>>
>port);
>  
>
>>       }
>>}
>>
>>Notice I've reused java 'standard' system properties for proxy
>>configuration.
>>
>>I have to test it in real world but it seems to work. Thanks for help
>>    
>>
>anyway
>  
>
>
>Nico,
>
>This will most certainly produce side-effects. Be advised to not use
>this workaround with the multithreaded HTTP connection manager. I do not
>
>know much about Axis. I am pretty sure, though, Axis should be able to
>expose the underlying HttpClient instance for customization
>
>Oleg
>
>  
>
>>Nico.
>>
>>Oleg Kalnichevski a ?crit :
>>
>>    
>>
>>>On Wed, Aug 24, 2005 at 04:14:31PM +0200, Nicolas De Loof wrote:
>>>
>>>
>>>      
>>>
>>>>Hello,
>>>>
>>>>I'd like to set HTTP proxy configuration from an Axis client.
>>>>
>>>>I'm using a static bloc to setup commons-httpclient preferences (I'm
>>>>        
>>>>
>
>  
>
>>>>using PREEMPTIVE_AUTHENTICATION=true)
>>>><code>
>>>>static
>>>>{
>>>> DefaultHttpParams
>>>>         .setHttpParamsFactory(new
>>>>        
>>>>
>CustomDefaultHttpParamsFactory());
>  
>
>>>>}
>>>></code>
>>>>
>>>>Is they're any comparable property to set the proxy Host/Port to be
>>>>        
>>>>
>used ?
>  
>
>>>>  
>>>>
>>>>        
>>>>
>>>Nico,
>>>
>>>How about that?
>>>
>>>HttpClient httpagent = new HttpClient();
>>>httpagent.getHostConfiguration().setProxy("proxy",
>>>    8080);
>>>
>>>Oleg
>>>
>>>
>>>
>>>
>>>      
>>>
>>>>Nico.
>>>>
>>>>This message contains information that may be privileged or
>>>>        
>>>>
>confidential
>  
>
>>>>and is the property of the Capgemini Group. It is intended only for
>>>>        
>>>>
>the
>  
>
>>>>person to whom it is addressed. If you are not the intended
>>>>        
>>>>
>recipient,  
>  
>
>>>>you are not authorized to read, print, retain, copy, disseminate,  
>>>>distribute, or use this message or any part thereof. If you receive
>>>>        
>>>>
>this  
>  
>
>>>>message in error, please notify the sender immediately and delete
>>>>        
>>>>
>all  
>  
>
>>>>copies of this message.
>>>>
>>>>
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>      
>>>
>>>>To unsubscribe, e-mail: [hidden email]
>>>>For additional commands, e-mail:
>>>>        
>>>>
>[hidden email]
>  
>
>>>>  
>>>>
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>      
>>>
>
>  
>
>>>To unsubscribe, e-mail: [hidden email]
>>>For additional commands, e-mail: [hidden email]
>>>      
>>>
>
>  
>
>>>
>>>      
>>>
>>This message contains information that may be privileged or
>>    
>>
>confidential
>  
>
>>and is the property of the Capgemini Group. It is intended only for
>>    
>>
>the
>  
>
>>person to whom it is addressed. If you are not the intended recipient,
>>    
>>
>you
>  
>
>>are not authorized to read, print, retain, copy, disseminate,
>>    
>>
>distribute,
>  
>
>>or use this message or any part thereof. If you receive this  message
>>    
>>
>in
>  
>
>>error, please notify the sender immediately and delete all  copies of
>>    
>>
>this
>  
>
>>message.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [hidden email]
>>For additional commands, e-mail: [hidden email]
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>
>
>
>This e-mail, any attachments and the information contained therein ("this message") are confidential and intended solely for the use of the addressee(s). If you have received this message in error please send it back to the sender and delete it. Unauthorized publication, use, dissemination or disclosure of this message, either in whole or in part is strictly prohibited.
>**********************************************************************
>Ce message ?lectronique et tous les fichiers joints ainsi que  les informations contenues dans ce message ( ci apr?s "le message" ), sont confidentiels et destin?s exclusivement ? l'usage de la  personne ? laquelle ils sont adress?s. Si vous avez re?u ce message par erreur, merci  de le renvoyer ? son ?metteur et de le d?truire. Toutes diffusion, publication, totale ou partielle ou divulgation sous quelque forme que se soit non express?ment autoris?es de ce message, sont interdites.
>**********************************************************************
>
>
>  
>

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]