Hi Max
It is unfortunate Form accepts parameters with String values, I think we
missed it should be Object instead given that ParamConverterProvider is
available in JAX-RS 2.0.
form() can deal with MultipartMap - CXF ships MetadataMap which
implements it, and JAX-RS 2.0 ships a simple implementation too:
https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/javax/ws/rs/core/MultivaluedHashMap.html
You'll still need registering ParamConverterProvider if values are not
String and the beans do not override toString()
HTH, Sergey
It has to be MultivaluedMap, JAX-RS
On 16/12/15 10:04, Maxim Solodovnik wrote:
Hello All,
I'm currently trying to write RS service accepting 2 objects of different
types as parameters:
ex. code:
@WebService(serviceName="org.apache.openmeetings.webservice.UserWebService")
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/user")
public class UserWebService {
@POST
@Path("/hash")
public ServiceResult getRoomHash(
@FormParam("user") BeanA user
, @FormParam("options") BeanB options
) throws ServiceException
{}
}
and I'm trying to invoke this method from JUnit test:
ExternalUserDTO user = new ExternalUserDTO();
RoomOptionsDTO options = new RoomOptionsDTO();
Map<String, List<Object>> map = new LinkedHashMap<>();
map.put("user", Arrays.asList((Object)user));
map.put("options", Arrays.asList((Object)options));
Response resp = getClient(USER_SERVICE_URL)
.path("/hash")
.form(map);
//throws no body wrapper for LinkedHashMap class
I cannot use .form(new Form().....) due to it can only accepts string
parameters
can someone please point me to an example or provide with the hint how this
can be implemented
Thanks in advance
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/