刷新 SparkJava 提供的静态文件 [英] Refresh static files served by SparkJava

查看:84
本文介绍了刷新 SparkJava 提供的静态文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个使用 Spark Java 的项目.在服务器端,创建了一些图像,我希望它们在客户端中可用.由于我有一个静态内容目录,在服务器端创建图像后,我将其放在该目录中.但是,除非我重新启动服务器,否则此文件不可用.我想必须有一种方法可以在运行时刷新 Spark Java 的静态目录文件,以便可以满足运行时创建的图像的请求.对吗?

I'm doing a project using Spark Java. On the server side, some images are created and I want them to be available in the client. Since I have a static content directory, after creating the image on the server side, I place it in that directory. However, this file is not available unless I reboot the server. I guess there must be a way to refresh the static directory file for Spark Java on runtime so that requests of on-runtime created images can be fulfilled. Right?

谢谢!

推荐答案

我已经解决了这个问题,将 png 编码为 Base 64 并将其作为响应发送给客户端.

I've solved it by encoding the png as Base 64 and send it as response to the client.

这篇关于刷新 SparkJava 提供的静态文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