Scalatra 2.5.0 is out

The Scalatra team is pleased to announce the release of version 2.5.0 of the framework. Noteworthy upgrades include Scala 2.12 and Swagger 2 support.

Updated documentation for 2.5.0 will be available shortly.

Here's the full list of changes:

Scalatra Core

  • #572 Fix error handling with Future and errorHandler by @ElPicador
  • #573 Bump minor verions of various libs by @seratch
  • #576 Copy from input stream in a loop to ensure full copy for files over 2GB by @pmcq
  • #578 Escape javascript to avoid Xss by @megaminx
  • #579 Add responseModel property to the response message by @takezoe
  • #586 use runtimeClass. erasure is deprecated by @xuwei-k
  • #587 remove unused dependency by @xuwei-k
  • #590 remove unused joda-time dependency from core by @xuwei-k
  • #597 fix #596 CorsSupport is broken by @jelmerk
  • #598 Scala 2.12 support by @takezoe
  • #599 drop java7, use java8 Base64 by @xuwei-k
  • #604 Fix sbt 0.13.13 warnings, upgrade deps by @seratch
  • #606 use sbt-unidoc by @xuwei-k

Scalatra Commands

  • #594 Specify Locale as ENGLISH for HttpDate pattern by @takezoe

Scalatra Swagger

  • #581 Add responseModel property to the response message by @takezoe
  • #583 Swagger 2.0 support by @takezoe

Scalatra Atmosphere

  • #517 update atmosphere to version 2.4.3 by @GoranSchumacher, @chrisdoc
  • #580 Expose a method in AtmosphereClient to close the websocket connection by @saephir

Scalatra 2.4.0 is out

The Scalatra team is pleased to announce the release of Scalatra 2.4.0 with many improvements and bugfixes as listed below.

Scalatra Core

  • Removes the DefaultValue type class
  • #434 Added support for generic content-encoding / decoding by @nrinaudo
  • #436 Renamed GZipSupport to ContentEncodingSupport by @nrinaudo
  • #438 Fix MIME type for .ogv (Ogg Video) by @abhalla-atl
  • #452 Optimize imports by using IntelliJ IDEA by @seratch
  • #453 Some code cleanup on core project by @seratch
  • #456 Add explicit return types to core APIs, other improvements by @seratch
  • #460 ScalatraServlet as a trait instead of an abstract class by @seratch
  • #471 Fix #470 Add an implicit request to the cookies method by @seratch
  • #474 Fix duplicated multiParams when multipart/form-data requests by @seratch
  • #477 Bump Scala minor version (2.11.6, 2.10.5) by @seratch
  • #481 Bump minor version of dependencies by @seratch
  • #483 Fix an XXE Vulnerability related to scala.xml.XML library by @seratch
  • #500 Improve automatic charset detection performance by @takezoe
  • #502 Bump minor version of dependencies by @seratch
  • #514 Improve request/response stability wthin AsyncResult by @lloydmeta
  • #528 Fix #435 Error with FutureSupport and ScalateI18nSupport using templating by @dozed
  • #516 Introduce stable request response macro by @dozed
  • #544 Removed request/response scoping macro from 2.4.x release by @dozed
  • #535 [2.4.x] Fix #531 Params and multiParams are empty for PATCH request by @seratch
  • #545 Bump dependencies and scala minor version by @seratch
  • #557 Bump minor version of some libs toward 2.4.0 releaseby @seratch

Scalatra Cache

  • #455 Scalatra cache by @japhar81
  • #541 Fixes double evaluation of result by @offner
  • #557 Bump minor version of some libs toward 2.4.0 releaseby @seratch

Scalatra Commands

  • (Breaking change) Removes the default value for types, instead a field is now started in an invalid state by @casualjim
  • (Breaking change) field.optional now is an alias for field.withDefaultValue(theDefault) by @casualjim
  • #447 Minor upgrades and deprecation warnings reduction by @seratch
  • #510 Fix deprecated APIs in Scalaz's ValidationOps by @xuwei-k
  • #557 Bump minor version of some libs toward 2.4.0 releaseby @seratch

