3
我使用grails 1.3.7,我有一個奇怪的bug。 這是我上傳文件代碼:Grails上傳文件異常,由springsecurity引起
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"]
}
}
在開發環境中的所有作品完美,但在生產模式我有thiw例外:
org.codehaus.groovy.runtime.typehandling.GroovyCastException:
Cannot cast object '[email protected]'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)
我也tryied驗證碼:
MultipartHttpServletRequest mpr = (MultipartHttpServletRequest)request;
def uploadedAvatar = request.getFile("uploadedAvatar");
但它不工作。
我使用sprigsecurity-core1.2和grails 1.3.7 /我無法升級它。
感謝您的任何迴應
太棒了!謝謝! – Mikhail 2018-01-09 17:59:00