移轉至 WebSphere Application Server Traditional 或 Liberty 時,無法從 Servlet 存取位於 META-INF 及 WEB-INF 目錄中的檔案。 此規則標示位於那些目錄中的 HTML 檔、JSP 檔及影像檔。 若要避免找不到檔案的問題,請將需要從 Servlet 存取的內容移至 WebContent 目錄。 如果無法移動,則可以透過在 server.xml 檔中新增下列行,來容許 Servlet 存取 Liberty WEB-INF 目錄中所包含的檔案。
<webContainer exposeWebInfOnDispatch="true"/>
如果設定 exposeWebInfOnDispatch="true",則分派的要求將可以存取位於 WEB-INF 及 META-INF 目錄中的所有檔案。
如需相關資訊,請參閱 Web 儲存器文件。
如需在 WebSphere Application Server Traditional 上設定 Web 儲存器自訂內容的相關資訊,請參閱 Web 儲存器自訂內容 文件。