NIH | National Cancer Institute | NCI Wiki  

Error rendering macro 'rw-search'

null

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

We recommend using the free community edition of Intellij.  Download and install the Scala plugin according to the directions.  Then follow instructions for creating a Scala project and an object like the following.  Change the URL to whatever CTS2 service is available

Code Block
languagejava
titleScala REST Example
collapsetrue
package mayo.edu.cts2.client.rest.scala

import java.net.{HttpURLConnection, URL}
import io.Source

/**
 * Created with IntelliJ IDEA.
 * Author: Scott Bauer bauer.scott@mayo.edu
 * Date: 10/2/12
 * Time: 3:17 PM
 */
object CTS2RestClient extends App{
  val connection =
    new URL("http://informatics.mayo.edu/cts2/rest/valuesets").openConnection().asInstanceOf[HttpURLConnection]
  val inputStream = connection.getInputStream
  val src = Source.fromInputStream(inputStream)
  src.getLines().foreach(println)
}

...