Access HttpSession in VaadinApplication

I am new to Vaadin and would like to know how to access the session , request and response objects in Vaadin.

This is important for me because our application is called by a portal and they embed the information in session and request headers.


Update :

I am able to access the session as below.

WebApplicationContext ctx = ((WebApplicationContext) getContext());
HttpSession session = ctx.getHttpSession();

But I am still unable to access the HttpRequestObject.

Any help is appreciated.


You can get HTTPServletRequest using transactionlistener. Use getContext().addTransactionListener(…);
transactionStart method has parameter transactionData that can be cast to HTTPServletRequest.

I am able to overcome the above problem by overriding the ApplicationServlet.

I am now facing a peculiar issue which I am unable to figure out.

I have a jsp where I capture some information and set it on the session and then forward in the jsp to the application.

But to I see that there are 2 requests coming in for the servlet one with the session parameter I had set in the JSP and other without.

Any idea why this is happening.

If the requests have different content in session parameters then the sessions must be different. You should only have one session to share session parameters between servlets.

What kind of contexts you have? Is the JSP and Vaadin working in the same context? Is application server in cross-context mode? What are the two different request, what context+relative-path do they request?

They both share the same context.

Another question is on Spring integration, if there is a session scoped object, with vaadin - spring integration, autowiring that object is not happening. is there any way we can do this?

Request scope component has session scoped object autowired
spring is configured with component-scan.
the object is not getting injected, and being null.