Hi,
I’m facing a serious problem passing my application some parameters over the url.
An example for such a url would be:
http://localhost:8080/wettbewerberumfeld.web/#!/radius=300&place=münchen&street=Wörthstraße 12
As you can see the parameters can contain german umlaute, because they are used as input for an geocoding application to show the exact location on a map. In the MapView the parameters are parsed and extracted to display the map.
When calling the application with the above url I receive the follwoing Exception:
java.lang.RuntimeException: Invalid location URI received from client
at com.vaadin.server.Page.init(Page.java:645)
at com.vaadin.ui.UI.doInit(UI.java:611)
at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:223)
at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:73)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:37)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1371)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.net.URISyntaxException: Illegal character in fragment at index 83: http://localhost:8080/urlparameters/#!/radius=300&place=münchen&street=WörthstraÃe 12
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.parse(URI.java:3048)
at java.net.URI.<init>(URI.java:595)
at com.vaadin.server.Page.init(Page.java:643)
... 23 more
Nov 20, 2013 3:27:21 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Url Parameter Test]
in context with path
[/urlparameters] threw exception [com.vaadin.server.ServiceException: java.lang.RuntimeException: Invalid location URI received from client]
with root cause
java.net.URISyntaxException: Illegal character in fragment at index 83: http://localhost:8080/urlparameters/#!/radius=300&place=münchen&street=WörthstraÃe 12
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.parse(URI.java:3048)
at java.net.URI.<init>(URI.java:595)
at com.vaadin.server.Page.init(Page.java:643)
at com.vaadin.ui.UI.doInit(UI.java:611)
at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:223)
at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:73)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:37)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1371)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
As you can see the server receives a malformed url which he cannot parse: http://localhost:8080/urlparameters/#!/radius=300&place=münchen&street=WörthstraÃe 12
To reproduce this error I have written a simple example application with a View which displays the received event.getParameters() in a Label. This View has the following code for it’s enter-method:
@Override
public void enter(ViewChangeEvent event) {
final String parameters = event.getParameters();
if (parameters == null
|| event.getParameters().equals("")) {
this.label_1.setValue(KEINE_URI_PARAMETER_GEFUNDEN);
}else{
this.label_1.setValue(parameters);
}
}
While testing with this example application I noticed the following effects:
- Calling the view the first time with the url http://localhost:8080/urlparameters/#!/place=münchen, the parameter string is correctly displayed as: place=münchen
- Calling the url the second time:
[list=1]
- The displayed String is: place=münchen
- And the url changes to: http://localhost:8080/urlparameters/#!/place=münchen
[/list] - Calling the url http://localhost:8080/urlparameters/#!/radius=300&place=münchen&street=Wörthstraße 12 the first time (yes with space between street and streetno)
[list=1]
- The displayed string is: radius=300&place=münchen&street=Wörthstraße 12
- Url still the original
[/list] - Calling the url again or reloading:
[list=1]
- I get the above exception
[/list]
The whole process was executed in Chrome and IE9 on a Tomcat 7.0.11.1.
I have also tried the tomcat options mentioned here:
http://wiki.apache.org/tomcat/FAQ/CharacterEncoding
No success.
I also debugged the vaadinBootstrap.js until the request is send to the server component and in js the url-encoding is correct.
Is this a vaadin bug or I’m doing something wrong?
A work around or help is very much appreciated.
Thanks in advance!
Armin