2
我在基於Spring的應用程序中嵌入了Jetty。我在Spring上下文文件中配置我的Jetty服務器。我遇到的麻煩的配置的特定部分是這樣的:嵌入式Jetty資源庫類路徑URL
<bean class="org.eclipse.jetty.webapp.WebAppContext">
<property name="contextPath" value="/" />
<property name="resourceBase" value="????????" />
<property name="parentLoaderPriority" value="true" />
</bean>
如果你看到上面的,在這裏我已經把????????,我非常希望resourceBase引用一個我的類路徑中的文件夾。我將我的應用程序部署在一個可執行的JAR文件中,並在我的類路徑中有一個文件夾config/web/WEB-INF
。
Jetty似乎能夠處理在resourceBase中定義的URL(例如jar:file:/myapp.jar!/config/web
),但它似乎不支持類路徑URL。如果我定義諸如classpath:config/web
之類的東西,我會得到IllegalArgumentException。
這對我來說是一個真正的痛苦。有沒有人知道要實現這個功能?
感謝,
安德魯
尼斯之一。如果你不使用Spring,只需使用SomeClass.class.getResource(「/ config/web」)。toURI()。toString() – 2011-01-31 06:13:59