Wednesday, October 6, 2010

REQUEST BUILDER + JSON OBJECT + PHP SERVER SIDE LANGUAGE

Hi, i have problem by using gwt requestbuilder to make http request
with json object in body messages. In the server side code, i use php,
but when i try to access request's data, the $_POST variable is empty.
I post the code below:

String path = GWT.getHostPageBaseURL() + "JsonObjectReceiver.php";

RequestBuilder trasmettiJSON = new
RequestBuilder(RequestBuilder.POST, URL.encode(path));
trasmettiJSON.setHeader("Content-Type", "application/json");

//L'evento contiene due oggetti da tenere in considerazione
PrenotazioneJSON pj = event.getData(Costanti.OGGETTI_DA_INVIARE);
final WCard corrente =
event.getData(Costanti.CARD_CORRENTE_PASSO3);

try{
@SuppressWarnings("unused")
Request req = trasmettiJSON.sendRequest(pj.getInfo_generali(), new
RequestCallback() {

@Override
public void onResponseReceived(Request request, Response
response) {
if (200 == response.getStatusCode()) {

AppEvent xmlCorrect = new AppEvent(StartEvents.xmlWritten);
xmlCorrect.setData(Costanti.CARD_CORRENTE_PASSO3, corrente);

xmlCorrect.setData("status", response.getText());
forwardToView(passo3View, xmlCorrect);
} else {
// displayError("Couldn't retrieve JSON (" +
response.getStatusText()+ ")", corrente);
}


}

@Override
public void onError(Request request, Throwable exception) {
//displayError("Couldn't retrieve JSON");


}
});

}catch(RequestException e) {
//displayError("Couldn't retrieve JSON");
}

CAN SOMEONE HELP ME PLEASE? I'M NEW TO GWT, SO I HAVE NOT A LOT OF
EXPERIENCE.
THANKS IN ADVANCE FOR ANSWERS

ALESSIO

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate