WEB开发网
开发学院软件开发Java 结合使用 Apache Geronimo 和 Lift:用 Lift 创建... 阅读

结合使用 Apache Geronimo 和 Lift:用 Lift 创建 Web 应用程序并部署到 Geronimo

 2009-11-19 00:00:00 来源:WEB开发网   
核心提示: 站点地图在 entries 值中设置,使用 :: 表示法创建一个列表字面值,结合使用 Apache Geronimo 和 Lift:用 Lift 创建 Web 应用程序并部署到 Geronimo(6),这里已经有一个 “Home” 条目,它映射到 “/&rdq

站点地图在 entries 值中设置。使用 :: 表示法创建一个列表字面值。这里已经有一个 “Home” 条目,它映射到 “/”(index.html 页面)。Nil 表示列表的结尾。

我们已经创建了一个页面并把它添加到站点地图中,现在来测试这个应用程序。在使用 Lift 时,测试是非常容易的。

测试应用程序

测试 Lift 应用程序之前应该先对代码进行打包,然后启动数据库和应用服务器,对吗?别着急。与许多现代 Java Web 框架一样,Lift 使用嵌入的数据库(Derby)和嵌入的 Web 容器(Jetty)。因此,不需要打包或外部软件,也可以测试应用程序。我们只需使用 Maven,如下所示:


清单 4. 用 Maven 运行 Lift
$ mvn jetty:run -U 
[INFO] Scanning for projects... 
[INFO] Searching repository for plugin with prefix: 'jetty'. 
[INFO] org.apache.maven.plugins: checking for updates from scala-tools.org 
[INFO] org.apache.maven.plugins: checking for updates from central 
[INFO] org.codehaus.mojo: checking for updates from scala-tools.org 
[INFO] org.codehaus.mojo: checking for updates from central 
[INFO] artifact org.scala-tools:maven-scala-plugin: checking for updates 
from scala-tools.org 
[INFO] artifact org.scala-tools:maven-scala-plugin: checking for updates from central 
[INFO] artifact org.mortbay.jetty:maven-jetty-plugin: checking for updates 
from scala-tools.org 
[INFO] artifact org.mortbay.jetty:maven-jetty-plugin: checking for updates from central 
[INFO] artifact net.sf.alchim:yuicompressor-maven-plugin: checking for 
updates from scala-tools.org 
[INFO] artifact net.sf.alchim:yuicompressor-maven-plugin: checking for updates 
from central 
[INFO] artifact org.apache.maven.plugins:maven-eclipse-plugin: checking for 
updates from scala-tools.org 
[INFO] artifact org.apache.maven.plugins:maven-eclipse-plugin: checking for 
updates from central 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building quepasa 
[INFO]  task-segment: [jetty:run] 
[INFO] ------------------------------------------------------------------------ 
[INFO] Preparing jetty:run 
[INFO] [resources:resources] 
[INFO] Using default encoding to copy filtered resources. 
[INFO] [yuicompressor:compress {execution: default}] 
[INFO] nb warnings: 0, nb errors: 0 
[INFO] artifact org.mortbay.jetty:jetty: checking for updates from scala-tools.org 
[INFO] artifact org.mortbay.jetty:jetty: checking for updates from central 
[INFO] [compiler:compile] 
[INFO] Nothing to compile - all classes are up to date 
[INFO] [scala:compile {execution: default}] 
[INFO] Compiling 2 source files to /Users/michael/code/lift/quepasa/target/classes 
[INFO] [resources:testResources] 
[INFO] Using default encoding to copy filtered resources. 
[INFO] [compiler:testCompile] 
[INFO] Nothing to compile - all classes are up to date 
[INFO] [scala:testCompile {execution: default}] 
[INFO] Compiling 3 source files to /Users/michael/code/lift/quepasa/target/test-classes 
 [INFO] [jetty:run] 
[INFO] Configuring Jetty for project: quepasa 
[INFO] Webapp source directory = /Users/michael/code/lift/quepasa/src/main/webapp 
[INFO] web.xml file = /Users/michael/code/lift/quepasa/src/main/webapp/WEB-INF/web.xml 
[INFO] Classes = /Users/michael/code/lift/quepasa/target/classes 
2008-05-23 21:19:31.149::INFO: Logging to STDERR via org.mortbay.log.StdErrLog 
[INFO] Context path = / 
[INFO] Tmp directory = determined at runtime 
[INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml 
[INFO] Web overrides = none 
[INFO] Webapp directory = /Users/michael/code/lift/quepasa/src/main/webapp 
[INFO] Starting jetty 6.1.10 ... 
2008-05-23 21:19:31.245::INFO: jetty-6.1.10 
2008-05-23 21:19:31.409::INFO: No Transaction manager found - if your webapp 
requires one, please configure one. 
2008-05-23 21:19:31.989::INFO: Started SelectChannelConnector@0.0.0.0:8080 
[INFO] Started Jetty Server 
[INFO] Starting scanner at interval of 5 seconds. 

上一页  1 2 3 4 5 6 7 8 9 10  下一页

Tags:结合 使用 Apache

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接