Posted By:
Sven_Farrenkopf
Posted On:
Tuesday, November 5, 2002 01:29 PM
I hope this is in the right category: I have an applet that is receiving information from a servlet via HttpUrlConnection in an Intranet-environment. Everything works fine as long as the port is the default port (80). The reading lasts up to 5 seconds - then the applet has read all the information. Now I change the port to 8081 (I already tried others, but 8081 IS free) and the whole process lasts up to TWO MINUTES. I tried reading the servlet from a normal browser-window (IE and NS - no applet) and everything is fine with BOTH ports. It's just the applet that refuses to work fast with another port than 80. Additional Information: * Java-Plugin 1.3.1_05 uses Proxy
More>>
I hope this is in the right category:
I have an applet that is receiving information from a servlet via HttpUrlConnection in an Intranet-environment. Everything works fine as long as the port is the default port (80).
The reading lasts up to 5 seconds - then the applet has read all the information.
Now I change the port to 8081 (I already tried others, but 8081 IS free) and the whole process lasts up to TWO MINUTES.
I tried reading the servlet from a normal browser-window (IE and NS - no applet) and everything is fine with BOTH ports. It's just the applet that refuses to work fast with another port than 80.
Additional Information:
* Java-Plugin 1.3.1_05 uses Proxy-Preferences of browser
* Web-Server on port 80 is IIS with isapi-redirector to Tomcat
* Web-Server on port 8081 is Tomcat
Code:
-------------------------
public Vector getReply(String myUrl,String params) {
Vector erg=new Vector();
byte[] bytes = params.getBytes();
try{
URL url = new URL(myUrl+params);
HttpURLConnection con = (HttpURLConnection)
url.openConnection();
con.setDoOutput(true);
con.setDoInput(true);
con.setRequestMethod("POST");
con.setRequestProperty("Content-length", String.valueOf(bytes.length));
OutputStream out = con.getOutputStream();
out.write(bytes);
out.flush();
// Read the response
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
while (true) {
String line = in.readLine();
if (line == null) break;
erg.add(line);
}
in.close();
out.close();
con.disconnect();
}
catch (Exception e)
{ ... }
return erg;
}
<<Less