Package sk.iway.iwcm.components.ai.rest
Class AiTempFileStorage
java.lang.Object
sk.iway.iwcm.components.ai.rest.AiTempFileStorage
Handles temporary storage of files (mainly images) generated by AI assistants.
Files are stored in /WEB-INF/tmp/ai_files and can be later moved to final
location by user.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic Stringstatic voiddownloadFile(String fileName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) static Pathstatic voidremoveOldTempFiles(int hours) static StringsaveTempFile(String tempFileName, String fileName, String destinationFolder, javax.servlet.http.HttpServletRequest request)
-
Field Details
-
AI_FILE_DIR
- See Also:
-
-
Method Details
-
getFileFolder
- Throws:
IOException
-
addImage
- Throws:
IOException
-
addImage
public static String addImage(String base64, String fileName, String fileFormat, Path fileFolder) throws IOException - Throws:
IOException
-
downloadFile
public static void downloadFile(String fileName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException - Throws:
IOException
-
saveTempFile
public static String saveTempFile(String tempFileName, String fileName, String destinationFolder, javax.servlet.http.HttpServletRequest request) throws IOException, IllegalStateException - Throws:
IOExceptionIllegalStateException
-
removeOldTempFiles
- Throws:
IOException
-