wonu wns
wonu wns

Reputation: 3608

POST request in GWT

i first tried to make request to server with GET method and it works fine. my request would process a file then return as a pdf file and would open on a new browser. what i did is overriding the doGet() method. since having a GET request is only limited to few parameters, i must change it to doPost() mehod but the problem is that it can't be overrided because the method is final.

in an HTML FORM, what i wanted to happen is something like this:

<form method="post" action="http://differentdomain.com/appserv/appserv.php">
  <input type="hidden" name="fwi_script" value="app/custom/cusapp/interface" />
  <input type="hidden" name="trx" value="&lt;trx&gt;
    &lt;productid&gt;PROD1&lt;/productid&gt;
    ....../** transaction details here */
    &lt;/trx&gt;" />

  <input type="hidden" name="fcompanyid" value="SHOST101" />
  <input type="hidden" name="fwi_action" value="PRINT_PENDING_SALES" />
  <input type="hidden" name="fexcel" value="0" />
  <input type="submit" value="Submit" />
</form>

this html form will print the order slip of every transaction when user clicks on the post order button.

anyone can give an idea on how to POST request in GWT server? i think i can't do it with RequestBuilder since i will be having the SOP problem since i will be connecting to a different domain.

Upvotes: 0

Views: 701

Answers (2)

Colin Alworth
Colin Alworth

Reputation: 18331

To build very nearly the same html you have in your question, start with a FormPanel and add the form fields you need to it. Make sure to configure the FormPanel with the correct action and method, and to provide names (and possibly values) to the fields added to it. To fire off the request, submit() can be called.

Upvotes: 1

Strelok
Strelok

Reputation: 51431

The solution is to make a normal GWT RPC call to your server and have the server make the POST request to the server located on a different domain.

Upvotes: 0

Related Questions