Passing http parameters to embedded vaadin application

I am creating an embedded vaadin application. I am using vaadin 6.2.2. The webpage that the vaadin application is embedded in is in a different web application from the vaadin application. I need to pass some user information from the main application to the vaadin application. The only solution for this that I can think of is to pass the user information as http parameters and then have my vaadin application implement the HttpServletRequestListener interface. To test this I added ?a=b to the appUri in the embedded page but this does not work because vaadin adds more to the uri (/UIDL/) and it breaks the request. Is there a way to add http parameters to an embedded vaadin application?

Here is my embedded code:

<script type="text/javascript">
if(!vaadin || !vaadin.vaadinConfigurations) {
 if(!vaadin) { var vaadin = {}} 
vaadin.vaadinConfigurations = {};
if (!vaadin.themesLoaded) { vaadin.themesLoaded = {}; }
vaadin.debug = true;
document.write('<iframe tabIndex="-1" id="__gwt_historyFrame" style="position:absolute;width:0;height:0;border:0;overflow:hidden;" src="javascript:false"></iframe>');
document.write("<script language='javascript' src='/vaadin-6_2_2/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js?1264004394148'><\/script>");
 = {appUri:'/test/vaadinapp?a=b', pathInfo: '/', themeUri:'/vaadin-6_2_2/VAADIN/themes/test', versionInfo : {vaadinVersion:"6.2.2",applicationVersion:"NONVERSIONED"},"comErrMsg": {"caption":"Communication problem","message" : "Take note of any unsaved data, and <u>click here</u> to continue.","url" : null}};
<script type="text/javascript">
) {
var stylesheet = document.createElement('link');
stylesheet.setAttribute('rel', 'stylesheet');
stylesheet.setAttribute('type', 'text/css');
stylesheet.setAttribute('href', '/vaadin-6_2_2/VAADIN/themes/test/styles.css');
 = true;

With non-embedded Vaadin application you’d of course use ParameterHandler, but with embedded apps this may truly bee a bit trickier.

Is the host page (the page where you have your Vaadin kickstart scrips pasted in message) generated by servelet, jsp or what? If the host page generator lives in same servlet session, you could share the data via session on server side.

Another way could used hash part of uri (#foo:bar) and UriFragmentUtility.


The main application is using servlets/jsps but since these two applications live in different war/ear files, they do not share a httpsession. I agree that the hash and UriFragmentUtility can be used also but as far as I can tell it needs to be put at the end of url and before the http parameters. When I append this to the end of the appUri it does not work. I think that this does not work for the same reason that the http parameter because vaadin is appending more on to the uri and the hash part is now in the middle of the server path.

Is it even possible to pass http parameters to an embedded vaadin application?

I ended up finding a way around this by creating my own gwt component that that is able to pull the values from hidden input fields. It is not the greatest solution but it works. It would be nice if the executeJavaScript() could return a string or if there was to add init parameters to an embedded application. Is this something that other people are interested in?


Yes! I’ve been sharing some experiences with people that would like that too.

We have a small applet (self-signed) who is responsible to collect the MAC addresses from the client machine. We need those MAC addresses on the Server side. Besides MAC addresses, we’re also trying to send the machine’s local printers list.

We’ve already tried to do something like

Server side:


The thing is, with or without vaadin.forceSync(), the Server side never knows about the change we made to mycomp, even though the client is ok and the component is showing the MAC addresses as expected.

mycomp has setImmediate(true).

We’ve tried to force focus change (ugly) with no luck either.

If executeJavaScript() could return a value of any kind, then we’d be in business.


Did anyone ever found a solution to this problem?

One solution that I found was to create a event listener with gwt that could listen for events fired in javascript and fire events in javascript (I did this through gwt’s jsni). This allows a two way communication between the rest of the webpage and the vaadin application.

Hi all,
does anybody knows whether on version 6.6.6 there’s a workaround for http parameters in embedded apps?

I tried like this

= {
appUri : ‘/myapp/rm?section=home’,
themeUri : “/myapp/VAADIN/themes/reindeer”,
versionInfo : {
vaadinVersion : “6.6.6”,
applicationVersion : “NONVERSIONED”
“comErrMsg” : {
“caption” : “Communication problem”,
“message” : “Take note of any unsaved data, and click here</u> to continue.”,
“url” : null
“authErrMsg” : {
“caption” : “Authentication problem”,
“message” : “Take note of any unsaved data, and click here</u> to continue.”,
“url” : null

but the resulting query string is the following

Received request: section=home/UIDL&repaintAll=1&sh=1050&sw=1680&cw=1665&ch=579&vw=960&vh=740&fr=&tzo=-120&rtzo=-60&dstd=60&dston=true&curdate=1318183491781&wsver=6.6.6

and the application breaks with the following message

[font=Courier New]
Communication problem

Take note of any unsaved data, and click here to continue.

(SyntaxError): missing ) in parenthetical stack: AU(" html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "\“>\n\n\n\n\n\n\n\n\n\n
\n\n”)@http://localhost:8080/myapp/VAADIN/widgetsets/it.ncs.partitaiva.widgetset.PartitaivaWidgetset/58215F60E80622D605AE39D00946D002.cache.html:1658 NU([object Object]
,[object Object]
)@http://localhost:8080/myapp/VAADIN/widgetsets/it.ncs.partitaiva.widgetset.PartitaivaWidgetset/58215F60E80622D605AE39D00946D002.cache.html:2993 Ik([object Object]
,[object Object]
)@http://localhost:8080/myapp/VAADIN/widgetsets/it.ncs.partitaiva.widgetset.PartitaivaWidgetset/58215F60E80622D605AE39D00946D002.cache.html:2254 gl([object XMLHttpRequest]
)@http://localhost:8080/myapp/VAADIN/widgetsets/it.ncs.partitaiva.widgetset.PartitaivaWidgetset/58215F60E80622D605AE39D00946D002.cache.html:2990 ([object Event]
)@http://localhost:8080/myapp/VAADIN/widgetsets/it.ncs.partitaiva.widgetset.PartitaivaWidgetset/58215F60E80622D605AE39D00946D002.cache.html:1640 Pb((function () {b.gc(c);}),[object XMLHttpRequest]
,[object Arguments]
)@http://localhost:8080/myapp/VAADIN/widgetsets/it.ncs.partitaiva.widgetset.PartitaivaWidgetset/58215F60E80622D605AE39D00946D002.cache.html:1271 Sb((function () {b.gc(c);}),[object XMLHttpRequest]
,[object Arguments]
)@http://localhost:8080/myapp/VAADIN/widgetsets/it.ncs.partitaiva.widgetset.PartitaivaWidgetset/58215F60E80622D605AE39D00946D002.cache.html:2490 ([object Event]
)@http://localhost:8080/myapp/VAADIN/widgetsets/it.ncs.partitaiva.widgetset.PartitaivaWidgetset/58215F60E80622D605AE39D00946D002.cache.html:1785 fileName: http://localhost:8080/myapp/VAADIN/widgetsets/it.ncs.partitaiva.widgetset.PartitaivaWidgetset/58215F60E80622D605AE39D00946D002.cache.html lineNumber: 1658 - Original JSON-text: html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”>

Is there anybody that knows another workaround using for example javascript to get request patameters and then pass them to the app?

Thank you very much in advance.


I’ve found a dirty workaround reading com.vaadin.terminal.gwt.client.ApplicationConnection implementation:

If you encode parameters into windowName’s value, Vaadin creates UIDL request with those parameters. Then you can get it from the HttpRequest.

Ej: In Javascript:

 = {
				appUri: urlApp +'/va/' + idLayout, 
				windowName: 'myWinName&initparam=test',
				themeUri: urlApp + "/VAADIN/themes/reindeer",  
				versionInfo : {

In Application:

public class TestApplication extends Application implements HttpServletRequestListener {

      private String initparam;


	public void onRequestStart(HttpServletRequest request, HttpServletResponse response) {
		if (this.initparam == null && request.getParameter("initparam") != null) {
			this.initparam = request.getParameter("initparam");



The parameteres will be only in the first UIDL request.

Its better than nothing ! :smiley: