0
我有一個Jetty服務器,它提供一個Angular頁面,但也有幾個Jersey端點編碼。我的角項目處於resources
目錄,並建立和運行之後,target
看起來是這樣的:如果提供index.html,Jersey端點無法加載
WEB-INF
classes
index.html
com/
web.xml
我web.xml
看起來是這樣的:
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<display-name>Sandbox</display-name>
<servlet>
<servlet-name>Jersey</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<!-- Adds JSON processing to map java classes to JSON text in both directions -->
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<!-- Tell the Jersey framework where to search for services. Also, JAX-RS is needed
for the JSON serialization -->
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.hb.apps.server;org.codehaus.jackson.jaxrs</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>json</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
有了這個設置,擊中localhost:8080/Sandbox
擔任了單頁角應用程序,但打localhost:8080/Sandbox/rest/*
告訴我,我的端點無法找到。 Angular應用程序是在Jersey應用程序之後引入的,在Angular應用程序之前,我的Jersey端點使用此配置正常工作(減去welcome-file-list
)。爲什麼有一個Angular應用程序遮蓋了我的Jersey端點?