泽西岛路径注释未映射所有文件类型

Jersey Path annotation not mapping all file types

我正在尝试映射球衣请求以使用以下映射检索图像。以下适用于

等路径

但是无法映射

除了这个我没有其他映射,所以它不能与另一个映射冲突。为什么 Jersey 无法映射包含 .jpg 的路径?

@GET
@Path("/{pathPrefix}/{file}")
public Response getImage(@PathParam("pathPrefix") String pathPrefix,
                         @PathParam("file") String file

在我的 web.xml 中,我发现以下行 "jpg" 列为 WebPageContentRegex。从内容集中删除该值解决了问题

<init-param>
    <param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
    <param-value>.*\.(html|ico|jsp|jpg|css)</param-value>
</init-param>