Open GoogleCodeExporter opened 8 years ago
Can you also please attach/insert the HTTP request you used for testing? Thanks.
Original comment by krass...@googlemail.com
on 4 Oct 2011 at 2:05
i have tried and used with the same result request from:
1) simple enctype="multipart/form-data" form
2) http client
3) soap ui
4) jersey client
i have attached the form request, header,post and response
Original comment by dobbe...@gmail.com
on 4 Oct 2011 at 2:52
Attachments:
Ok thanks. I'll take a look as soon as I can (I'm currently very busy with a
customer project).
Original comment by krass...@googlemail.com
on 5 Oct 2011 at 6:07
I found the reason why this doesn't work (and can provide a workaround).
Reason:
When submitting a multipart request to Grails, one of its servlet filters uses
a multipart resolver that parses the request i.e. reads all parts from the
request's input stream. This is the reason why Jersey cannot process the
multipart request: the input stream is already read. It therefore throws an
exception which causes a 400 response (bad request).
Workaround:
Disable Grail's multipart request parsing in Grails. This can be done by adding
grails.disableCommonsMultipart=true to Config.groovy and
class BootStrap {
def grailsApplication
def init = { servletContext ->
grailsApplication.config.'grails.web.disable.multipart' = true
}
}
to BootStrap.groovy. More info at
http://grails.1312388.n4.nabble.com/Disable-MultipartResolver-td3560222.html
Issues:
Disabling Grail's multipart resolver can have consequences when submitting
forms from a GSP for example (see Grails docs). If your app doesn't provide a
GUI then this shouldn't be an issue.
I'll leave this ticket open because I still want to find a way how to support
multipart request processing with grails-jaxrs while having the Grails
multipart resolver enabled as well.
Original comment by krass...@googlemail.com
on 6 Oct 2011 at 8:13
Any news with this issue? Because the workaround doesn't work anymore in Grails
2.0 and plugin 0.6:
In grails 2.0 at startup with workaround enabled you get:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named
'multipartResolver' is defined
at org.grails.jaxrs.web.JaxrsFilter.doFilterInternal(JaxrsFilter.java:41)
Original comment by dobbe...@gmail.com
on 25 Jan 2012 at 12:31
Sorry, didn't work on that yet. Do you want to fix it and make a contribution?
WDYT?
Cheers,
Martin
Original comment by krass...@googlemail.com
on 25 Jan 2012 at 12:43
Well i'm happy to help but i'm not an expert in the inner workings of your
plugin. But i can share my thoughts with you.
I think we should concentrate to make the 'workaround fix' work again in grails
2.0 by optionally be able to disable the grails multipart resolver. Instead of
finding a way to support grails-jaxrs while having the Grails multipart
resolver enabled as well.
I think this because the only 'grails accepted' way at this time to proces raw
request is by disabeling the multipart resolver completely:
http://jira.grails.org/browse/GRAILS-1254
So if you agree , do you have a clue why the workaround works in grais 1.3.x
and in grails 2.0 and plugin version 0.6 your plugin throws this at startup?:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named
'multipartResolver' is defined
at org.grails.jaxrs.web.JaxrsFilter.doFilterInternal(JaxrsFilter.java:41)
Cheers Michael
Original comment by dobbe...@gmail.com
on 27 Jan 2012 at 3:44
Hi Michael,
thanks for your response. Your proposal sounds good to me. I didn't have time
so far to investigate why the workaround doesn't work any more with Grails 2.0.
If you could find it out yourself and get it working with grails-jaxrs 0.6 this
would be of great help for me.
Cheers,
Martin
Original comment by krass...@googlemail.com
on 28 Jan 2012 at 4:04
I discovered it has nothing to do with the plugin. A clean Grails 2.0 app fails
to start with grails.disableCommonsMultipart=true in the Config.groovy.
It results in:
ERROR filter.UrlMappingsFilter - Error when matching URL mapping [/]:No bean
named 'multipartResolver' is defined
So disabling the multipartResolver does not seem possible in Grails 2.0 at this
time. I'll post an Issue.
Cheers Michael
Original comment by dobbe...@gmail.com
on 1 Feb 2012 at 2:38
Thanks for reporting this issue at Grails. Cheers, Martin
Original comment by krass...@googlemail.com
on 1 Feb 2012 at 5:47
Hi friends, i was having the problem described above, and i solved this putting
these two in the Config.groovy:
grails.disableCommonsMultipart=true
grails.web.disable.multipart=true
Now evething is working fine! :)
My grails is 2.0.3 and i'm using jaxrs 0.6
Cheers,
Wilson França
Original comment by wilso...@gmail.com
on 31 May 2012 at 8:48
Hi Wilson,
thanks for letting us know. Would you like to add a small section to the Wiki
about how to enable multipart request processing? Please let me know and I'll
give you write permissions to the Wiki.
Cheers,
Martin
Original comment by krass...@googlemail.com
on 2 Jun 2012 at 8:07
Hi Martin,
I'll be glad to help out on the wiki doc.
Cheers,
Wilson
Original comment by wilso...@gmail.com
on 4 Jun 2012 at 3:20
Just granted you permissions to edit the Wiki. Thanks a lot for your help.
Original comment by krass...@googlemail.com
on 4 Jun 2012 at 6:02
Hi Martin,
Is there an work around with out disabling the multipart resolver??
Cheers,
Rohith
Original comment by krohithk...@gmail.com
on 15 Oct 2014 at 8:13
Original issue reported on code.google.com by
dobbe...@gmail.com
on 4 Oct 2011 at 12:25