Jetty插件

系统教程 行业动态 更新时间:2024-06-14 17:03:54
Jetty插件 - docBase等效(Jetty Plugin - docBase Equivalent)

我有一个目录C:\ documents \,我希望通过访问http://localhost/something/ ?访问它的文件和子目录。 使用Tomcat,我知道我可以使用

<Context docBase="/documents" path="/somthing" />

如何使用Maven Jetty插件完成这项工作? 我正在使用如下所述的插件版本:

<plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <configuration> <scanIntervalSeconds>1</scanIntervalSeconds> <webDefaultXml>src/test/resources/webdefault.xml</webDefaultXml> <stopPort>9966</stopPort> <stopKey>foo</stopKey> </configuration> <version>7.0.0pre1</version> </plugin> </plugins>

谢谢你的帮助。

I have a directory C:\documents\ and I would like its files and sub-directories to be accessible by visiting http://localhost/something/? Using Tomcat, I know that I can use

<Context docBase="/documents" path="/somthing" />

How can this be done using the Maven Jetty Plugin? I'm using the plugin version as described below:

<plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <configuration> <scanIntervalSeconds>1</scanIntervalSeconds> <webDefaultXml>src/test/resources/webdefault.xml</webDefaultXml> <stopPort>9966</stopPort> <stopKey>foo</stopKey> </configuration> <version>7.0.0pre1</version> </plugin> </plugins>

Thanks for your help.

最满意答案

通过对我的配置(pom.xml)文件进行以下更改,转到更高版本的插件,我能够解决这个问题:

<plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <configuration> <scanIntervalSeconds>1</scanIntervalSeconds> <webDefaultXml>src/test/resources/webdefault.xml</webDefaultXml> <stopPort>9966</stopPort> <stopKey>foo</stopKey> <contextHandlers> <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext"> <contextPath>/documents</contextPath> <resourceBase>/something</resourceBase> </contextHandler> </contextHandlers> </configuration> <version>8.1.5.v20120716</version> </plugin> </plugins>

I was able to solve this problem by going to a later version of the plugin with making the following changes to my configuration (pom.xml) file:

<plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <configuration> <scanIntervalSeconds>1</scanIntervalSeconds> <webDefaultXml>src/test/resources/webdefault.xml</webDefaultXml> <stopPort>9966</stopPort> <stopKey>foo</stopKey> <contextHandlers> <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext"> <contextPath>/documents</contextPath> <resourceBase>/something</resourceBase> </contextHandler> </contextHandlers> </configuration> <version>8.1.5.v20120716</version> </plugin> </plugins>

更多推荐

本文发布于:2023-04-24 14:03:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/2f849936b8a14adcef27ac5de9f05718.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:插件   Jetty

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!