我使用 grails 1.3.7 并且我有一个奇怪的错误。这是我上传文件的代码:
def editAvatar = {
def uploadedAvatar = request.getFile("uploadedAvatar");
if(!uploadedAvatar?.isEmpty()) {
clientService.saveUploadedAvatar(uploadedAvatar, basePath);
render 'avaterUdated';
} else {
render(contentType:"text/json", encoding:"UTF-8") {
[valid:false, error: "some error"]
}
}
在开发环境中一切正常,但在生产模式下我有例外:
org.codehaus.groovy.runtime.typehandling.GroovyCastException:
Cannot cast object 'org.springframework.security.web.firewall.RequestWrapper@1ce4ded'with class 'org.springframework.security.web.firewall.RequestWrapper' to class 'org.springframework.web.multipart.MultipartHttpServletRequest'
at ru.pscb.web.grb.ui.UserProfileController$_closure6.doCall(UserProfileController.groovy:80)
我也尝试了这段代码:
MultipartHttpServletRequest mpr = (MultipartHttpServletRequest)request;
def uploadedAvatar = request.getFile("uploadedAvatar");
但这也行不通。
我使用 sprigsecurity-core1.2 和 grails 1.3.7/ 我无法升级它。
感谢您的任何回复