1 回答
TA贡献1880条经验 获得超4个赞
注意:请注意您的 DOCTYPE,您声明的内容来自 Jetty 7.x 到 Jetty 8.x,不适用于 Jetty 9.x
不要混用 ResourceHandler 和 WebAppContext / ServletContextHandler。
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/mail</Set>
<Set name="virtualHosts">
<Array type="java.lang.String">
<Item>apps.cairunet.ad.br</Item>
</Array>
</Set>
</Configure>
最基本的支持是不要/ccmail在你的<Configure>.
它存在的事实${jetty.base}/webapps/ccmail/就足够了,它将/ccmail为您部署为静态资源库。
但是,如果您想将静态资源与虚拟主机结合起来,那么您可以使用带有备用基础的 WebAppContext 或新的 ResourceHandler。
ResourceHandler 使用示例: https ://www.eclipse.org/jetty/documentation/current/static-content-deployment.html
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure class="org.eclipse.jetty.server.handler.ContextHandler">
<Set name="contextPath">/ccmail</Set>
<Set name="handler">
<New class="org.eclipse.jetty.server.handler.ResourceHandler">
<Set name="resourceBase">/fully/qualified/path/to/my/jetty.base/webapps/ccmail</Set>
<Set name="directoriesListed">true</Set>
</New>
</Set>
<Set name="virtualHosts">
<Array type="java.lang.String">
<Item>apps.cairunet.ad.br</Item>
</Array>
</Set>
</Configure>
添加回答
举报