Multipart

81 views
Skip to first unread message

Mathieu

unread,
Dec 4, 2019, 3:32:48 PM12/4/19
to Thorntail
Hey guys

I'm having trouble doing multi form Post and trying to receive a List of object inside the Form.

I added the jaxrs-multipart dependency inside my pom.xml file but when I added it, none of my web service responds, I get an 404 error.
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jaxrs-multipart</artifactId>
</dependency>

What I did was setting my pom.xml like this and my web service now are responding correctly
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jaxrs-multipart</artifactId>
<!-- Can't use jaxrs-multipart without exclude resteasy-jaxrs dependency -->
<exclusions>
<exclusion>
<artifactId>resteasy-jaxrs</artifactId>
<groupId>org.jboss.resteasy</groupId>
</exclusion>
</exclusions>
</dependency>

But, with that new setup, I get this:
    java.lang.RuntimeException: RESTEASY007545: Unable to find a MessageBodyReader for media type: text&#x2F;plain;charset=us-ascii and class type java.util.List


Here is a sample of my object that match my form
@FormParam("names")
@PartType(MediaType.TEXT_PLAIN)
private List<String> names;

So, how can I setup my project to be able to do this kind of things ?

Thanks

Ladislav Thon

unread,
Dec 5, 2019, 2:20:22 AM12/5/19
to thor...@googlegroups.com

Hi,

here's a simple test that shows JAX-RS with multipart: https://github.com/rhoar-qe/thorntail-test-suite/tree/master/javaee/jaxrs-multipart. I'm not sure if the problem is in the List<String> aspect, or something else. Do you have a working JAX-RS application on anything else than Thorntail that accepts List<String> from multipart/form request body?

You can also try using RESTEasy's MultipartFormDataInput as a generic container, instead of your custom class.

LT

--
You received this message because you are subscribed to the Google Groups "Thorntail" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thorntail+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/thorntail/d4829010-7749-44de-9b8a-c0ad2be6dde8%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages