Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting Custom HTTP Header for GWT Forms

How can I set additional HTTP headers while submitting forms with GWT.
(I am using FormPanel for building the form)


Summary

From accepted answer:

HTTP headers cannot be set using FormPanel - FormPanel wraps the standard HTML <form>, which doesn't allow setting custom headers.

like image 756
Kaan Avatar asked May 31 '11 13:05

Kaan


People also ask

How do I create a custom header in request?

Under Custom response headers, click Add header. Enter the Header name and Header value for the custom response header. Enter any additional custom response headers. Click Save.

Can you add custom HTTP headers?

In the Add Custom HTTP Response Header dialog box, set the name and value for your custom header, and then click OK.

How do I set HTTP headers?

In the web site pane, double-click HTTP Response Headers in the IIS section. In the actions pane, select Add. In the Name box, type the custom HTTP header name. In the Value box, type the custom HTTP header value.


1 Answers

HTTP headers cannot be set using FormPanel - FormPanel wraps the standard HTML <form>, which doesn't allow setting custom headers.

To set your own headers use a RequestBuilder:

RequestBuilder rb = new RequestBuilder(Method.POST, "http://www.my-server.com");
rb.setHeader("X-My-Header", "VALUE");
Request r = rb.sendRequest(null, new RequestCallback() {...});
like image 76
Jason Terk Avatar answered Sep 30 '22 13:09

Jason Terk