• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Returning JSON
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Returning JSON
      • From: Hugi Thordarson <email@hidden>
  • Prev by Date: Re: port 80 refused
  • Next by Date: Re: Returning JSON
  • Previous by thread: Re: port 80 refused
  • Next by thread: Re: Returning JSON
  • Index(es):
    • Date
    • Thread