tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sgjava <sgj...@gmail.com>
Subject JAX-RS POJO mapping
Date Wed, 15 Apr 2015 14:02:09 GMT
I had JAX-RS POJO mapping working in TomEE using Jersey/Jackson (Glassfish
impl) with javax.ws.rs.* packages, but I wanted to use connect and read
timeouts. As suggested I tried the CXF impl built into TomEE, but I cannot
get the response to map to the POJO. Here's the code in question:

        final WebClient client = WebClient.create(url, Collections.
                singletonList(new JacksonJsonProvider()));
        final HTTPConduit conduit =
WebClient.getConfig(client).getHttpConduit();
        conduit.getClient().setReceiveTimeout(7000);
        conduit.getClient().setConnectionTimeout(7000);
        final VersionDto versionDto = new VersionDto("xxx");
        // This throws a 500 server exception
        final VersionDto response = client.type(
                MediaType.APPLICATION_JSON_TYPE).accept(
                        MediaType.APPLICATION_JSON_TYPE).post(versionDto,
                        VersionDto.class);

        // This will work but returns
sun.net.www.protocol.http.HttpURLConnection$HttpInputStream
        final Response response =
client.type(MediaType.APPLICATION_JSON_TYPE).
                accept(MediaType.APPLICATION_JSON_TYPE).post(versionDto);

I'm not able to find any complete examples.



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JAX-RS-POJO-mapping-tp4674454.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Mime
View raw message