Scalatra Json

  • #432 Introduce a JsonResult type by @dozed
  • #440 Take Formats bigDecimal setting into account when parsing. by @dozed
  • #490 Bump json4s version to 3.3.0.RC1 by @seratch
  • #504 Fix #496 Rendering JNull in a servlet by @seratch
  • #512 Fix jackson json initialization issue (NPE) by @dozed

Scalatra Scalate

  • #444 Aligned template directory to new default (integrates with template-comp iler and g8 template). by @dozed
  • #449 Fix Scalatra Test so client can send multiple headers of the same name by @shintasmith
  • #476 Bump Scalate version to avoid NPEs by @lloydmeta

Scalatra Metrics

  • #441 Added basic metrics support by @japhar81
  • #442 Added metrics support for response code filter by @japhar81
  • #505 Upgrade to metrics-scala-3.5.1 by @rossabaker

Scalatra ScalaTest

  • #458 Made the traits extend the new -Like scalatest traits. by @DrDub

Scalatra Atmosphere

  • #492 Bump atmosphere-runtime to 2.2 by @adamretter

Scalatra Swagger

  • #490 Switch scalap to json4s-scalap since json4s 3.3.0 by @seratch

Scalatra Specs2

  • #508 Updated specs2 to 3.6.+ by @etorreborre
  • #557 Bump minor version of some libs toward 2.4.0 releaseby @seratch

Scalatra sbt plugin

https://github.com/scalatra/scalatra-sbt

  • scalatra-sbt has bumped xsbt-web-plugin version to version 2.x.

Scalatra 2.4.0 will be out soon

The Scalatra team is pleased to announce the release of Scalatra 2.4.0.RC3.

2.4.0 release has many improvements and bugfixes as listed below.

If this version looks fine, we'd like to release 2.4.0 soon. Please try it out within days!

Scalatra Core

  • Removes the DefaultValue type class
  • #434 Added support for generic content-encoding / decoding by @nrinaudo
  • #436 Renamed GZipSupport to ContentEncodingSupport by @nrinaudo
  • #438 Fix MIME type for .ogv (Ogg Video) by @abhalla-atl
  • #452 Optimize imports by using IntelliJ IDEA by @seratch
  • #453 Some code cleanup on core project by @seratch
  • #456 Add explicit return types to core APIs, other improvements by @seratch
  • #460 ScalatraServlet as a trait instead of an abstract class by @seratch
  • #471 Fix #470 Add an implicit request to the cookies method by @seratch
  • #474 Fix duplicated multiParams when multipart/form-data requests by @seratch
  • #477 Bump Scala minor version (2.11.6, 2.10.5) by @seratch
  • #481 Bump minor version of dependencies by @seratch
  • #483 Fix an XXE Vulnerability related to scala.xml.XML library by @seratch
  • #500 Improve automatic charset detection performance by @takezoe
  • #502 Bump minor version of dependencies by @seratch
  • #514 Improve request/response stability wthin AsyncResult by @lloydmeta
  • #528 Fix #435 Error with FutureSupport and ScalateI18nSupport using templating by @dozed
  • #516 Introduce stable request response macro by @dozed
  • #544 Removed request/response scoping macro from 2.4.x release by @dozed
  • #535 [2.4.x] Fix #531 Params and multiParams are empty for PATCH request by @seratch
  • #545 Bump dependencies and scala minor version by @seratch

Scalatra Cache

  • #455 Scalatra cache by @japhar81
  • #541 Fixes double evaluation of result by @offner

Scalatra Commands

  • (Breaking change) Removes the default value for types, instead a field is now started in an invalid state by @casualjim
  • (Breaking change) field.optional now is an alias for field.withDefaultValue(theDefault) by @casualjim
  • #447 Minor upgrades and deprecation warnings reduction by @seratch
  • #510 Fix deprecated APIs in Scalaz's ValidationOps by @xuwei-k

Scalatra Json

  • #432 Introduce a JsonResult type by @dozed
  • #440 Take Formats bigDecimal setting into account when parsing. by @dozed
  • #490 Bump json4s version to 3.3.0.RC1 by @seratch
  • #504 Fix #496 Rendering JNull in a servlet by @seratch
  • #512 Fix jackson json initialization issue (NPE) by @dozed

