Solved

URLConnection in applet called by Netscape

Posted on 2001-07-17
4
275 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 92

Expert Comment

by:objects
ID: 6289391
> 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
ID: 6289404
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
ID: 6289633
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
ID: 6289779
it meens that the stream is URLEncoded string
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

726 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