Solved

URLConnection in applet called by Netscape

Posted on 2001-07-17
4
271 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
for i loop in grovy 1 44
base64 decode encode 12 119
Java array passed to SQL where clause 23 61
eclipse argument 14 53
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

932 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

14 Experts available now in Live!

Get 1:1 Help Now