Re: java client and ntlm proxy

AurĂ©lien Minet <[email protected]> Tue, 15 Mar 2011 00:22:23 +0100
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>


On 03/14/2011 09:32 AM, Pierre Gilquin wrote:
> Merci Aur=E9lien.

De rien Pierre

the methode createSocket in the class extending EOHTTPChanel have to retu=
rn a socket
I think Apache HttpClient would help to create one and handle proxy stuff
see http://svn.apache.org/repos/asf/httpcomponents/oac.hc3x/branches/HTTP=
CLIENT_3_0_BRANCH/src/examples/ProxyTunnelDemo.java

after Socket socket =3D response.getSocket();
you may have to add
socket.setTcpNoDelay(true);
socket.setSoTimeout(2147483647);

I also found that in NSSocketUtilities the creation of the socket was don=
e in a internal class SocketThread which=20
extends Thread

Aur=E9lien

ps: cntlm would be necessary if an NTLM authentication is necessary , if =
not Java Client only have to connect to the=20
proxy for accessing the application which behind it.


> I have already try to extend EOHTTPChannel. Until now without success .=
..
> It's why i try to use cntlm.
>
> My last attempt is to use cntlm tunneling :
>>cntlm.exe -c cntlm.ini -v
> cntlm: New tunnel from 127.0.0.1:11443 to host.domain.tld:80
>
>
> In this case the launch don't use any http.proxy but directly the port =
11443 on localhost:
>>java MyClassUsingEOClientApplicationSupport -applicationURL http://loca=
lhost:11443/cgi-bin/WebObjects/MyAppli.woa
>
> I dont understand why this is not working ...
>
> Thanks for any idea
>
> Pierre
>
>     ----- Original Message -----
>     From: Aur=E9lien Minet
>     To: [email protected] <mailto:[email protected]=
om> ; WebObjects (Group)
>     Sent: Sunday, March 13, 2011 10:56 PM
>     Subject: Re: java client and ntlm proxy
>
>
>     Hi
>
>     Yes the socket is open directly, in fact stuff behind EOHTTPChannel=
 (createSocket) doesn't take in account http.proxy*
>     args cause finally use java.net.Socket and not java.net.URL, so Jav=
a Client can't connect to the application trough any
>     HTTP proxy (NTML or not).
>     A solution could be to override  NSSocketUtilities.getSocketWithTim=
eout or to extend
>     com.webobjects.eodistribution.client.EOHTTPChannel with a class hav=
ing a methode createSocket which return a Socket.
>     We have got the same problem for Java Client connecting to the appl=
ication using an https URL. A colleague make a POC
>     with a class which extends EOHTTPChannel and use javax.net.ssl
>
>     Aurelien
>
>     ps : for command line launching
>     java -classpath "jar list" com.webobjects.eoapplication.client.EOCl=
ientApplicationSupport
>     -applicationURL http://host.domain.tld/cgi-bin/WebObjects/App.woa [=
other arguments]
>     (prefer a .jnlp file for deployment)
>
>
>     On 03/08/2011 09:43 AM, Pierre Gilquin wrote:
>     > Hi David,
>     >
>     > Starting the application with JWS or at command line gives the sa=
me result.
>     > I guess that the socket is open directly (port 80) without going =
thru the proxy and that's why I get a timeout error.
>     >
>     > I dont get your idea, what can you check in the jnlp file ?
>     > Thanks
>     >
>     > Pierre
>     >
>     >
>     >
>     >     ----- Original Message -----
>     >     *From:* David Avendasora <mailto:[email protected]>
>     >     *To:* Pierre Gilquin <mailto:[email protected]>
>     >     *Cc:* [email protected] <mailto:webobjects-dev@l=
ists.apple.com>
>     <mailto:[email protected]>
>     >     *Sent:* Monday, March 07, 2011 8:26 PM
>     >     *Subject:* Re: java client and ntlm proxy
>     >
>     >     Hi Pierre,
>     >
>     >     Are you launching the application from a link that downloads =
a .jnlp file from the server? If so, look at it's
>     >     contents to be sure it is using the ports you think it is.
>     >
>     >     Dave
>     >
>     >
>     >     On Mar 7, 2011, at 11:52 AM, Pierre Gilquin wrote:
>     >
>     >>     Hi all,
>     >>
>     >>     I am trying to use a java client inside a entreprise network=
 using an ntml proxy with authentification for
>     >>     accessing the outside world.
>     >>
>     >>     Seems that java cannot pass that kind of  proxy. At least, I=
 was not able to do it.
>     >>     So I try to use cntlm  http://cntlm.sourceforge.net/  <x-msg=
://292/> before starting the java client :
>     >>
>     >>     >cntlm.exe -c cntlm.ini -v
>     >>     cntlm: Proxy listening on 127.0.0.1:3128
>     >>     cntlm: Resolving proxy TheBorringProxy ...
>     >>     cntlm: Workstation name used: localhost
>     >>     cntlm: Using following NTLM hashes: NTLMv2(1) NT(0) LM(0)
>     >>     cntlm: PID 980: Cntlm ready, staying in the foreground
>     >>
>     >>     Then I start my java client  :
>     >>     java -Dhttp.proxySet=3Dtrue -Dhttp.proxyHost=3D127.0.0.1 -Dh=
ttp.proxyPort=3D3128 MyClass
>     >>     -applicationURL http://www.externaldomain.com/cgi-bin/WebObj=
ects/MyAppli.woa <x-msg://292/>
>     >>
>     >>     But not better, the java client cannot create the socket :
>     >>     com.webobjects.foundation.NSForwardException for java.io.IOE=
xception: Timed out trying to create Socket
>     >>      at com.webobjects.foundation.NSSocketUtilities._getSocketWi=
thTimeout(NSSocketUtilities.java:145)
>     >>      at com.webobjects.foundation.NSSocketUtilities.getSocketWit=
hTimeout(NSSocketUtilities.java:100)
>     >>      at com.webobjects.foundation.NSSocketUtilities.getSocketWit=
hTimeout(NSSocketUtilities.java:58)
>     >>      at com.webobjects.eodistribution.client.EOHTTPChannel.creat=
eSocket(EOHTTPChannel.java:401)
>     >>
>     >>     Am I missing something ? May be I am wrong about the way i s=
tart my java client ?
>     >>
>     >>     Thanks for any idea.
>     >>
>     >>     Pierre
>     >
>     >
>     >
>     >  _______________________________________________
>     > Do not post admin requests to the list. They will be ignored.
>     > Webobjects-dev mailing list      ([email protected] =
<mailto:[email protected]>)
>     > Help/Unsubscribe/Update your Subscription:
>     > http://lists.apple.com/mailman/options/webobjects-dev/aurelien.mi=
net%40univ-provence.fr
>     >
>     > This email sent to [email protected] <mailto:aureli=
[email protected]>
>
>     _______________________________________________
>     WebObjects-dev mailing list
>     [email protected] <mailto:[email protected]>
>     http://www.omnigroup.com/mailman/listinfo/webobjects-dev
>
>
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/aurelien.minet%40=
univ-provence.fr
>
> This email sent to [email protected]