-
Bug
-
Resolution: Done
-
Major
-
2.1.0.GA
-
None
-
None
@Form seems to break when CDI is enabled.
I have a class like this:
—
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import org.jboss.resteasy.annotations.Form;
@Path("form-test")
public class FormTest {
public static class FormValues
@POST
public String create(@SuppressWarnings("unused") @Context HttpServletRequest request, @Form FormValues formValues) throws Exception {
if(formValues.stringAttribute == null)
return "worked: " + formValues.stringAttribute;
}
}
—
I've put this class in WEB-INF/classes in my exploded war-directory in my deploy directory.
If I don't have a beans.xml in the WEB-INF directory, this class works as it should. I can submit to it, and the stringAttribute parameter will be available in the form object.
If I put a beans.xml in the WEB-INF directory, and restart JBoss, then the value will not be available, instead I get null.
This problem only seems to affect the first war that loads RestEasy classes. Any other war in the deploy directory has no problem with the @Form object, even if there's a beans.xml file in WEB-INF. I can copy the first exploded war directory, rename it to another name, and then one of these two will work, the other won't work.
As a current workaround I've done this: Put another war with a dummy resteasy-class and the beans.xml in the deploy directory. This war must be loaded before the other wars that I want to work (is it alphabetical order based on filename?). The first will be broken, the others will work.