Scalatra Scalate

  • #444 Aligned template directory to new default (integrates with template-comp iler and g8 template). by @dozed
  • #449 Fix Scalatra Test so client can send multiple headers of the same name by @shintasmith
  • #476 Bump Scalate version to avoid NPEs by @lloydmeta

Scalatra Metrics

  • #441 Added basic metrics support by @japhar81
  • #442 Added metrics support for response code filter by @japhar81
  • #505 Upgrade to metrics-scala-3.5.1 by @rossabaker

Scalatra ScalaTest

  • #458 Made the traits extend the new -Like scalatest traits. by @DrDub

Scalatra Atmosphere

  • #492 Bump atmosphere-runtime to 2.2 by @adamretter

Scalatra Swagger

  • #490 Switch scalap to json4s-scalap since json4s 3.3.0 by @seratch

Scalatra Specs2

  • #508 Updated specs2 to 3.6.+ by @etorreborre

Scalatra 2.3.0 released

The Scalatra team is pleased to announce the release of Scalatra 2.3.0.

Core

  • Breaking: Scalatra 2.3.x drops support for Scala 2.9.
  • Breaking: Require java 7
  • Breaking: if you have custom route transformer hooks the function now needs a param type

Before:

protected def swaggerMeta(s: Symbol, v: Any): RouteTransformer = { route ⇒
    route.copy(metadata = route.metadata + (s -> v))
}

Now:

protected def swaggerMeta(s: Symbol, v: Any): RouteTransformer = { (route: Route) ⇒
    route.copy(metadata = route.metadata + (s -> v)) 
}
  • Updates to servlet 3.1
  • Change FutureSupport.timeout from a Timeout to a Duration.
  • Add a timeout to AsyncResult.
  • Run callbacks before render in renderResponseBody.
  • Redirect returns Nothing, not unit.
  • Allow calling halt from trap handler.
  • Remove Akka dependency. Only scala.concurrent is needed.
  • Stack trace of uncaught exceptions only renders in development mode by default. Hook renderUncaughtException is now protected.
  • Render unhandled exceptions from failed Futures.
  • Fix #342: Verify that gzip Content-Encoding header gets added only once
  • Fix #349: Fix css mime type detection
  • Fix #351: Fix ScalatraServlet.requestPath for encoded unicode URI
  • Added support for loadOnStartup when mounting servlets
  • Moved function to retrieve environment to RichServletContext
  • Fix #277: Only catch ClassNotFoundException in ScalatraBootstrap
  • Fix #319: responseFormat crashes with unrecognized MIME type
  • Fix #296: Check for http again when generating a full url

Atmosphere

  • Make ScalatraBroadcaster a trait for custom broadcasters.
  • Add RedisScalatraBroadcaster.
  • Support ClientFilter with Redis Atmosphere plugin.
  • Don’t kill httpsession on atmosphere disconnect.
  • Fix Atmosphere: raise the connected event a little bit later to avoid a race
  • Scalatra broadcaster logs at trace level instead of info level
  • Update to atmosphere 2.1
  • Fix #271: Make atmoshpere client Serializable
  • Make connection string for RedisScalatraBroadcaster configurable
  • improve error message when no Get route is defined while using AtmosphereSupport
  • Fix NPE in AtmosphereClient when looking up an unknown broadcaster
  • simplify TrackMessageSizeInterceptor configuration

Commands

  • Ensure ordering of properties on body parameters from a command by adding a position method.

I18n

  • Provide a way to implement custom Messages resolver.

JSON

  • Support custom serializers in JValueResult.
  • Check if response is JSON or XML in renderJson.
  • Update json4s to 3.2.10
  • Use the character encoding from the request to read the json input stream.

Scalate

  • Don’t always render the Scalate Error page.
  • Fix #336: Only use a single scalate template engine

Spring

  • New support module for Spring.

