getting the current URL in the address bar Vaadin 8

Hi,
We are having a vaadin application running in a div inside another application. I need a way to get the current URL in the address bar but for some reason I still get the old URL. On top of it, I need to create a Page object based on the URL that I get back.

I tried with the following code but didnt work as well

                VaadinRequest vaadinRequest = VaadinService.getCurrentRequest();
                HttpServletRequest httpServletRequest = ((VaadinServletRequest)vaadinRequest).getHttpServletRequest();
                String requestUrl = httpServletRequest.getRequestURL().toString();

The requestUrl just gives: http://localhost/<app_name>/PUSH

If we need to get the location URL using javascript, how do we get the URL in the response and how can we construct a Page object out of the URL in that case?

Any help in this regard is appreciated!

Regards,

Hi,

Have you tried to use Page.getCurrent().getLocation(); instead?

HI,
yes. I did but then it gives me the old location for some reason.