GWT Change URL after Processing Request Parameters

I want to keep in touch with url request parameters in my GWT application. Example

http: // host / app? action = A & p1 = v1 & p2 = v2

I can handle action = A and other parameters, but as soon as I'm done with this, I want to change the url to remove them.

The problem is that as soon as the user comes to the web page, to complete the "action" with parameters p1 and p2, he can browse the site and return to the same page for the same "action", but with a different value for the parameters p1, p2. The second time though, I really don't want to handle the old values ​​for p1 and p2.

I checked Window.Location.replace (), but it reloads the page and all the state of the application is lost.

Is there a way to do this without completely reloading the page without parameters? Perhaps by “deleting” the query parameters?

Is there any other smarter way to achieve this?

+3
source share
2 answers

Have you tried the History class? You could listen to ValueChangeEvents, analyze the parameters there (the URL format would change a bit, but that should not be a problem), after which you can "clear" the URL of the current page with History.newItem("something/maybeNull")or History.newItem("something/maybeNull", false), if you want to prevent the ValueChangeEventevent from firing.

+3
source

- , . , - , GWT, , , 304 , URL- get URL-. POST GET, ( , ). , .

0

Source: https://habr.com/ru/post/1718461/


All Articles