我正在尝试将服务挂载到scalatra,但是在编译和启动应用程序之后,scalatra无法识别GET /logging。
ScalatraBootstrap.scala
import org.scalatra._
import javax.servlet.ServletContext
class ScalatraBootstrap extends LifeCycle {
override def init(context: ServletContext): Unit = {
context mount(new LoggingService, "/logging/*")
}
}LoggingService.scala
import org.scalatra._
class LoggingService extends ScalatraServlet {
get("/*") {
"hello"
}
}我得到了
Requesting "GET /logging/" on servlet "" but only have:
GET /提前感谢
发布于 2015-11-17 01:45:20
也许这会解决这个问题。
get("/") {
"hello"
}context mount(new LoggingService, "/logging/*")“/ The /*”意味着它将添加所有前缀/The/The/
示例
get("/") {
"hello"
}
get("/1") {
"hello1"
}
get("/2") {
"hello2"
}与"/logging“、"/logging/1”或"/logging/2“搭配使用
https://stackoverflow.com/questions/33057450
复制相似问题