HttpSession of embedded VaadinApp

Hi,

I have to plant a Vaadin app to an hatefull legacy J2EE app.
Inside that legacy app all objects, controller … hold inside the specific HttpSession.

I dod embed the vaadin app inside the old system, so that it’s available under the same context / path, but when I select the app I’ve got an new HttpSession (different session ID’s), so I have no access to the information’s of the outer system.

How I’ve can get even this outer Session?

Thanks in advance

Heiko

How are you embedding your Vaadin application, with DIV or IFrame? Are both the Vaadin app and other content (JSF?) served from the same WAR file?

At the moment I have it embedding with IFrame
and yes the Vaadin app is configured inside the legacy app (JSP/Struts 1.1) on the server, so it looks like served from the same war file.

The outer app pass his sessionid on every comit inside the url as parameter and it’s availabe as cookie.
But if I request this session id inside the vaadin app if got an other id.

I think the IFrame is your problem. Iframes are usually isolated from the surrounding page, and I wouldn’t be surprised if cookies aren’t shared either. I haven’t actually tested this though, so can’t be sure.

Can you try embedding the app in a div-element?

Hi Thomas,
thanks fo your help.

I try it with embedded div element.

I also try to add the sessionid to the path Info.

It doesn’t work :confused:

Inside my JSP, I get the correct http session id -
from the Vaadin WebApplicationContext if got another session (id).

I also try to find out what session are available at servlet level, so I do subclass the ApplicationServlet and try to log the sessionId inside the "doGet(…) method,
but it seems the method was not called.

Any other ideas?

If the div-embedding didn’t help, then I’m out of ideas… I’ve previously worked with JAAS-authentication in JSPs that redirect to a full-size Vaadin app, and that works fine… Can’t imagine why your case wouldn’t work. Maybe someone wiser than me has some ideas? :slight_smile:

Hi,
I play some more time with the ApplicationServlet.

The starting method call’s of the servlet have the current http session.
But later (I don’t know where.) the call’s are switched to another http session and inside the app than there are the second session.

The first thing that comes to mind is Tomcat’s lovely way of messing up the session cookies (Google “sessionCookiePathUsesTrailingSlash” for more information).

I assume you have both the Vaadin app and your legacy code in the same .war running on the same server as different web application contexts doesn’t share session data (unless session sharing is explicitly enabled).

AbstractApplicationServlet shouldn’t by itself do anything that changes the session - it just uses HttpServletRequest.getSession() to access the session and stores its ApplicationContext in that session.

I would suggest checking the session id cookies in all related requests and responses to see from where the change comes. You can use e.g. Firebug’s Net tab, the Chrome inspector’s Network pane or Fiddler with IE to see exactly what is sent and received for each request.

One more time I do play “try and error” :wink:

With your tip to look at the request and responses I see the change to anoter session was taken by loading the widegtset with the javascript.

Also I do overwrite the most Servlet methods to log the calls and their SessionId’s (see below)

Thes is the log from one call - I dont know why but it switched between the session and calls two times a new application and the second one has the invalid http session and not the needed parameters.

Maybe you can me tell why?

Nice weekend

Heiko