Swagger

  • BREAKING Use 1.2 spec.
  • Add naive exclusion based on simple class name and known model ID.
  • Add apiOperation and parameter methods that use a swagger model declaration directly.
  • Fix detection of default value.
  • Fix Option data type on models.
  • Fix NPE when the model property has a default value of null.
  • Fix URL generation when a context path is set.
  • Fix serialization of data type for operations and parameters.
  • Fix Option[List[_]] reflection.
  • Output position in Swager spec so model properties have a stable order.
  • Annotated properties are required by default.
  • Force compilation error for apiOperation without type param.
  • Add a form param to swagger support
  • Fix swagger to support application names that have a ‘/’ in them
  • Fix #354: Don’t stackoverflow in swagger with a self-referencing model

Scalatra 2.2.2 and 2.3.0M1 released

The Scalatra team is pleased to announce two new releases.

Scalatra 2.2.2 is a maintenance release which fixes a number of bugs in 2.2.1. It is a drop-in replacement of 2.2.1, and we recommend that all users upgrade.

We are also releasing Scalatra 2.3.0 Milestone 1, on the way to a full release of the Scalatra 2.3.x. This will have mostly minor breaking changes, lots of additional fixes, and some new features (most notably to keep up with new features in asynchronous library support and Swagger development).

One big thing to start thinking about if you're not already: Scalatra 2.3.x will drop support for Scala 2.9.

Here's a detailed list of what's in each of the releases.

Scalatra 2.2.2

Core

  • Fix mount/addServlet for paths not ending in /*
  • HaltException and PassExceptions are no longer control throwables.
  • Respect servlet wrappers in AsyncSupport. (Fixes GZipSupport with async result).
  • Unroll nested futures and async results. #321
  • Allow Accept-Encoding header to be a list.

Atmosphere

  • Fix atmosphere disconnect handling.

Auth

  • Remove false dependency on scalatra-commands.

Commands

  • Properly humanize camel cased names.
  • Add a better validation error serializer.

Jetty

  • Fix uninitalized value error.

Json

  • Ensure JSONP callbacks are fully written to the output stream.
  • Fix JValue result for files.

Scalate

  • Normalize Scalate template path #335
  • Support for i18n support in a ScalatraFilter.

Specs2

  • Fix Specs2 base trait infrastructure

Swagger

  • Modify scalatra-swagger api docs generation to better support apiproperty annotation.
  • Add ability to document API operations that support multiple content type responses.

Scalatra 2.3.0M1

Core

  • Support for Scala 2.9.x dropped.
  • Sever hard Akka dependency. Integration is through scala.concurrent.
  • Change FutureSupport.timeout from a Timeout to a Duration.
  • Add a timeout to AsyncResult.
  • Run callbacks before render in renderResponseBody.
  • Redirect returns Nothing, not unit.
  • Allow calling halt from trap handler.
  • Remove Akka dependency. Only scala.concurrent is needed.

Atmosphere

  • Make ScalatraBroadcaster a trait for custom broadcasters.
  • Add RedisScalatraBroadcaster.
  • Support ClientFilter with Redis Atmosphere plugin.

Commands

  • Ensure ordering of properties on body parameters from a command by adding a position method.

I18n

  • Provide a way to implement custom Messages resolver.

JSON

  • Support custom serializers in JValueResult.
  • Check if response is JSON or XML in renderJson.

Scalate

  • Don't always render the Scalate Error page.

Spring

  • New support module for Spring.

Swagger

  • Add naive exclusion based on simple class name and known model ID.
  • Add apiOperation and parameter methods that use a Swagger model declaration directly.
  • Fix detection of default value.
  • Fix Option data type on models.
  • Fix NPE when the model property has a default value of null.
  • BREAKING Use 1.2 spec.
  • Fix URL generation when a context path is set.
  • Fix serialization of data type for operations and parameters.
  • Fix Option[List[_]] reflection.
  • Output position in Swager spec so model properties have a stable order.
  • Annotated properties are required by default.
  • Force compilation error for apiOperation without type param.

Scalatra in Action: Routing chapter available

Our book Scalatra in Action, available from Manning Publications, has been steadily ticking along over the summer.
A new chapter, on RESTful application development using Scalatra's routing DSL, is now available.

This chapter gives you an overview of both how to tie URLs to your Scalatra routes, and also why you'd want to structure your application routes to use HTTP to its best advantage, using RESTful conventions.

Chapter 4, "Working with user input", is currently awaiting incorporation in the next MEAP update for the book and will be available soon.