1 回答

TA貢獻(xiàn)1880條經(jīng)驗(yàn) 獲得超4個(gè)贊
注意:請(qǐng)注意您的 DOCTYPE,您聲明的內(nèi)容來(lái)自 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>.
它存在的事實(shí)${jetty.base}/webapps/ccmail/就足夠了,它將/ccmail為您部署為靜態(tài)資源庫(kù)。
但是,如果您想將靜態(tài)資源與虛擬主機(jī)結(jié)合起來(lái),那么您可以使用帶有備用基礎(chǔ)的 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>
添加回答
舉報(bào)