ClientConfig clientConfig = new DefaultClientConfig(); // Allow Jersey Client support JSON. clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE); // Create your own Jackson ObjectMapper. ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); // Create your own JacksonJaxbJsonProvider and then assign it to the config. JacksonJaxbJsonProvider jacksonProvider = new JacksonJaxbJsonProvider(); jacksonProvider.setMapper(mapper); clientConfig.getSingletons().add(jacksonProvider); Client client = Client.create(clientConfig);
2013年3月13日 星期三
Jersey Client with Customize JSON (Jackson) Configuration
訂閱:
文章 (Atom)