我试图实现提供的akka-http rest示例,但我坚持使用
slick.SlickException: This DBMS allows only a single column to be returned from an INSERT, and that column must be an AutoInc column.
at slick.jdbc.JdbcStatementBuilderComponent$JdbcCompiledInsert.buildReturnColumns(JdbcStatementBuilderComponent.scala:67)
以下是S
我是AKKA世界的新手
我从上面的帖子中得到了如何使用Akka-HTTP在RESTAPI响应中发送文件的解决方案,但我想为该文件提供一个名称和扩展名。那么,用文件名和扩展名将文件作为响应发送的方法是什么呢?这意味着我希望下载的文件在Akka-HTTP with scala中应该有一个带有.zip扩展名的名称
我想在rest服务中使用akka-http和新的mongo-scala-driver。
这段代码起作用了
val routes = {
pathPrefix("info") {
pathEndOrSingleSlash {
get {
val mongoClient: MongoClient = MongoClient("mongodb://localhost:27017,localhost:27018,localhost:27019/?replicaSet=rs0")
val database: Mong
我正在创建使用Akka-Http的Post电话,在那里用户将填写表单并提出请求。
我想把这个表单数据转换成Scala Map[String, String]
有人能告诉我怎么做吗。
下面是代码片段
post {
entity(as[Multipart.FormData]) { body =>
complete { //How to process Multi Part Form data to Map
}
}
}
谢谢
我正在尝试通过akka-http上传一个文件,并已将其与以下代码片段一起使用
def tempDestination(fileInfo: FileInfo): File =
File.createTempFile(fileInfo.fileName, ".tmp")
val route =
storeUploadedFile("csv", tempDestination) {
case (metadata, file) =>
//Do my operation on the file.
complete
我正在尝试使用兔子mq客户端运行akka-http (‘_2.12’)
使用scala版本2.12。
但我有个例外:
Exception in thread "main" java.lang.NoClassDefFoundError: scala/Function1$class
at akka.http.scaladsl.server.PathMatcher.<init>(PathMatcher.scala:20)
at akka.http.scaladsl.server.ImplicitPathMatcherConstruction$$anon$8.<ini
我正在努力将一个应用程序从Spray.io迁移到Akka-http。这个应用程序是基于微服务的,有许多我们建立在上面的小型库。下面是在一个特定的微服务中组合指令和路由的示例:
val routes =
(decompressRequest & compressResponseIfRequested) {
metricsRoute ~
healthStatusRoute ~
apiRoutes // only these are my app's routes
}
除apiRoutes之外,上述所有内容都是在内部库中定义的