Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Scala for Java Developers
  • Table Of Contents Toc
  • Feedback & Rating feedback
Scala for Java Developers

Scala for Java Developers

By : Thomas Alexandre
4.3 (16)
close
close
Scala for Java Developers

Scala for Java Developers

4.3 (16)
By: Thomas Alexandre

Overview of this book

Table of Contents (19 chapters)
close
close
Scala for Java Developers
Credits
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Handling Play requests with XML and JSON


Now that we are familiar with the JSON and XML formats, we can start using them to handle HTTP requests and responses in the context of a Play project.

To exhibit these behaviors, we are going to call an online web service, the iTunes media library, which is available and documented at http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html.

It returns JSON messages on search invocations. We can, for instance, call the API with the following URL and parameters:

https://itunes.apple.com/search?term=angry+birds&country=se&entity=software

The term parameter filters every item in the library that has to do with Angry Birds and the entity parameter retains only software items. We also apply an additional filter to query only the Swedish App Store.

Note

If you don't have it already in your build.sbt file, you may need to add the dispatch dependency at this point, the same way we did while working with...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY