Tuesday, June 12, 2012

Google App Engine Java - for POST params, request.getParameter returns null when deployed, but works locally

I'm attempting to post parameters to a Java servlet on Google App Engine via POST from an iPhone app. When the server is running locally, this works fine, but when it is deployed to App Engine, the parameters are always null. Why?

App Engine code:

String facebookFriendTokens = (String) req.getParameter("facebookFriendTokens"); //running on localhost, facebookFriendTokens works fine, deployed to GAE it's always null log.warning("Facebook friends = " + facebookFriendTokens); 

iPhone code:

NSString *urlString = [NSString stringWithFormat:@"%@/new_huddle?access_token=%@", SERVER_URL, [defaults objectForKey:@"FBAccessTokenKey"]]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString]]; [request setHTTPMethod:@"POST"]; NSString *postString = [NSString stringWithFormat:@"facebookFriendTokens=%@&eventDate=%@&placesTokens=%@&name=%@", encodedFriendTokens, encodedDateString, placesQueryStringParm, encodedNameString]; [encodedNameString release]; [encodedDateString release]; [encodedFriendTokens release]; [request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]]; NSOperationQueue *queue = [[NSOperationQueue alloc] init]; [NSURLConnection sendAsynchronousRequest:request queue: ... 

wormwood bcs bowl games phoebe prince jose reyes college football bowl schedule college football bowl schedule double mastectomy

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.