I’m working on a flex application and I need to call some data with a synchonous method. After some research, I’ve found a code from adobe that use ajax and external interface. That great.
When I send data with the GET method, the servlet read the parameters and print some infos (to check). But when I send data with the POST method, the servlet recieve the request, but the parameters disappeared.
examples:
SERVLET — GET
System.out.println("recieved GET");
Map attrib = request.getParameterMap();
System.out.println("parameters: " + request.getParameterMap().size());
for(Object key: attrib.keySet()){
System.out.println("key: "+key.toString() +" - "+attrib.get(key));
}
SERVLET — POST
System.out.println("recieved POST");
Map attrib = request.getParameterMap();
System.out.println("parameters: " + request.getParameterMap().size());
for(Object key: attrib.keySet()){
System.out.println("key: "+key.toString() +" - "+attrib.get(key));
}
FLEX GET METHOD
var ajax:Ajax = new Ajax(DATABASEURL + "?username=test);
ajax.requestType = AjaxRequestType.GET;
ajax.async = false;
var result:String = ajax.send();
printed by the servlet:
recieved GET
parameters: 1
key: username - [Ljava.lang.String;@4977e2
FLEX POST METHOD
var ajax:Ajax = new Ajax(DATABASEURL);
ajax.requestType = AjaxRequestType.POST;
ajax.async = false;
var result:String = ajax.send("username='test'");
printed by the servlet:
recieved POST
parameters: 0
What’s wrong?
if the request is sent, why there is no parameter now?
If somebody can help me, that would be great, because I’ve so searched so much on google so that google could block me for spam.
edit: welcome can’t be printed ?? So…
It’s OK, I’ve found the problem.
It was the javascript code from the adobe page.
I’ve added
before the
and now, I’ve a good answer from the servlet…
It’s pretty cool that wasn’t using flex with javascript that bug, but only some missing requestReader.