战争中的grails文件上传管理 [英] grails file uploads management in wars

查看:160
本文介绍了战争中的grails文件上传管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个具有用户文件上传(docs等)的grails应用程序,它们存储在相关文件夹web-app / upload中。

我的问题是,我不知道什么是自动执行战争部署并保留此文件夹的最佳方式。因为当我在Tomcat中重新部署时,整个应用程序文件夹被删除并且所有文件都被删除。



另外我需要一个通用配置fron从这个文件设置一个外部位置

p>

您是否找到了解决方案? PD:如果我使用System.properties ['base.dir'],结果为null,如果我使用ApplicationHolder.application.mainContext.getResource()它返回一个临时路径。 :

解决方案

您不应该将文件上传到您的WAR结构中,您应该将它们上传到某个外部位置。 >

I have developed a grails app which has user file uploads (docs, etc..), they are stored in the relative folder "web-app/upload".

My question is that I do not know what is the best way to perform automatically war deployments and keep this folder. Because when I redeploy in Tomcat the whole app folder is deleted and all the files are deleted.

Additionaly I need a generic configuration fron set an external location from this Files

Have you found a solution for that?

P.D.: If I use System.properties['base.dir'] the result is null, and if I use a ApplicationHolder.application.mainContext.getResource() it return a temp path. :(

解决方案

You should not be uploading files into your WAR structure. You should upload them to some external location.

这篇关于战争中的grails文件上传管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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