Solved

URLConnection in applet called by Netscape

Posted on 2001-07-17
4
269 Views
Last Modified: 2008-03-06
My applet call a servlet with POST method using this code :

URL u = new URL (buf.toString()) ; //buf is the url of the servlet
URLConnection uc = u.openConnection();
uc.setDoOutput(true);
uc.setDoInput(true);
PrintWriter out = new PrintWriter(uc.getOutputStream());
out.print(.....)); //put the parameters
out.close();
DataInputStream in = new DataInputStream (new BufferedInputStream(uc.getInputStream())) ;

Netscape 4.7 seems to don't like this code, the java console tells me :
java.io.IOException: <null>
  at netscape.net.URLConnection.connect(Compiled Code)
* at netscape.net.URLConnection.getInputStream(Compiled Code)
  at Ade.AppletTree.initTree(Compiled Code)....

I think uc.getInputStream() is to recent Java to be understood by the JVM of Netscape 4.7.
Can I replace uc.getInputStream() by something to have a better result. I've already tried to call the servlet with GET method but one of my parameters is to big.

Thanks for help.
Gaillard
0
Comment
Question by:gaillard
  • 2
4 Comments
 
LVL 92

Expert Comment

by:objects
Comment Utility
> I think uc.getInputStream() is to recent Java to be understood by the JVM

It's calling it ok, so it's found it.


Check your URL, it may not be connecting ok.
Print out the url being used, and try entering it directly in browser.
0
 
LVL 9

Accepted Solution

by:
Ovi earned 200 total points
Comment Utility
Take a look to his question (is not a PAQ) http://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20150455
0
 

Author Comment

by:gaillard
Comment Utility
Thanks, There is a sample code in the discution which is  likely that mine but with the line :

con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

when I insert it in my code, it works.

Just one question, what does this line means?
0
 
LVL 9

Expert Comment

by:Ovi
Comment Utility
it meens that the stream is URLEncoded string
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Jave - Remove carriage return + special characters from text 3 62
Updating Java 9 86
count11 challenge 6 47
wordlen challenge 3 46
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now