亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在碼頭部署靜態內容

在碼頭部署靜態內容

手掌心 2022-07-06 18:39:59
我正在嘗試在碼頭中部署靜態應用程序,但使用 xml 配置文件,因為我使用的是虛擬主機。我為部署創建了這個文件 xml:<?xml version="1.0"  encoding="ISO-8859-1"?><!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"   "http://www.eclipse.org/jetty/configure.dtd"><Configure class="org.eclipse.jetty.webapp.WebAppContext">    <Set name="contextPath">/mail</Set>    <!--<Call name="setInitParameter">        <Arg>org.eclipse.jetty.servlet.Default.useFileMappedBuffer</Arg>        <Arg>false</Arg>    </Call> -->    <Set name="handler">    <New class="org.eclipse.jetty.server.handler.ResourceHandler">      <Set name="resourceBase">/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>我的文件夾應用程序的名稱是ccmail. 位于webapps/ccmail 我已經嘗試傳遞到路徑:<Set name="resourceBase">/ccmail</Set><Set name="resourceBase">ccmail</Set><Set name="resourceBase">./ccmail</Set><Set name="resourceBase">webapps/ccmail</Set><Set name="resourceBase">/webapps/ccmail</Set>任何這條路徑都不適合我的人。碼頭啟動此錯誤:2019-02-25 09:36:46.422:WARN:oejs.ServletContextHandler:main: 不應直接調用 ServletContextHandler.setHandler。使用 insertHandler 或 setSessionHandler 等 2019-02-25 09:36:46.484:WARN:oejw.WebInfConfiguration:main: Can't generate resourceBase 作為 webapp tmp dir name: java.lang.IllegalStateException: No resourceBase or war set for上下文 2019-02-25 09:36:46.500:WARN:oejw.WebAppContext:main: 上下文 oejwWebAppContext@7d0587f1{/mail,nul 啟動失敗
查看完整描述

1 回答

?
慕村225694

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>


查看完整回答
反對 回復 2022-07-06
  • 1 回答
  • 0 關注
  • 159 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號