implicit.ly

Scala software, hot off the presses

Dispatch 0.8.7

Breaking Changes

If using the </> verb to parse XML, you must now bring it into scope explicitly:

import dispatch.XhtmlParsing._

There's a good reason for this! (See below.)

JSoup and TagSoup modules

Thanks to a big contribution from daros, Dispatch now integrates with parsers that can handle real-world HTML. The handler verb </> is used across all HTML parsers, resolved by its imported implicit conversions. For usage instructions and examples, see the Dispatch documentation for TagSoup and JSoup.

Support byte arrays for POST

This contribution by dyross (no relation?) adds

def << (contents: Array[Byte])

to the standard set of request verbs.

Databinder Dispatch is a library for HTTP interaction, from asynchronous GETs to multi-part OAuth-enticated POSTs.

Filed under  //   Dispatch   Scala 2.8.0   Scala 2.8.1   Scala 2.8.2   Scala 2.9.0   Scala 2.9.0-1   Scala 2.9.1   net.databinder  

Dispatch 0.8.6

Features

Fixes

  • Explicit return type for make_client to fix override problem, contributed by ostewart
  • Avoid slow stream reader usage in json parsing, contributed by pomu0325

Dependencies

News

The Dispatch repository has moved: https://github.com/dispatch/dispatch

Databinder Dispatch is a library for HTTP interaction, from asynchronous GETs to multi-part OAuth-enticated POSTs.

Filed under  //   Dispatch   Scala 2.8.0   Scala 2.8.1   Scala 2.8.2   Scala 2.9.0   Scala 2.9.0-1   Scala 2.9.1   net.databinder  

Dispatch 0.8.5

  • Converted the build to sbt 0.10, issue 35
  • Extracted API integration modules into external git-dependencies: see updated project setup documentation
  • Fixed typing conflict that prevented JSON extension verbs from working with a split request handler, issue 40

API Module Migration

To minimize the disruption of this point release, the popular dispatch.twitter.Auth object has been kept in the main distribution, specifically in the dispatch-oauth module. If you're using only this object, you won't need to set up a git-dependency on the external Twitter module.

Databinder Dispatch is a library for HTTP interaction, from asynchronous GETs to multi-part OAuth-enticated POSTs.

Filed under  //   Dispatch   Scala 2.8.0   Scala 2.8.1   Scala 2.9.0   Scala 2.9.0-1   net.databinder  

Dispatch 0.8.3

  • Fixed regression in NIO handler futures introduced in 0.8.2. An exception was thrown after otherwise successful buffered stream request handling.
  • Fixed bug in NIO handler that would in some cases allow apply() to return null after exceptions were recorded. Applying the NIO future will now throw any recorded exceptions, as intended.

Databinder Dispatch is a library for HTTP interaction, from asynchronous GETs to multi-part OAuth-enticated POSTs.

Filed under  //   Dispatch   Scala 2.8.0   Scala 2.8.1   Scala 2.9.0   Scala 2.9.0-1   net.databinder  

Dispatch 0.8.2

Changes

  • New XHTML handler verb </> to handle imperfect inputs that the xml handler <> would choke on.
  • dispatch.Logger trait declares a warn method. Any custom implementations will need to define it.
  • The base HttpExecutor defines a shutdown() method which should be called when finished with any instance.
  • HttpExecutor defines a finalize() method that shuts down the instance if needed, and issues a warning.
  • Removed dynamic call to Configgy logging, which fails on Scala 2.9 if its incompatible classes are on the classpath.

Shutdown Notes

Although Dispatch 0.7 did not require single-connection client instances to be shutdown after use, changes in the underlying Apache HttpComponents library introduced in Dispatch 0.8 effectively require shutdown for any client instance.

If an application creates many instances (a few hundred) of a client and does not shut them down, resources held by the underlying library will be exhausted and calls to new clients will block indefinitely. To mitigate the problem Dispatch invokes shutdown() from its finalize() method, but an application should not depend on the garbage collector to keep up with a fluctuating pool of executors.

If you are using a single-connection executor, Dispatch recommends that you retain it for a thread of execution (instead of creating new instances for each call) and shut it down before the thread terminates. Alternatively, consider sharing a thread-safe client across your application, which can be easily mixed in to blocking executors with the dispatch.thread.Safety trait.

Databinder Dispatch is a library for HTTP interaction, from asynchronous GETs to multi-part OAuth-enticated POSTs.

Filed under  //   Dispatch   Scala 2.8.0   Scala 2.8.1   Scala 2.9.0   Scala 2.9.0-1   net.databinder  

Dispatch 0.8.1

Dependency Updates

  • lift-json 2.3
  • Google App Engine API 1.4.3

Fixes

  • Use request default charset for multipart mime posts (issue 24)

Databinder Dispatch is a library for HTTP interaction, from asynchronous GETs to multi-part OAuth-enticated POSTs.

Filed under  //   Dispatch   Scala 2.8.0   Scala 2.8.1   Scala 2.9.0.RC4   net.databinder  

Dispatch 0.8.0

