我已经使用https://http4s.org/构建了我的网络应用程序:
object UserSvcServer {
def stream[F[_]: ConcurrentEffect](implicit T: Timer[F], C: ContextShift[F]): Stream[F, Nothing] = {
val helloWorldAlg = HelloWorld.impl[F]
val httpApp = (
UserSvcRoutes.helloWorldRoutes[F](helloWorldAlg)
).orNotFound
val finalHttpApp = Logger.httpApp(true, true)(httpApp)
for {
exitCode <- JettyBuilder[F]
.bindHttp(8080, "0.0.0.0")
.mountHttpApp(finalHttpApp, "/")
.serve
} yield exitCode
}.drain
}
正如您在上面的代码中看到的,它使用JettyBuilder
.
当我启动应用程序时,日志显示:
[main] INFO o.e.j.util.log - Logging initialized @730ms to org.eclipse.jetty.util.log.Slf4jLog
[ioapp-compute-0] INFO o.e.j.s.Server - jetty-9.4.28.v20200408; built: 2020-04-08T17:49:39.557Z; git: ab228fde9e55e9164c738d7fa121f8ac5acd51c9; jvm 11.0.7+10-LTS
[ioapp-compute-0] INFO o.h.s.Http4sServlet - Detected Servlet API version 3.1
[ioapp-compute-0] INFO o.h.s.Http4sServlet - Using non-blocking servlet I/O with chunk size 4096
[ioapp-compute-0] INFO o.e.j.s.h.ContextHandler - Started o.e.j.s.ServletContextHandler@71cc4a24{/,null,AVAILABLE}
这是否意味着,Web 应用程序已经在 Jetty 上运行,我不必从https://www.eclipse.org/jetty/下载码头服务器?
通常,war 文件必须放入 webapps 文件中: