
Originally Posted by
steven2ffff
for now, we switch to socket connection when ever we meet 30x problem and get the redirect url, this is not perfect , but better than nothing.
of course, there would be some problems opening a socket connection on port 80, have to self-sigh the jar for 6630/6680/6681/n70 , but this does not work on 3250 etc...
Sorry... I don't get it... Why are you using sockets?
Why don't you just open an input stream from the connection?
Something like this:
Code:
if (status == HttpConnection.HTTP_TEMP_REDIRECT ||
status == HttpConnection.HTTP_MOVED_TEMP ||
status == HttpConnection.HTTP_MOVED_PERM) {
// Get the new location and close the connection
url = connection.getHeaderField("location");
if (url == null) { // S60 devices workaround.
in = new DataInputStream(connection.openInputStream());
in.read(..etc..)
// parse the input stream and get the new url.
url = whatever;
}
connection.close();
} else
// break the loop.
You might have to read in chunks since you won't have the
total length.
Do you see any problem with this approach?
-H.