Hi,
I have e singular problem in ConnectionRequest:

The follow code send a login request to server and work fine, but once 
authenticated if I stop and run the application another time, in the next 
login request allow me to access and return the correct json even if I 
wrong the password.

It's very strange behavior, could it be a cache problem?

ConnectionRequest cr = new ConnectionRequest(
"http://www.domain.com/rest/user/login.json";);

cr.addResponseListener(new ActionListener<NetworkEvent>() {

public void actionPerformed(NetworkEvent evt) {

try {

//Log.p(evt.getMessage(), Log.DEBUG);

Map<String, Object> result = null;

result = new JSONParser().parseJSON(new InputStreamReader(new 
ByteArrayInputStream(cr.getResponseData()), "UTF-8"));

Map<String, Object> ret = (Map<String, Object>)result.get("ret");

if ("true".equals(((Map)ret).get("success"))) {

Log.p("connected", Log.DEBUG);

//return (java.util.List<Map<String, Object>>)response.get("listings");

set(ViewInterface.PROPERTY_MSG, "ok");

((UserController)that).profile();

} else {

Log.p((String) ((Map)ret).get("message"), Log.DEBUG);

set(ViewInterface.PROPERTY_MSG, ((Map)ret).get("message"));

((UserController)that).login();

}

} catch (Exception e) {

set(ViewInterface.PROPERTY_MSG, e.getMessage());

Log.e(e);

}

}

});

cr.setPost(true);

cr.addArgument("data[User][email]", username);

cr.addArgument("data[User][password]", password);

NetworkManager.getInstance().addToQueue(cr);

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/d1bd0bfd-8eaa-4360-ba56-1e8faaea6f55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to