Overview

This is a significant upgrade to Dispatch, adding preliminary support for the NIO HttpAsyncClient as a backend. Dispatch's internals have been refactored to provide the needed flexibility, with some breaking changes. And lastly, Scala 2.7.x is not supported in Dispatch 0.8.x.

For these reasons, the Dispatch 0.7 line will continue as long as needed by client applications. Bug fixes will be released in new 0.7 versions (by request) and 0.7 binaries will be back-published for use with new versions of Scala.

Core Module and NIO Support

In previous versions of Dispatch the lowest level HTTP module was dispatch-http, which depends on HttpComponents's HttpClient library. Since 0.8.0 adds support for the HttpComponents's nio-based HttpAsyncClient, there is a new core module that further abstracts request definitions and handlers/callbacks from request executors.

  • dispatch-core - Requests, handlers, callbacks, and abstract executors
  • dispatch-http - Traditional Dispatch client interface, depends on core, uses threads for futures and callbacks
  • dispatch-nio - New Dispatch client interface, depends on core, uses NIO for futures and callbacks

The dispatch-nio module is relatively unproven compared to dispatch-http, and its underlying HttpAsyncClient library is a prerelease version. Just, fyi.

API Refactorings

The module reorganization motivated a number of refactorings that would have been a good idea any, but some of them will require changes to client applications.

import Request._

If you used to import Http._ you will probably need to change that to Request._.

This will enable all the useful implicit conversions that used to be in dispatch.Http (which is not in the core module). Because these are in the Request module, most implicit conversions will happen even if you don't import them. But for migrations the simplest thing is to change your import; there are no implicits on Http so there is no reason to leave that import in code.

Parameters are Traversable[(String, String)]

Sorry, this one's going to sting a little. Parameters used to be Map[String, Any]. Traversable is more general, no problem there, but anywhere that your code is passing in a parameter value (e.g. to << or <<?) whose is type Any you'll get a compiler error. If the value not actually a String just call toString on it, like Dispatch was doing before.

The convenience of the old Any conversion was not worth the bugs it invited into compiled code. Specifically, discovering via a trace that you are POSTing something awful like

[Ljava.lang.Object;@3c9076d

to a remote service.

Simpler Request class, corralled verbs

Request is now a pretty chill class. All of the request verbs, like << and <<?, are implemented in a separate class, as are handler and callback verbs. This puts these on a level playing field with extensions in other modules; the only difference is that Request can not implicitly convert to objects it doesn't know about, so you will still need to import e.g. OAuth._ to use its <@ verb.

Speaking of OAuth, its <<?(token: Token) method has been renamed with_token, and similarly multipart-post methods in Mime are all now <<* instead of <<. (It turns out that implicitly overloaded methods are great for finding compiler bugs and bad for API continuity.)

Callbacks

A new Callback interface serves as an alternative to handlers, for applications that process responses as they arrive, line by line or by some custom division. Callbacks abstract across the implementation differences between the underlying InputStream and NIO interfaces and simply access to streaming APIs.

The dispatch-meetup and dispatch-twitter modules both use callbacks to handle streaming API responses. The example application Twine has been adapted to demonstrate callbacks with Twitter's user stream.

Google App Engine

Dispatch can be used under GAE with the new http-gae module and dispatch.gae.Http executor, contributed by max4f.

Databinder Dispatch is a library for HTTP interaction, from asynchronous GETs to multi-part OAuth-enticated POSTs.

Filed under  //   Dispatch   Scala 2.8.0   Scala 2.8.1   Scala 2.9.0.RC1   net.databinder  

posterous-sbt 0.1.7

Updated Dispatch and knockoff dependency versions. knockoff 0.8.0-16 does not require any extra Maven repositories, so sbt-posterous will not have to anymore either. Yay!

posterous-sbt is a plug-in for Simple Build Tool that automates publishing release notes to any Posterous site.

Filed under  //   Scala 2.7.7   dispatch   knockoff   net.databinder   posterous-sbt   sbt  

Dispatch 0.8.0.Beta5

OAuth signature in prior betas did not account for POST parameters, reported in the forum and fixed with this release. Published for Scala 2.8.0, 2.8.1, and 2.9.0.RC1.

Databinder Dispatch is a library for HTTP interaction, from asynchronous GETs to multi-part OAuth-enticated POSTs.

Filed under  //   Dispatch   Scala 2.8.0   Scala 2.8.1   Scala 2.9.0.RC1   net.databinder  

Dispatch 0.8.0.Beta4

  • Restored the <<(s: String) term
  • Provide lift-json's parser a Reader instead of String
  • Fix double logging in Http
  • Support PUT for encoded form values
  • Exception listeners >! for handlers and ^! for callbacks
  • HttpsLeniency trait to trust all SSL certs (men-in-the-middle rejoice)

Databinder Dispatch is a library for HTTP interaction, from asynchronous GETs to multi-part OAuth-enticated POSTs.

Filed under  //   Dispatch   Scala 2.8.0   Scala 2.8.1   net.databinder