问题
I have a grails controller which handle fileupload. I deployed the application on glassfish in windows and in ubuntu.
On windows deployment, the request object of
request.getFile("filename")
is of type commons.CommonsMultipartFile
while on ubuntu deployment the request is of type support.DefaultMultipart
What causes this different behavour? Is there a way to make it consistent?
The application server is glassfish3.1.2
回答1:
Anything grails supplies via the request.getFile(...)
method should implement the Spring MultipartFile
interface. As long as you stick to the methods available in the interface, you shouldn't need to worry about what concrete implementation you receive.
回答2:
the problem solved after I upgraded the glassfish from 3.1.2 to glassfish 4 in windows and ubuntu.
there may be some other ways to solve this. but i solved this by upgrading the glassfish.
来源:https://stackoverflow.com/questions/17628417/different-classes-grails-use-to-handle-upload-files