Google App Engine Java/Scala servlet not receiving Angular 2 Http post data
0 views
Skip to first unread message
Tim Consolazio
unread,
Jan 19, 2017, 8:31:48 AM1/19/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Angular 2
If you're using Angular 2 (and probably the same is true in Angular 1.x but I don't know for sure, I don't use 1.x anymore), and trying to send an HTTP post to a Java servlet on the Google Application Engine. It may not be working.
The problem is that Angular 2 defaults it's http post headers to "application/json", so you just send your JS object without any manipulation and that's that.
But as-is, a Java servlet doesn't understand that. The fix is to stringify your JSON data, and change the header to "application/x-www-form-urlencoded"