Skip to content
This repository has been archived by the owner. It is now read-only.
[ABANDONED] A Scala library which adds support to native Scala types in Jersey applications.
Branch: development
Clone or download
Latest commit 9d905e3 Oct 14, 2011
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Replace specialized providers with JerksonProvider. Sep 21, 2011
.gitignore Stop tracking plugin build properties. Jan 8, 2011
CHANGELOG.md
LICENSE.md Bump to 0.2.0. Sep 21, 2011
README.md
pom.xml Bump to 0.2.1-SNAPSHOT. Sep 21, 2011
pom_2.8.1.xml Bump to 0.2.1-SNAPSHOT. Sep 21, 2011
pom_2.9.0-1.xml

README.md

Jersey-Scala

Life's too short to use java.util.Collection

Jersey-Scala is a set of classes which add Scala interoperation to Jersey.

Requirements

  • Scala 2.8.1 or 2.9.0-1 or 2.9.1
  • Jerkson 0.4.2
  • Jersey 1.9.1
  • Slf4j API 1.6.2

How To Use

First, specify Jersey-Scala as a dependency:

<dependency>
    <groupId>com.codahale</groupId>
    <artifactId>jersey-scala_${scala.version}</artifactId>
    <version>0.2.0</version>
</dependency>

Second, write your resource classes:

@Path("/things")
@Produces(Array("text/plain"))
class Things {
  @GET
  def getAThing(@QueryParam("name") names: Set[String]) = "I found: " + names.mkString(", ")
}

What All This Supports

  • QueryParam-annotated parameters of type Seq[String], List[String], Vector[String], IndexedSeq[String], Set[String], and Option[String].
  • AST.JValue request and response entities.
  • JsonNode request and response entities.
  • Case class (i.e., Product instances) JSON request and response entities.
  • Array[A] request and response entities. (Due to the JVM's type erasure and mismatches between Scala and Java type signatures, this is the only "generic" class supported since Array type parameters are reified.)

License

Copyright (c) 2010-2011 Coda Hale

Published under The MIT License, see LICENSE

You can’t perform that action at this time.