users@jersey.java.net

Jersey, Jmeter and multipart

From: <mani.ezzat_at_neuf.fr>
Date: Mon, 20 Sep 2010 21:22:36 +0200 (CEST)

Hello,

I've got a problem but i'm not sure it's a jersey problem.

I've got a webapp using Jersey. Server side, i have two methods. One for url encoded request, and an other for a file AND the same parameters of the url encoded one.

My problem is concerning the second method (a POST)
I use a multipart/form mediaType with a field named "file" containing the uploaded file. The other fields are string param

When I use a browser everything is fine. Same if I use a java client (which use Jersey)

But when I use Jmeter i've got an Exception.
I'm not at work so i can't past it. But it's about the getValue method of the bodypart class. It says thats the content must be text/plain (like written in the javadoc)

I looked at the request done by Jmeter and by a browser.
It's the same except for one thing :
Jmeter sends a content-transfer-encoding: 8 bits for each field of the multipart form, and binary for the file.

I can't change that behaviour in Jmeter. According to some RFC specif, Jmeter seems to be right.
My question is : is this really a Jersey thing ? and how can I make my app (server side) handle those requests ?
I tried getEntityAs and getValueAs and i got another exception which says that de content isn't the unconverted entity (as writter in the javadoc too)

To make it "simple", I have server side a method like this :

@consume "multipart/form"
getform(FormDataMultipart form){
form.getField("my param").getValue()
}
and it sends the text/plain exception on getvalue (only if it's a jmeter request)

I'm using jersey 1.1.1 (i have also the multipart contrib, mimepull.jar etc... well it works but not with Jmeter request)