jetty 的WebAppDeployer可以指定一個特定的目錄,
做為佈署webapp的位置,
webapp 可以是一整個含有jsp、servlet、web.xml的資料夾,
也可以是一個.war的包裝檔,
jetty啟動時會去指定的 scan 一但,找到war file或webapp,
就會將他註冊到server的ContextHandlerCollection下,
jetty.xml的設定如下
<Configure class="org.mortbay.jetty.Server" id="server">
<!-- Deployer 設定 -->
<Call name="addLifeCycle">
<Arg>
<New class="org.mortbay.jetty.deployer.WebAppDeployer">
<Set name="contexts"><Ref id="contexts"/></Set>
<Set name="webAppDir">./deployer</Set>
<Set name="parentLoaderPriority">false</Set>
<Set name="extract">true</Set>
<Set name="allowDuplicates">false</Set>
</New>
</Arg>
</Call>
</Configure>
其中的./deployer是Deployer在啟動時會去scan的佈署目錄
而contexts則是server.setHandlers(new Handler[]{contexts , new DefaultHandler()})中的
ContextHandlerCollection物件。HandlerList也是ContextHandlerCollection其中一個子類別
沒有留言:
張貼留言