Hi Calven. I’d programmatically create a response and return that, rather than create a separate component . Something like this (warning untested pseudocode):
public WOActionResults downloadJson() { WOResponse response = new WORespnse(); response.setHeader( “application/json” ); response.setContentString( someStringContainingJSON ); return response; } Every JSON parser I have ever encountered defaults to UTF-8 (as they should, it’s part of the RFC) so you shouldn’t have to specify the encoding. Cheers, - hugi // Hugi Thordarson // http://www.loftfar.is/ <http://www.loftfar.is/> // s. 895-6688 > On 18. jún. 2015, at 15:38, Calven Eggert <cal...@mac.com> wrote: > > 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 (Webobjects-dev@lists.apple.com) > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/webobjects-dev/hugi%40karlmenn.is > > This email sent to h...@karlmenn.is
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com