开发者

RESTEasy - access to web folder for geting image

开发者 https://www.devze.com 2022-12-29 14:04 出处:网络
I would like to allow users to access images saved in web folder. For example - I have an image in web root folder \"blank.png\". But the link http://localhost:8080/myapp/blank.png returns 404 (not f

I would like to allow users to access images saved in web folder.

For example - I have an image in web root folder "blank.png". But the link http://localhost:8080/myapp/blank.png returns 404 (not found).

Adding type to resteasy.media.type.mappings does not work.

I am a bit of a ne开发者_StackOverflow社区wbie in RESTEasy...


your servlet mapping probably mapped all URLs to RESTeasy servlet, therefore overshadowing the normal static file serving. You should adjust servlet-mapping tags.

But you can also serve files from RESTeasy:

 @GET
 @Path("/img/{fileName}")
 public File getImage() { return new File("..."+fileName; }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号