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>
添加回答
舉報