Problems with RequestBuilder

91 views
Skip to first unread message

Jorge Mendoza

unread,
Jan 12, 2017, 4:41:34 PM1/12/17
to GWT Users

Hello Dears, I have this code and looks like I have response but no show any thing, may you help me please? I am using GWT 2.8, java 1.8 with Eclipse and my service is in php slim and is working fine I attached 2 images. thank you in advance

RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, "http://localhost:8080/slim_prueba_3.0/services.php/hola");
 
try
 
{
 builder
.sendRequest(null, new RequestCallback()
 
{
 
@Override
 
public void onResponseReceived(Request p_request, Response p_response)
 
{
 
if (p_response.getStatusCode() == Response.SC_OK)
 
{
 
new VentanaMensaje().showWarning("onResponseReceived " + p_response.getText() + " (OK)");
 btnIngresar
.enable();
 
}
 
else
 
{
 
new VentanaMensaje().showWarning(" onResponseReceived " + p_response.getText() + " (" + p_response.getStatusCode() + ")");
 
}
 
 
}
 
@Override
 
public void onError(Request p_request, Throwable p_e)
 
{
 
new VentanaMensaje().showWarning("Error");
 
 
}
 
});
 
}
 
catch (RequestException e)
 
{
 
new VentanaMensaje().showWarning("Excepcion");
 
}














I have in console of eclipse this message only

Request headers
 
Host: 127.0.0.1:8888
 
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0
 
Accept: /
 Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
 Accept-Encoding: gzip, deflate
 Referer:
http://127.0.0.1:8888/principal.html
 
Connection: keep-alive
 
Response headers
 
Date: Thu, 12 Jan 2017 19:47:59 GMT
 
Content-Type: text/html; charset=ISO-8859-1
 
Cache-Control: must-revalidate,no-cache,no-store
 
Content-Length: 340


Thomas Broyer

unread,
Jan 12, 2017, 7:03:09 PM1/12/17
to GWT Users
It looks like you have a cross-origin issue (localhost:8888 vs localhost:8080), and CORS would help.

Ignacio Baca Moreno-Torres

unread,
Jan 13, 2017, 1:36:53 AM1/13/17
to GWT Users

This is a minimal example using CORS https://github.com/ibaca/autorest-streaming-example/blob/master/server/src/main/java/com/intendia/gwt/example/Main.java#L95

Also, in chrome it is quite easy fix it, because it explain what header is required to make it work. Not sure if Firefox errors are as descriptive as chrome.


El vie., 13 ene. 2017 1:03, Thomas Broyer <t.br...@gmail.com> escribió:
It looks like you have a cross-origin issue (localhost:8888 vs localhost:8080), and CORS would help.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages