在java restful json Web服务中,如果图像升级,更新后的图像不会反映在客户端?
我用Java编写了基于json的web服务,将图像发送到安卓和iphone应用程序。我使用文件系统来存储这些图像,每当我在运行web服务时在目录中添加新图像时,移动端并没有得到更新的图像。但当我再次运行我的web服务时,它可以正常工作。在客户端可以看到图像。是否有任何方法可以使客户端在不运行项目的情况下获得更新的图像
if (rootDirectory.isDirectory()) {
//root directory has the path
FileEntry rootentry=new FileEntry(rootDirectory);//change by
rootentry.refresh(rootDirectory); // to refresh rootdirectory
File childDirectories[] = rootDirectory.listFiles();
//fetch child directories
rootDirectory.listFiles();
for (int i = 0; i < childDirectories.length; i++) {
//File f1 = new File(path + "/" + childDirectories[i]);
File dir = childDirectories[i];
File[] filelist = dir.listFiles();//images in child directory
System.out.println("FIle list "+filelist.toString());
category = new JSONObject();
categoryImg_Arr = new JSONArray();
for (int k = 0; k < filelist.length; k++) {
categoryImg = new JSONObject();
File img = filelist[k];
# 1 楼答案
我认为这可能是缓存的问题。能否尝试在GET请求(无缓存头)中禁用缓存