Vaadin 7.2.0 session close and setLocation in Chrome

Hello. Push enabled

Page.getCurrent().setLocation("/app/#!/"); ApplicationSession.getCurrent().close(); Works in firefox (26 version). Chrome (Version 28.0.1500.71) do not redirect to location

Hi,

I have built an application using vaadin 7. i am trying to automatically forward the user to logon screen once the session has expired. I see lot of examples for vaadin 6 but i don’t have any clue about vaadin 7. I tried the above said but it does not work as expected.It does not forward the user to any other page. Can you please give me the steps (configuration and code) to implement this feature. btw what is this push enabled mean?

btw i am running in 2.4 servlet

Regards
anto

Sry for the late answer. You can find answer in this post https://vaadin.com/wiki/-/wiki/Main/Handling+logout
Also you can find answers on most famous questions in https://vaadin.com/wiki/-/wiki/Main/Vaadin+7.

If you wont to see session expired message, you can disable it. It useful when you need to invalidate session.

VaadinService.getCurrent().setSystemMessagesProvider(new SystemMessagesProvider() { @Override public SystemMessages getSystemMessages(SystemMessagesInfo systemMessagesInfo) { CustomizedSystemMessages customizedSystemMessages = new CustomizedSystemMessages(); customizedSystemMessages.setSessionExpiredNotificationEnabled(false); return customizedSystemMessages; } }); After invalidate session u can redirect your client to any location.
Or you can set expire url. I think vaadin automaticly does redirect depends on SessionExpiredURL.

VaadinService.getCurrent().setSystemMessagesProvider(new SystemMessagesProvider() {
            @Override
            public SystemMessages getSystemMessages(SystemMessagesInfo systemMessagesInfo) {
                CustomizedSystemMessages customizedSystemMessages = new 
                [b]
customizedSystemMessages.setSessionExpiredURL("LOCATION");
[/b]
                return customizedSystemMessages;
            }
        });
  1. https://vaadin.com/wiki/-/wiki/Main/Handling+logout this url does not hold good for me as because the session has already expired in my case. It is not logout it is session expired scenario.
  2. I tried your idea of using setSystemMessagesProvider to automatically redirect the user to logon page once the session expired. it did not work either.

I am not sure if i am missing something. The vaadin life cycle understands that the session has expired but it does not take any action like redirect to logon until the user click on any vaadin component. Hope you are clear with my question now.

I need to do my job… later i’ll answer.

Can’t reproduce with 7.2.0 with Chrome 34.0.1847.131 neither with the above code nor using http://test.vaadin.com/7.2.0/run/CloseSession?transport=long-polling&restartApplication&debug. If you can reproduce the problem, please file a ticket at http://dev.vaadin.com/newticket.

If you do not use push then the server has no way of telling the client that something has happened. There is a special case in the framework which sets a timer on the browser side depending on the configured session timeout on the server so it can redirect automatically without user interaction or push. This seems to be used only in the case that session expired is configured (using SystemMessages) so that the message is null, the caption is null, notification is enabled and an url has been set. In this case there should be a redirect in the browser automatically after the session has expired (within 15 seconds based on the code).

Yup after update chrome all works fine.
Any way what about https://vaadin.com/forum#!/thread/5394955

delete.

Forgot my loginName from TRAC :confused: anyway

when setLocation("
/path/#!/
“); and close session. Application change url in browser but not refresh the page.
Chrome ​Version 34.0.1847.137

when setLocation(”
/path/
"), all works fine.
In firefox all works fine with/without hashtag

Thanks for explaining it for me. Is there is pre-requiste to make push work? if i enable push it reports as given below. Will it work only in Java 1.7 or any specific version of servlet?

java.lang.IllegalStateException: Not supported.
at org.apache.catalina.connector.Request.startAsync(Request.java:1609)
at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1031)
at javax.servlet.ServletRequestWrapper.startAsync(ServletRequestWrapper.java:379)
at org.atmosphere.cpr.AtmosphereRequest.startAsync(AtmosphereRequest.java:565)
at org.atmosphere.container.Servlet30CometSupport.suspend(Servlet30CometSupport.java:137)
at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:103)
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1464)
at com.vaadin.server.communication.PushRequestHandler.handleRequest(PushRequestHandler.java:121)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1382)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

Hello anto, I think you need servlet 3 and must enable async like

<async-supported>true</async-supported> in your web.xml

Thank you! May be it is not working because i am on 2.4 servlet