Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 升降舵副翼和副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼;我没有收到我的请求_Scala_Sbt_Lift - Fatal编程技术网

Scala 升降舵副翼和副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼;我没有收到我的请求

Scala 升降舵副翼和副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼副翼;我没有收到我的请求,scala,sbt,lift,Scala,Sbt,Lift,我试图创建一个简单的RestHelper“Hello world”示例,但遇到了问题。使用container:start命令启动容器时 serve { case Nil Get _ => Extraction.decompose("Hello Restful world!") } 在myRestHelper扩展中未调用。我得到以下信息: “在此服务器上找不到请求的URL/” 所以,似乎出于某种原因,lift忽略了 LiftRules.statelessDispatch.app

我试图创建一个简单的
RestHelper
“Hello world”示例,但遇到了问题。使用
container:start
命令启动容器时

serve {
    case Nil Get _ => Extraction.decompose("Hello Restful world!")
  }
在my
RestHelper
扩展中未调用。我得到以下信息: “在此服务器上找不到请求的URL/”

所以,似乎出于某种原因,lift忽略了

LiftRules.statelessDispatch.append(Service)
定义中的行
bootstrap.Boot.Boot
。我完全不知道为什么会这样

这是我的
Boot
课程:

package bootstrap

import net.liftweb.http.LiftRules
import com.yac.restfultest.Service

class Boot {
  def boot {
    LiftRules.statelessDispatch.append(Service)
  }
}
这里是
服务

package com.yac.restfultest

import net.liftweb.http.rest.RestHelper
import net.liftweb.json.Extraction

object Service extends RestHelper {

  serve {
    case Nil Get _ => Extraction.decompose("Hello Restful world!")
  }

}
如果有帮助,下面是我的
web.xml

<!DOCTYPE web-app SYSTEM "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
    <filter>
        <filter-name>LiftFilter</filter-name>
        <display-name>Lift Filter</display-name>
        <description>The Filter that intercepts Lift calls</description>
        <filter-class>net.liftweb.http.LiftFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>LiftFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>
正如你所见,这几乎是最简单的电梯项目设置可能。我还是不能让它工作。任何帮助都将不胜感激

下面是
sbt
登录
container:start

[info] Compiling 1 Scala source to /home/yac/IdeaProjects/TestRest/target/scala-2.11/classes...
[info] Packaging /home/yac/IdeaProjects/TestRest/target/scala-2.11/testrest_2.11-1.0.jar ...
[info] Done packaging.
[info] starting server ...
[success] Total time: 2 s, completed Apr 22, 2015 7:51:25 PM
> 2015-04-22 19:51:25.640:INFO::main: Logging initialized @44ms
2015-04-22 19:51:25.646:INFO:oejr.Runner:main: Runner
2015-04-22 19:51:25.726:INFO:oejs.Server:main: jetty-9.2.1.v20140609
2015-04-22 19:51:29.818:WARN:oeja.AnnotationConfiguration:main: ServletContainerInitializers: detected. Class hierarchy: empty
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2015-04-22 19:51:30.405:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@32e377c7{/,file:/home/yac/IdeaProjects/TestRest/target/webapp/,AVAILABLE}{file:/home/yac/IdeaProjects/TestRest/target/webapp/}
2015-04-22 19:51:30.406:WARN:oejsh.RequestLogHandler:main: !RequestLog
2015-04-22 19:51:30.417:INFO:oejs.ServerConnector:main: Started ServerConnector@7a601e4{HTTP/1.1}{0.0.0.0:8080}
2015-04-22 19:51:30.418:INFO:oejs.Server:main: Started @4848ms

所以,事实证明这是一种平常的无意识的不专注。包含
Boot.scala
的包应该被称为
bootstrap.liftweb
,而不是像我的例子那样仅称为
bootstrap


是的,正如jcern所建议的,它应该是路由模式中的
“index”::Nil

您是否尝试过匹配:
“index”::Nil
而不是简单的
Nil
?我甚至尝试将路由设置为“test”::“item”::Nil。还是没用。
[info] Compiling 1 Scala source to /home/yac/IdeaProjects/TestRest/target/scala-2.11/classes...
[info] Packaging /home/yac/IdeaProjects/TestRest/target/scala-2.11/testrest_2.11-1.0.jar ...
[info] Done packaging.
[info] starting server ...
[success] Total time: 2 s, completed Apr 22, 2015 7:51:25 PM
> 2015-04-22 19:51:25.640:INFO::main: Logging initialized @44ms
2015-04-22 19:51:25.646:INFO:oejr.Runner:main: Runner
2015-04-22 19:51:25.726:INFO:oejs.Server:main: jetty-9.2.1.v20140609
2015-04-22 19:51:29.818:WARN:oeja.AnnotationConfiguration:main: ServletContainerInitializers: detected. Class hierarchy: empty
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2015-04-22 19:51:30.405:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@32e377c7{/,file:/home/yac/IdeaProjects/TestRest/target/webapp/,AVAILABLE}{file:/home/yac/IdeaProjects/TestRest/target/webapp/}
2015-04-22 19:51:30.406:WARN:oejsh.RequestLogHandler:main: !RequestLog
2015-04-22 19:51:30.417:INFO:oejs.ServerConnector:main: Started ServerConnector@7a601e4{HTTP/1.1}{0.0.0.0:8080}
2015-04-22 19:51:30.418:INFO:oejs.Server:main: Started @4848ms