Returning JSON
Returning JSON
- Subject: Returning JSON
- From: Calven Eggert <email@hidden>
- Date: Thu, 18 Jun 2015 11:38:58 -0400
Hi,
What needs to be done to properly return a webpage with proper json encoding, meaning content type of “application/json"? The page my application is returning seems to be of type “text/html”. I’m not exactly sure how to see what the content type is. my app returns a WOString with the json text in it. Is this the correct way to handle this?
I’ve found this example but it didn’t seem to make a difference to my app. (In Application.java)
public void appendToResponse(WOResponse response, WOContext context) { super.appendToResponse(response, context); if( _NSUtilities.UTF8StringEncoding.equals(response.contentEncoding())) response.setHeader("application/json; charset=UTF-8", "Content-Type"); }
Thanks, Calven |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden