2015-04-23 78 views
0

我试图映射泽西岛请求检索使用以下映射的图像。以下作品路径suchs作为泽西路径注释不映射所有文件类型

  • /test/file.png
  • /test/file.gif
  • /test/file.jpeg

但它未能地图

  • /test/file.jpg

我没有其他的映射,所以它不能与另一个映射冲突。为什么泽西不能绘制包含.jpg的路径?

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

你把xml文件放到什么地方 – Shang

+0

老天爷你发现问题了!我把jpg列为WebPageContentRegex,甚至不知道它。我会把它作为答案。谢谢! –

回答

0

在我的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>