2

Web アプリケーションの外部に静的リソース フォルダーがあり、Jetty 8 で構成しようとしています。これまでのところ、次のことを試しました。

1) 次のように、jetty xml にコンテキスト ハンドラーを追加しました。

    <Set name="handler">
  <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
    <Set name="handlers">
     <Array type="org.eclipse.jetty.server.Handler">
      <Item>
        <New id="context" class="org.eclipse.jetty.server.handler.ContextHandler">
         <Set name="resourceBase"><SystemProperty name="JETTY_HOME" default="."/>/static/</Set>
        </New>
      </Item>
       <Item>
         <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
       </Item>
       <Item>
         <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
       </Item>
     </Array>
    </Set>
  </New>
</Set>

そして、jetty-distribution フォルダー内に static フォルダーを配置しました。

また、静的フォルダーを static.war として webapps フォルダー内に配置しようとしましたが、/static ではアクセスできません。

2) jetty ディストリビューションの /contexts フォルダーに xml を追加/変更しようとしました。それでもうまくいきません。

また、私の jetty-web.xml には、以下のように webappcontext が登録されています。

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
 <Call class="org.eclipse.jetty.util.log.Log" name="debug">
    <Arg>executing jetty-web.xml</Arg>
 </Call>
 <Set name="contextPath">/security</Set>
 </Configure>

私の静的リソース構造は次のとおりです。

   static
     -css
       - <all css files>
     -images
       - <further folders and images>
     -js
       - <all js files>

私は桟橋に不慣れで、ここ数日から仕事を始めました。どんな助けでも本当に感謝しています。

ありがとう

4

0 に答える 0