eed3si9n/scalaxb — Issue #121: Generate DispatchHttpClient that targets AppEngine
Author: ben-manes
Created: 2011-11-20 22:25:29+00:00
State: open

GAE does not allow raw socket access, so Apache HttpClient fails due to a security violation. A repackaged version that is compatible is provided in the SDK and dispatch-gae can be used instead. This is simply an import change for the DispatchHttpClient that scalaxb generates. It would be nice if this was an option so that users don't have to duplicate the code themselves.

For example in my GAE application I have...

@Provides
def providesDownloadService(): DownloadSvcSoap =
new DownloadSvcSoap12Bindings with SoapClients with GaeDispatchHttpClients {}.service

private trait GaeDispatchHttpClients extends HttpClients {
val httpClient = new DispatchHttpClient {}

trait DispatchHttpClient extends HttpClient {
import dispatch.gae._
import dispatch.url

def request(in: String, address: java.net.URI, headers: Map[String, String]): String = {
val http = new Http
http x (url(address.toString) << (in) <:< headers as_str)
}
}
}