On 27 mai, 08:30, TimOnGmail <[email protected]> wrote:
> Hi all...
>
> I have a class that I'd like to use in GWT, and have it work both in a
> freestanding Java app, and in GWT. The problem is, it needs to do
> some URL encoding, but GWT's URL class does it's encoding/decoding in
> a native method (in Javascript), and URLEncoder/URLDecoder in Java are
> not allowed in GWT.
Just a note on URLEncoder/URLDecoder, keep in mind that they are only
equivalents of the encodeURIComponent/decodeURIComponent JS methods;
*not* encodeURI/decodeURI. I've seen (reported, actually) this error
in Alfresco (and their might be many other apps out there with this
same issue), where it causes problems with "+"s:
https://issues.alfresco.com/jira/browse/ETWOTWO-1153
(the workaround was to use a servlet-filter to replace "+" with "%2B"
in all but the query-string part of the request URL)
> Does anyone know if a Java class out there on the web that implements
> a good-enough URL encoding/decoding mechanism and which does not
> depend on any disallowed classes?
I'd go the same way as Ian said; or maybe rather take advantage of
<super-source/> in GWT: instead of using an interface, make a class
that does the "Java" thing; and in a <super-source/>, re-implement
that class deferring to com.google.gwt.http.client.URL)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---