I am using gwt 2.5.1. I have a small requirement in my project. We support localization in our project. If the user enters invalid locale (ie.., other than supported languages) we are displaying in english language by default. So, inorder to get the locale parameter from the url, I am using the method com.google.gwt.user.client.Window.Location.getParameterMap()
. If the user enters '%' special character as a locale parameter, the getParameterMap()
is throwing exception which is :
com.google.gwt.core.client.JavaScriptException: (URIError) @com.google.gwt.http.client.URL::decodeQueryStringImpl(Ljava/lang/String;)([string: '%']): malformed URI sequence
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.http.client.URL.decodeQueryStringImpl(URL.java)
at com.google.gwt.http.client.URL.decodeQueryString(URL.java:117)
at com.google.gwt.user.client.Window$Location.buildListParamMap(Window.java:310)
at com.google.gwt.user.client.Window$Location.ensureListParameterMap(Window.java:327)
at com.google.gwt.user.client.Window$Location.getParameterMap(Window.java:230)
at srdm.cloud.client.sso.WebUISession.checkSession(WebUISession.java:283)
at srdm.cloud.client.WebUI.onModuleLoad(WebUI.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:406)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Thread.java:744)
So, Now how can I get the locale parameter from the url, by ignoring the special characters?