all groups > vj# > april 2004 >
You're in the

vj#

group:

com.ms.net.wininet.WininetStreamHandlerFactory


com.ms.net.wininet.WininetStreamHandlerFactory Chris Morris
4/26/2004 1:25:47 PM
vj#: I've got J++ code using com.ms.net.wininet.WininetStreamHandlerFactory,
and the J# compilation of this code blows up, "Cannot find class".

I've read other threads that say I can use the .NET classes WebRequest
and WebResponse, but the link referenced has sample VB.NET or C# code
.... how do I reference these .NET classes in my J++ source that's
compiled by J#?

--
Chris
Re: com.ms.net.wininet.WininetStreamHandlerFactory Lars-Inge Tønnessen
4/27/2004 5:48:32 PM
[quoted text, click to view]

I don't know anything about J++. Here is an example I wrote with Request and
Response.


public class Class1
{
public Class1()
{
System.Net.WebRequest request =
System.Net.WebRequest.Create("http://www.contoso.com");
System.Net.WebResponse response = request.GetResponse();

// Please use a stream buffer for speed.
System.IO.Stream stream = response.GetResponseStream();
System.Console.WriteLine("____________________________");
int byt = 0;
while ( (byt = stream.ReadByte()) != -1 )
{
System.Console.Write( ""+(char)byt );
}
stream.Close();

System.Console.WriteLine();
System.Console.WriteLine("____________________________");
System.Uri uri = response.get_ResponseUri();
System.Console.WriteLine(" response: "+uri );

System.Console.WriteLine();
System.Console.WriteLine("____________________________");
long lenth = response.get_ContentLength();
System.Console.WriteLine(" Lenth: "+lenth );
System.Console.WriteLine();

System.Console.WriteLine("____________________________");
String type = new String( response.get_ContentType() );
System.Console.WriteLine(" Type: "+type );
System.Console.WriteLine();

System.Console.WriteLine("____________________________");
System.Net.WebHeaderCollection coll = response.get_Headers();
for ( int counter=0; counter < coll.get_Count(); counter++ )
{
System.Console.WriteLine(" : "+coll.get_Item(counter) );
}
System.Console.WriteLine("____________________________");
System.Console.WriteLine();

response.Close();
}

/** @attribute System.STAThread() */
public static void main(String[] args)
{
new Class1();
}
}



Regards,
Lars-Inge Tønnessen
www.larsinge.com

Re: com.ms.net.wininet.WininetStreamHandlerFactory Bruno Jouhier [MVP]
4/27/2004 10:33:43 PM
Chris,

You can remove the line that registers the WininetStreamHandlerFactory in
J#.
J# goes either though Wininet or its .NET equivalent (I don't really know
but our code worked in J# without this line).

You can access the WebRequest/WebResponse classes with a simple

import System.Web.*;

Also, take a look at System.Net for TcpClient (System.Web is for HTTP,
System.Net for TCP).

Bruno.

"Chris Morris" <chrismo@clabs.org> a écrit dans le message de
news:OAYa1v7KEHA.2660@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

Re: com.ms.net.wininet.WininetStreamHandlerFactory Chris Morris
4/28/2004 8:57:09 AM
[quoted text, click to view]

Interesting. As far as I know we simply have this line:

URL.setURLStreamHandlerFactory(new
com.ms.net.wininet.WininetStreamHandlerFactory());

In order to get HTTPS support in J++. So, things should just work in J#
without it?

--
Chris
Re: com.ms.net.wininet.WininetStreamHandlerFactory Bruno Jouhier [MVP]
4/29/2004 8:59:48 AM

"Chris Morris" <chrismo@clabs.org> a écrit dans le message de
news:%23XkqCjSLEHA.2012@TK2MSFTNGP11.phx.gbl...
[quoted text, click to view]

Yes. At least it worked without it in our case.

Bruno.

[quoted text, click to view]

AddThis Social Bookmark Button