Hi. I've got a problem with long URL's. I'm developing a web app
specifically for mobile devices. The problem is that I must redirect
the user to some other site and some of these little bastards have a
URL length limit (such as the Motorola V300, which has a limit of 100
characters), yet the URL has 200+ characters. I'm currently using
response.sendRedirect on a servlet.
I can use a java.net.URL object to do the request and send it to the
user, but the redirection needed isn't happening.
I suppose that a POST form instead of a redirection could work, but
that solution would involve some nasty java-scripting to send the form
automatically, with the parameters placed on hidden fields.
Any idea on how to solve this without ugly javascript and such?
Thanks in advance.
Oliver Wong - 06 Jul 2006 20:38 GMT
> Hi. I've got a problem with long URL's. I'm developing a web app
> specifically for mobile devices. The problem is that I must redirect
[quoted text clipped - 11 lines]
>
> Any idea on how to solve this without ugly javascript and such?
Redirect to http://tinyurl.com/u ?
- Oliver
Real Gagnon - 06 Jul 2006 21:25 GMT
> I suppose that a POST form instead of a redirection could work, but
> that solution would involve some nasty java-scripting to send the form
> automatically, with the parameters placed on hidden fields.
>
> Any idea on how to solve this without ugly javascript and such?
<BODY onLoad="document.myform.submit();"> is not that ugly ?
Bye.

Signature
Real Gagnon from Quebec, Canada
* Looking for Java or PB code examples ? Visit Real's How-to
* http://www.rgagnon.com/howto.html
diego.manilla@gmail.com - 06 Jul 2006 23:03 GMT
> > I suppose that a POST form instead of a redirection could work, but
> > that solution would involve some nasty java-scripting to send the form
[quoted text clipped - 3 lines]
>
> <BODY onLoad="document.myform.submit();"> is not that ugly ?
Well, the problem is that the device might not even support Javascript
(and we must server also WML pages for older devices, and maybe there's
no equivalent for that in WMLScript).
Oliver: I thought of that possibility, too, but the URL is dynamic and
I suppose tinyurl performs a redirection, anyway.
Well, I think this is a problem with no solution other than shorten the
URL (not possible at this moment) or the form/javascript hack, but just
in case someone knows a magical solution...
Thanks both for your replies
Chris Uppal - 07 Jul 2006 10:00 GMT
> Hi. I've got a problem with long URL's. I'm developing a web app
> specifically for mobile devices. The problem is that I must redirect
> the user to some other site and some of these little bastards have a
> URL length limit (such as the Motorola V300, which has a limit of 100
> characters), yet the URL has 200+ characters. I'm currently using
> response.sendRedirect on a servlet.
If you expect the client device to connect to a webserver using an URL which is
longer than the client device supports then you are clearly hosed. It's
nothing to do with redirects, etc, but that the HTTP stack in the device is
unable to issue the relevant request.
So you have four possible approaches.
a) Give up. Just accept that some devices can't access some websites.
b) Somehow induce the operators of the other website to shorted their URLs.
c) Spoof their web content -- i.e. create a website which (at server-side)
pulls the data off their site and re-issues it under an accesible name. You
may have licensing issues.
d) Create your own HTTP stack on the client device which is not limited in this
way (I presume that would be infeasible for your purposes, but just for
completeness...).
-- chris