Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Feature Request: Page.getCurrent().post( String, String, String )

Maude Ducharme
7 years ago Jun 27, 2015 1:45am

I wrote something at https://vaadin.com/forum#!/thread/8152096/10403579 and I think it is a good simple idea. You should add the possibility to a Page object to do a post. The post should be done from the browser and not the server to keep cookies and authentication. That way, we could have button that do an HTML form post like in the old times. I would let the programmer build the content of the post in case he want the post an XML instead of a form, that situation occurs. Here is an example of how it would work:

StringBuilder wContent = new StringBuilder();

wContent.append(URLEncoder.encode("key1", "UTF-8"));
wContent.append( "=" );
wContent.append(URLEncoder.encode("value1", "UTF-8"));
wContent.append( "&" );
wContent.append(URLEncoder.encode("key2", "UTF-8"));
wContent.append( "=" );
wContent.append(URLEncoder.encode("value2", "UTF-8"));

Page.getCurrent().post( "some url", wContent.toString(), "_top"  );

Johannes Dahlström
7 years ago Jun 27, 2015 12:14pm
Maude Ducharme
7 years ago Jun 27, 2015 4:35pm
Johannes Dahlström
7 years ago Jun 28, 2015 7:38pm