我正在尝试提供来自play-mini应用程序的图像。
object App extends Application {
def route = {
case GET(Path("/image")) => Action { request =>
Ok( Source.fromInputStream(getClass.getResourceAsStream("image.gif")).toArray ).as("image/gif")
}
}
}
不幸的是,这不起作用:)我收到以下错误
Cannot write an instance of Array[Char] to HTTP response. Try to define a Writeable[Array[Char]]