Re: RequestBuilder POST + setHeader() = OPTIONS
On Thursday, April 11, 2013 7:17:21 PM UTC+2, Seray Uzgur wrote: Hi, i am facing with the same thing. I know its old but i wonderred if you found and solution? This looks like CORS http://www.w3.org/TR/cors/ When you do a cross-origin POST (which is a simple method in the CORS spec), then as soon as you use a request header that's not a simple header http://www.w3.org/TR/cors/#simple-header the browser will make a preflight request in the form of an OPTIONS request. So the solution is either to change your request so it doesn't need a preflight, or implement the preflight handling on the server-side (or avoid cross-origin requests if possible) 21 Ekim 2010 Perşembe 19:51:15 UTC+3 tarihinde Márcio Menezes yazdı: BTW... Browser Firefox 3.6 2010/10/21 Márcio Menezes marci...@gmail.com Ok... but it happens with ANY header. Even if I add Content-Type, application/x-www-form-urlencoded, as you suggested, it sends an OPTIONS method, instead of POST. On Thu, Oct 21, 2010 at 4:46 PM, Brett Thomas brettp...@gmail.comwrote: POST values should be encoded in the request data string, not the headers. Not sure why there isn't an addPostValue method too. Here's some code I used recently: class CustomPOSTBuilder extends RequestBuilder { private String request = ; public CustomPOSTBuilder(String url, RequestCallback callback) { super(RequestBuilder.POST, url); this.setHeader(Content-Type, application/x-www-form-urlencoded); this.setCallback(callback); } public void addPost(String key, String value) { request += key + = + value + ; } public void go() { this.setRequestData(request); try { this.send(); } catch (RequestException r){ System.out.print(r.getMessage()); } } } then send a request by: CustomPOSTBuilder builder... builder.addPost(key1, value1); builder.addPost(key2, value2); builder.send(); 2010/10/21 Márcio Menezes marci...@gmail.com Hi!. Why does everytime I try to send a POST through RequestBuilder class and if I add some header into it, the method goes as an OPTIONS, instead of post? Has anyone experienced this? How can I work around it? Regards, Marcio -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-we...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-we...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: RequestBuilder POST + setHeader() = OPTIONS
Hi, i am facing with the same thing. I know its old but i wonderred if you found and solution? 21 Ekim 2010 Perşembe 19:51:15 UTC+3 tarihinde Márcio Menezes yazdı: BTW... Browser Firefox 3.6 2010/10/21 Márcio Menezes marci...@gmail.com javascript: Ok... but it happens with ANY header. Even if I add Content-Type, application/x-www-form-urlencoded, as you suggested, it sends an OPTIONS method, instead of POST. On Thu, Oct 21, 2010 at 4:46 PM, Brett Thomas brettp...@gmail.comjavascript: wrote: POST values should be encoded in the request data string, not the headers. Not sure why there isn't an addPostValue method too. Here's some code I used recently: class CustomPOSTBuilder extends RequestBuilder { private String request = ; public CustomPOSTBuilder(String url, RequestCallback callback) { super(RequestBuilder.POST, url); this.setHeader(Content-Type, application/x-www-form-urlencoded); this.setCallback(callback); } public void addPost(String key, String value) { request += key + = + value + ; } public void go() { this.setRequestData(request); try { this.send(); } catch (RequestException r){ System.out.print(r.getMessage()); } } } then send a request by: CustomPOSTBuilder builder... builder.addPost(key1, value1); builder.addPost(key2, value2); builder.send(); 2010/10/21 Márcio Menezes marci...@gmail.com javascript: Hi!. Why does everytime I try to send a POST through RequestBuilder class and if I add some header into it, the method goes as an OPTIONS, instead of post? Has anyone experienced this? How can I work around it? Regards, Marcio -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-we...@googlegroups.comjavascript: . To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com javascript:. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-we...@googlegroups.comjavascript: . To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com javascript:. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
RequestBuilder POST + setHeader() = OPTIONS
Hi!. Why does everytime I try to send a POST through RequestBuilder class and if I add some header into it, the method goes as an OPTIONS, instead of post? Has anyone experienced this? How can I work around it? Regards, Marcio -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: RequestBuilder POST + setHeader() = OPTIONS
POST values should be encoded in the request data string, not the headers. Not sure why there isn't an addPostValue method too. Here's some code I used recently: class CustomPOSTBuilder extends RequestBuilder { private String request = ; public CustomPOSTBuilder(String url, RequestCallback callback) { super(RequestBuilder.POST, url); this.setHeader(Content-Type, application/x-www-form-urlencoded); this.setCallback(callback); } public void addPost(String key, String value) { request += key + = + value + ; } public void go() { this.setRequestData(request); try { this.send(); } catch (RequestException r){ System.out.print(r.getMessage()); } } } then send a request by: CustomPOSTBuilder builder... builder.addPost(key1, value1); builder.addPost(key2, value2); builder.send(); 2010/10/21 Márcio Menezes marcio@gmail.com Hi!. Why does everytime I try to send a POST through RequestBuilder class and if I add some header into it, the method goes as an OPTIONS, instead of post? Has anyone experienced this? How can I work around it? Regards, Marcio -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: RequestBuilder POST + setHeader() = OPTIONS
On Oct 21, 4:59 pm, Márcio Menezes marcio@gmail.com wrote: Hi!. Why does everytime I try to send a POST through RequestBuilder class and if I add some header into it, the method goes as an OPTIONS, instead of post? Has anyone experienced this? How can I work around it? See http://en.wikipedia.org/wiki/Same_origin_policy https://developer.mozilla.org/En/HTTP_Access_Control work around by having htmljs served by the same host used to receive the requests. You can use an iframe on that host, with src pointing to another if needed. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: RequestBuilder POST + setHeader() = OPTIONS
Code I posted was for if you aren't using a GWT server On Thu, Oct 21, 2010 at 11:03 AM, marius.andreiana marius.andrei...@gmail.com wrote: On Oct 21, 4:59 pm, Márcio Menezes marcio@gmail.com wrote: Hi!. Why does everytime I try to send a POST through RequestBuilder class and if I add some header into it, the method goes as an OPTIONS, instead of post? Has anyone experienced this? How can I work around it? See http://en.wikipedia.org/wiki/Same_origin_policy https://developer.mozilla.org/En/HTTP_Access_Control work around by having htmljs served by the same host used to receive the requests. You can use an iframe on that host, with src pointing to another if needed. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: RequestBuilder POST + setHeader() = OPTIONS
Ok... but it happens with ANY header. Even if I add Content-Type, application/x-www-form-urlencoded, as you suggested, it sends an OPTIONS method, instead of POST. On Thu, Oct 21, 2010 at 4:46 PM, Brett Thomas brettptho...@gmail.comwrote: POST values should be encoded in the request data string, not the headers. Not sure why there isn't an addPostValue method too. Here's some code I used recently: class CustomPOSTBuilder extends RequestBuilder { private String request = ; public CustomPOSTBuilder(String url, RequestCallback callback) { super(RequestBuilder.POST, url); this.setHeader(Content-Type, application/x-www-form-urlencoded); this.setCallback(callback); } public void addPost(String key, String value) { request += key + = + value + ; } public void go() { this.setRequestData(request); try { this.send(); } catch (RequestException r){ System.out.print(r.getMessage()); } } } then send a request by: CustomPOSTBuilder builder... builder.addPost(key1, value1); builder.addPost(key2, value2); builder.send(); 2010/10/21 Márcio Menezes marcio@gmail.com Hi!. Why does everytime I try to send a POST through RequestBuilder class and if I add some header into it, the method goes as an OPTIONS, instead of post? Has anyone experienced this? How can I work around it? Regards, Marcio -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: RequestBuilder POST + setHeader() = OPTIONS
BTW... Browser Firefox 3.6 2010/10/21 Márcio Menezes marcio@gmail.com Ok... but it happens with ANY header. Even if I add Content-Type, application/x-www-form-urlencoded, as you suggested, it sends an OPTIONS method, instead of POST. On Thu, Oct 21, 2010 at 4:46 PM, Brett Thomas brettptho...@gmail.comwrote: POST values should be encoded in the request data string, not the headers. Not sure why there isn't an addPostValue method too. Here's some code I used recently: class CustomPOSTBuilder extends RequestBuilder { private String request = ; public CustomPOSTBuilder(String url, RequestCallback callback) { super(RequestBuilder.POST, url); this.setHeader(Content-Type, application/x-www-form-urlencoded); this.setCallback(callback); } public void addPost(String key, String value) { request += key + = + value + ; } public void go() { this.setRequestData(request); try { this.send(); } catch (RequestException r){ System.out.print(r.getMessage()); } } } then send a request by: CustomPOSTBuilder builder... builder.addPost(key1, value1); builder.addPost(key2, value2); builder.send(); 2010/10/21 Márcio Menezes marcio@gmail.com Hi!. Why does everytime I try to send a POST through RequestBuilder class and if I add some header into it, the method goes as an OPTIONS, instead of post? Has anyone experienced this? How can I work around it? Regards, Marcio -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com . To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.