Navigate to view from RequestHandler or Servlet

Hello

I created a RequestHandler and it works fine, the problem is that afer the work is done I want to navigate to a view but I get the following error

[font=courier new]
java.lang.IllegalArgumentException: Found no valid com.vaadin.spring.internal.UIID instance!


I am adding the RequestHandler in my UI like this;

[/font]

[code]
protected void init(VaadinRequest request) {
navigator = new Navigator(this, this);
navigator.addProvider(viewProvider);

    getSession().addRequestHandler((session, req, resp) -> {

        // do some stuff... 

        UI ui = getUI(); //UI.getCurrent(); returns null
        ui.getNavigator().navigateTo("user"); // -> IllegalArgumentException
        
    });
}

[/code]I tried using a servlet instead of the RequestHandler

[code]
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

     // do some stuff...

     response.sendRedirect("/vf/v#!user");
}

[/code]After the
sendRedirect
the “loading” screen is shown, the “user” view is loaded but the app becomes unresponsive after that. I looked in the browser’s javascript console and found this messages repeating endlessly:

[size=2] [font=courier new] Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/vf/PUSH?v-uiId=1&v-csrfToken=daf59d18-f82f-484a-9aed-…plication%2Fjson%3B%20charset%3DUTF-8&X-atmo-protocol=true&_=1439829945397 Failed to load resource: the server responded with a status of 404 (Not Found) com.vaadin.DefaultWidgetSet-0.js:5936 Mon Aug 17 11:45:45 GMT-500 2015 com.vaadin.client.communication.AtmospherePushConnection INFO: Reopening push connection vaadinPush.debug.js?v=7.5.3:12308 GET http://localhost:8080/vf/PUSH?v-uiId=1&v-csrfToken=daf59d18-f82f-484a-9aed-…plication%2Fjson%3B%20charset%3DUTF-8&X-atmo-protocol=true&_=1439829950494 404 (Not Found)_executeRequest @ vaadinPush.debug.js?v=7.5.3:12308(anonymous function) @ vaadinPush.debug.js?v=7.5.3:12409 com.vaadin.DefaultWidgetSet-0.js:5936 Mon Aug 17 11:45:50 GMT-500 2015 com.vaadin.client.communication.AtmospherePushConnection INFO: Reopening push connection vaadinPush.debug.js?v=7.5.3:12308 GET http://localhost:8080/vf/PUSH?v-uiId=1&v-csrfToken=daf59d18-f82f-484a-9aed-…plication%2Fjson%3B%20charset%3DUTF-8&X-atmo-protocol=true&_=1439829955510 404 (Not Found)_executeRequest @ vaadinPush.debug.js?v=7.5.3:12308(anonymous function) @ vaadinPush.debug.js?v=7.5.3:12409 com.vaadin.DefaultWidgetSet-0.js:5936 Mon Aug 17 11:45:55 GMT-500 2015 com.vaadin.client.communication.AtmospherePushConnection INFO: Reopening push connection vaadinPush.debug.js?v=7.5.3:12308 GET http://localhost:8080/vf/PUSH?v-uiId=1&v-csrfToken=daf59d18-f82f-484a-9aed-…plication%2Fjson%3B%20charset%3DUTF-8&X-atmo-protocol=true&_=1439829960527 404 (Not Found)_executeRequest @ vaadinPush.debug.js?v=7.5.3:12308(anonymous function) @ vaadinPush.debug.js?v=7.5.3:12409 com.vaadin.DefaultWidgetSet-0.js:5936 Mon Aug 17 11:46:00 GMT-500 2015 com.vaadin.client.communication.AtmospherePushConnection INFO: Reopening push connection vaadinPush.debug.js?v=7.5.3:12308 GET http://localhost:8080/vf/PUSH?v-uiId=1&v-csrfToken=daf59d18-f82f-484a-9aed-…plication%2Fjson%3B%20charset%3DUTF-8&X-atmo-protocol=true&_=1439829965535 404 (Not Found)_executeRequest @ vaadinPush.debug.js?v=7.5.3:12308(anonymous function) @ vaadinPush.debug.js?v=7.5.3:12409 com.vaadin.DefaultWidgetSet-0.js:5936 Mon Aug 17 11:46:05 GMT-500 2015 com.vaadin.client.communication.AtmospherePushConnection INFO: Reopening push connection vaadinPush.debug.js?v=7.5.3:12308 GET http://localhost:8080/vf/PUSH?v-uiId=1&v-csrfToken=daf59d18-f82f-484a-9aed-…plication%2Fjson%3B%20charset%3DUTF-8&X-atmo-protocol=true&_=1439829970557 404 (Not Found)_executeRequest @ vaadinPush.debug.js?v=7.5.3:12308(anonymous function) @ vaadinPush.debug.js?v=7.5.3:12409 com.vaadin.DefaultWidgetSet-0.js:5936 Mon Aug 17 11:46:10 GMT-500 2015 com.vaadin.client.communication.AtmospherePushConnection INFO: Reopening push connection vaadinPush.debug.js?v=7.5.3:12308 GET http://localhost:8080/vf/PUSH?v-uiId=1&v-csrfToken=daf59d18-f82f-484a-9aed-…plication%2Fjson%3B%20charset%3DUTF-8&X-atmo-protocol=true&_=1439829975574 404 (Not Found)_executeRequest @ vaadinPush.debug.js?v=7.5.3:12308(anonymous function) @ vaadinPush.debug.js?v=7.5.3:12409 com.vaadin.DefaultWidgetSet-0.js:5936 Mon Aug 17 11:46:15 GMT-500 2015 com.vaadin.client.communication.AtmospherePushConnection INFO: Reopening push connection [/font] [/size] My UI:

@StyleSheet("http://fonts.googleapis.com/css?family=Raleway:400,700") @Push(value = PushMode.AUTOMATIC, transport = Transport.LONG_POLLING) @VaadinServletConfiguration(productionMode = true, ui = VfUI.class) @SpringUI @Theme("vf") @SuppressWarnings("serial") public class VfUI extends UI implements ErrorHandler { ... } I’ve tried with
Transport.LONG_POLLING
and
Transport.WEBSOCKET
and the result is the same in both cases.
The application relies heavily on Push and I wouldn’t want to disable it.

The reason I need a servlet or RequestHandler is because I am using a payment gateway that needs some custom attributes added to the fields of the credit card form. I have tried to call the
navigateTo
method right after submitting my form but then the RequestHandler isn’t even triggered.

I’m stuck now, I don’t even know if what I am trying to do makes any sense at all… any help will be appreciated, thank you!

bump

Have you came up with the solution?