Here's a cute one for anyone interested.

I've been working on some applets for quite a while now and have recently
run into a problem when trying to save data back to the server. When
trying to save data posted from a Mac, it takes nearly a minute to
save the data. So far this probelm has been identified on machines
running MRJ 2.2.2 and 2.2.4 under MacOS 9.0.4.

The problem occurrs when trying to create a PrintWriter object. Is it
possible to do this by creating something other than the PrintWriter
object? Has anyone else run into this little problem?

Thanks for any help you can provide.

The code for sending the data to the server is as follows:

public static String postURL(String myURLString, String myDataString)
{
StringBuffer myURLContent = new StringBuffer();
String errorText = "";
boolean anError = false;

try
{
// Create the connection to the URL.
URL url = new URL(myURLString);
URLConnection connection = url.openConnection();

connection.setDoOutput(true);

// Send the data.
// The slowdown happens right here.
PrintWriter out = new PrintWriter(connection.getOutputStream(),true);
out.println(myDataString);
out.close();

// Get the reply.
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
while( ( inputLine = in.readLine()) != null )
{
myURLContent = myURLContent.append(inputLine).append('\n');
}

in.close();
}
catch( MalformedURLException x){
errorText = x.toString();
anError = true;
}
catch (UnknownServiceException usx){
errorText = usx.toString();
anError = true;
}
catch (IOException iox){
errorText = iox.toString();
anError = !errorText.endsWith("<null>");
}

if( anError ){
myURLContent = new StringBuffer("Error> accessing url> \n").append(myURLString).append("\n").append(errorText);
}
return myURLContent.toString();
}