Oct 12 16:01:53 2012: ApplicationServlet.init
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationProperty parameterName: Debug
Oct 12 16:01:53 2012: AbstractApplicationServlet.getSystemProperty parameterName: Debug
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationProperty parameterName: productionMode
Oct 12 16:01:53 2012: AbstractApplicationServlet.getSystemProperty parameterName: productionMode
Oct 12 16:01:53 2012: Oct 12, 2012 4:01:53 PM com.vaadin.terminal.gwt.server.AbstractApplicationServlet checkProductionMode
WARNING:
=================================================================
Vaadin is running in DEBUG MODE.
Add productionMode=true to web.xml to disable debug features.
To show debug window, add ?debug to your application URL.
=================================================================
Oct 12 16:01:53 2012: Oct 12, 2012 4:01:53 PM com.vaadin.terminal.gwt.server.AbstractApplicationServlet checkProductionMode
WARNING:
=================================================================
Vaadin is running in DEBUG MODE.
Add productionMode=true to web.xml to disable debug features.
To show debug window, add ?debug to your application URL.
=================================================================
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationProperty parameterName: disable-xsrf-protection
Oct 12 16:01:53 2012: AbstractApplicationServlet.getSystemProperty parameterName: disable-xsrf-protection
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationProperty parameterName: resourceCacheTime
Oct 12 16:01:53 2012: AbstractApplicationServlet.getSystemProperty parameterName: resourceCacheTime
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationProperty parameterName: ClassLoader
Oct 12 16:01:53 2012: AbstractApplicationServlet.getSystemProperty parameterName: ClassLoader
Oct 12 16:01:53 2012: AbstractApplicationServlet.service SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.service ContextPath: /LegacyApp
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestType SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestPathInfo SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestPathInfo ReturnValue: null
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestPathInfo SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestPathInfo ReturnValue: null
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestPathInfo SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestPathInfo ReturnValue: null
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestType RequestType: OTHER
Oct 12 16:01:53 2012: AbstractApplicationServlet.getExistingApplication SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getExistingApplication allowSessionCreation: true
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationContext SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getExistingApplication AppHash: null
Oct 12 16:01:53 2012: ApplicationServlet.getNewApplication SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: ApplicationServlet.getApplicationClass
Oct 12 16:01:53 2012: ApplicationServlet.getNewApplication AppHash: 10250969
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationContext SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationContext SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationUrl SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationUrl ReturnValue: https://testzone:3342/LegacyApp/VaadinServlet/
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationWindow SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestPathInfo SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestPathInfo ReturnValue: null
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestPathInfo SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestPathInfo ReturnValue: null
Oct 12 16:01:53 2012: AbstractApplicationServlet.handleURI SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestPathInfo SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestPathInfo ReturnValue: null
Oct 12 16:01:53 2012: AbstractApplicationServlet.handleURI WindowURL: https://testzone:3342/LegacyApp/VaadinServlet/1/ ->false
Oct 12 16:01:53 2012: AbstractApplicationServlet.writeAjaxPage SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationUrl SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationUrl ReturnValue: https://testzone:3342/LegacyApp/VaadinServlet/
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationProperty parameterName: Resources
Oct 12 16:01:53 2012: AbstractApplicationServlet.getSystemProperty parameterName: Resources
Oct 12 16:01:53 2012: AbstractApplicationServlet.writeAjaxPageHtmlHeadStart SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.writeAjaxPageHtmlHeader SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationContext SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.writeAjaxPageHtmlBodyStart SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.writeAjaxPageHtmlVaadinScripts SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationProperty parameterName: widgetset
Oct 12 16:01:53 2012: AbstractApplicationServlet.getSystemProperty parameterName: widgetset
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationProperty parameterName: Resources
Oct 12 16:01:53 2012: AbstractApplicationServlet.getSystemProperty parameterName: Resources
Oct 12 16:01:53 2012: ApplicationServlet.getApplicationClass
Oct 12 16:01:53 2012: ApplicationServlet.getApplicationClass
Oct 12 16:01:53 2012: AbstractApplicationServlet.writeAjaxPageHtmlMainDiv SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationContext SessionID: AAAAA0+iqCVVR8AmRwb5cw
Oct 12 16:01:53 2012: AbstractApplicationServlet.service SessionID: AAAABJ=+ZepVSAPl4bmVWQ
Oct 12 16:01:53 2012: AbstractApplicationServlet.service ContextPath: /LegacyApp
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestType SessionID: AAAABJ=+ZepVSAPl4bmVWQ
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestPathInfo SessionID: AAAABJ=+ZepVSAPl4bmVWQ
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestPathInfo ReturnValue: /widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestPathInfo SessionID: AAAABJ=+ZepVSAPl4bmVWQ
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestPathInfo ReturnValue: /widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js
Oct 12 16:01:53 2012: AbstractApplicationServlet.getRequestType RequestType: STATIC_FILE
Oct 12 16:01:53 2012: AbstractApplicationServlet.getApplicationProperty parameterName: ClassLoader
Oct 12 16:01:53 2012: AbstractApplicationServlet.getSystemProperty parameterName: ClassLoader
Oct 12 16:01:53 2012: AbstractApplicationServlet.isAllowedVAADINResourceUrl SessionID: AAAABJ=+ZepVSAPl4bmVWQ
Oct 12 16:01:53 2012: AbstractApplicationServlet.isAllowedVAADINResourceUrl resourceURL: jar:file:/<PATH_TO_THE_VAADINLIB>/java/lib/vaadin-6.8.3.jar!/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js -> true
Oct 12 16:01:54 2012: AbstractApplicationServlet.service SessionID: AAAABVkYSKZVSAf9w9+AUA
Oct 12 16:01:54 2012: AbstractApplicationServlet.service ContextPath: /LegacyApp
Oct 12 16:01:54 2012: AbstractApplicationServlet.getRequestType SessionID: AAAABVkYSKZVSAf9w9+AUA
Oct 12 16:01:54 2012: AbstractApplicationServlet.getRequestPathInfo SessionID: AAAABVkYSKZVSAf9w9+AUA
Oct 12 16:01:54 2012: AbstractApplicationServlet.getRequestPathInfo ReturnValue: /UIDL
Oct 12 16:01:54 2012: AbstractApplicationServlet.getRequestPathInfo SessionID: AAAABVkYSKZVSAf9w9+AUA
Oct 12 16:01:54 2012: AbstractApplicationServlet.getRequestPathInfo ReturnValue: /UIDL
Oct 12 16:01:54 2012: AbstractApplicationServlet.getRequestType RequestType: UIDL
Oct 12 16:01:54 2012: AbstractApplicationServlet.getExistingApplication SessionID: AAAABVkYSKZVSAf9w9+AUA
Oct 12 16:01:54 2012: AbstractApplicationServlet.getExistingApplication allowSessionCreation: true
Oct 12 16:01:54 2012: AbstractApplicationServlet.getApplicationContext SessionID: AAAABVkYSKZVSAf9w9+AUA
Oct 12 16:01:54 2012: AbstractApplicationServlet.getExistingApplication AppHash: null
Oct 12 16:01:54 2012: ApplicationServlet.getNewApplication SessionID: AAAABVkYSKZVSAf9w9+AUA
Oct 12 16:01:54 2012: ApplicationServlet.getApplicationClass
Oct 12 16:01:54 2012: ApplicationServlet.getNewApplication AppHash: 9443274
Oct 12 16:01:54 2012: AbstractApplicationServlet.getApplicationContext SessionID: AAAABVkYSKZVSAf9w9+AUA
Oct 12 16:01:54 2012: AbstractApplicationServlet.getApplicationContext SessionID: AAAABVkYSKZVSAf9w9+AUA
Oct 12 16:01:54 2012: AbstractApplicationServlet.getApplicationUrl SessionID: AAAABVkYSKZVSAf9w9+AUA
Oct 12 16:01:54 2012: AbstractApplicationServlet.getApplicationUrl ReturnValue: https://testzone:3342/LegacyApp/VaadinServlet/
Oct 12 16:01:54 2012: AbstractApplicationServlet.getRequestPathInfo SessionID: AAAABVkYSKZVSAf9w9+AUA
Oct 12 16:01:54 2012: AbstractApplicationServlet.getRequestPathInfo ReturnValue: /UIDL
Oct 12 16:01:55 2012: AbstractApplicationServlet.getApplicationContext SessionID: AAAABVkYSKZVSAf9w9+AUA