2016-01-27 134 views
-1

我需要使用REST Web服務我有大約100張照片,這是在網頁內容到顯示圖像來顯示圖像 - >圖像文件夾,我想用URL我想用REST Web服務

+0

@GET顯示 \t @Path( 「/獲取」) \t @Produces( 「圖像/ PNG」) \t公衆的BufferedImage的GetFile()拋出IOException異常{ \t \t檔案文件=新的文件(「E:/ KOTiCONS /圖片/ VADA。 JPG「); \t \t return ImageIO.read(file); \t} //這裏我想讀取一張圖片,但是如果我有100張圖片,我需要保留在網頁內容中,並且我想從網頁內容中讀取 –

回答

0
@GET 
@Path("/get/{fileName}") 
public BufferedImage getFile(@PathParam("fileName") String fileName) throws Exception { 
    return ImageIO.read(new File("E:/KOTiCONS/Images/" + fileName)); 
} 
+0

它給出了java.io.IOException:基於圖片的媒體類型的圖像/ webp不支持寫作 –

+0

i GOT iT tHANKS –