本文整理汇总了Java中com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider类的典型用法代码示例。如果您正苦于以下问题:Java JacksonJaxbJsonProvider类的具体用法?Java JacksonJaxbJsonProvider怎么用?Java JacksonJaxbJsonProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JacksonJaxbJsonProvider类属于com.fasterxml.jackson.jaxrs.json包,在下文中一共展示了JacksonJaxbJsonProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initClient
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入依赖的package包/类
private static void initClient() {
JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
ObjectMapper objectMapper = JSONUtil.prettyMapper();
objectMapper.registerModule(
new SimpleModule()
.addDeserializer(JobDataFragment.class,
new JsonDeserializer<JobDataFragment>() {
@Override
public JobDataFragment deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
return jsonParser.readValueAs(DataPOJO.class);
}
}
)
);
provider.setMapper(objectMapper);
client = ClientBuilder.newBuilder().register(provider).register(MultiPartFeature.class).build();
WebTarget rootTarget = client.target("http://localhost:" + currentDremioDaemon.getWebServer().getPort());
currentApiV2 = rootTarget.path(API_LOCATION);
}
示例2: configure
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Override
public boolean configure(final FeatureContext context) {
PluginLoader.INSTANCE.plugins.get().stream()
.filter(module -> module.jacksonFeatureProperties()!=null)
.map(Plugin::jacksonFeatureProperties)
.map(fn->fn.apply(context))
.forEach(map -> {
addAll(map,context);
});
JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
provider.setMapper(JacksonUtil.getMapper());
context.register(provider, new Class[]{MessageBodyReader.class, MessageBodyWriter.class});
return true;
}
示例3: activate
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Activate
void activate() throws Exception {
super.register(JacksonJaxbJsonProvider.class);
super.property(ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true);
Properties props = new Properties();
props.setProperty(JDBC_URL, "jdbc:h2:./ismPlugin");
props.setProperty(JDBC_USER, "admin");
props.setProperty(JDBC_PASSWORD, "abc12345");
DataSource ds = this.jdbcFactory.createDataSource(props);
this.em = this.resourceFactory
.getProviderFor(this.builder, singletonMap("javax.persistence.nonJtaDataSource", (Object) ds), null)
.getResource(this.txControl);
this.domainApis.init(this.em, this.txControl);
this.deviceApis.init(this.em, this.txControl);
this.securityGroupApis.init(this.em, this.txControl);
this.securityGroupInterfaceApis.init(this.em, this.txControl);
super.registerInstances(this.domainApis, this.deviceApis, this.securityGroupApis,
this.securityGroupInterfaceApis);
this.container = new ServletContainer(this);
}
开发者ID:opensecuritycontroller,项目名称:security-mgr-sample-plugin,代码行数:27,代码来源:SecurityManagerServletDelegate.java
示例4: getRegistryClient
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入依赖的package包/类
private RegistryEndpoints getRegistryClient(ImageRef imageRef) {
if (!proxyClients.containsKey(imageRef.getRegistryUrl())) {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JavaTimeModule());
Client client = ClientBuilder.newClient()
.register(new JacksonJaxbJsonProvider(mapper, new Annotations[] {Annotations.JACKSON}))
.register(JacksonFeature.class);
String auth = config.getAuthFor(imageRef.getRegistryName());
if (auth != null) {
String[] credentials = new String(Base64.getDecoder().decode(auth), StandardCharsets.UTF_8).split(":");
client.register(HttpAuthenticationFeature.basicBuilder().credentials(credentials[0], credentials[1]));
}
WebTarget webTarget = client.target(imageRef.getRegistryUrl());
proxyClients.put(imageRef.getRegistryUrl(), WebResourceFactory.newResource(RegistryEndpoints.class, webTarget));
}
return proxyClients.get(imageRef.getRegistryUrl());
}
示例5: testGetCustomer
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Test
public void testGetCustomer() {
WebTarget target = ClientBuilder.newClient().register(JacksonJaxbJsonProvider.class).target("http://localhost:7001/sample");
Map<String, Object> response = target.path("customers/9999999999")
.request()
.accept("application/hal+json")
.header("X-Client-Version", "1.0.0")
.header("X-Service-Generation", "1")
.header("X-Log-Token", DiagnosticContext.getLogToken())
.get(Map.class);
assertEquals("Ole", response.get("firstName"));
assertEquals("Bent", response.get("middleName"));
assertEquals("Pedersen", response.get("sirname"));
assertEquals("9999999999", response.get("number"));
}
示例6: testCreateCustomer
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Ignore("Ignored because a valid OAuth endpoint is not supplied")
@Test
public void testCreateCustomer() throws Exception {
String accessToken = requestAccessToken("advisor1");
int customerNo = ThreadLocalRandom.current().nextInt(9999999);
WebTarget customerServices =
ClientBuilder.newClient().register(JacksonJaxbJsonProvider.class).target("http://localhost:7001/sample");
Map<String, String> customerCreate = new ConcurrentHashMap<>();
customerCreate.put("firstName", "Bo");
customerCreate.put("middleName", "Hr");
customerCreate.put("sirname", "Hansen");
Map<String, Object> response = customerServices.path("customers").path("" + customerNo)
.request()
.accept("application/hal+json")
.header("X-Client-Version", "1.0.0")
.header("X-Log-Token", DiagnosticContext.getLogToken())
.header("X-Service-Generation", "1")
.header("Authorization", "Bearer " + accessToken)
.put(Entity.entity(customerCreate, MediaType.APPLICATION_JSON_TYPE), Map.class);
assertEquals("Bo", response.get("firstName"));
assertEquals("Hr", response.get("middleName"));
assertEquals("Hansen", response.get("sirname"));
assertEquals(customerNo, response.get("number"));
}
示例7: testEventCollections
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Ignore("Ignored because a valid OAuth endpoint is not supplied")
@Test
public void testEventCollections() throws UnsupportedEncodingException {
WebTarget target = ClientBuilder.newClient().register(JacksonJaxbJsonProvider.class).target("http://localhost:7001/sample");
String accessToken = requestAccessToken("tx-system-update");
Map<String, Object> response = target.path("customer-events")
.request()
.accept("application/hal+json")
.header("X-Client-Version", "1.0.0")
.header("X-Service-Generation", "1")
.header("X-Log-Token", DiagnosticContext.getLogToken())
.header("Authorization", "Bearer " + accessToken)
.get(Map.class);
assertNotNull(response);
assertNotNull(response.get("_links"));
assertNotNull(response.get("_embedded"));
Map<String, Object> embedded = (Map<String, Object>) response.get("_embedded");
assertTrue(((List) embedded.get("events")).size() >= 2);
}
示例8: testListAccounts
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Test
public void testListAccounts() {
WebTarget target = ClientBuilder.newClient().register(JacksonJaxbJsonProvider.class).target("http://localhost:7001/sample");
Map<String, Object> response = target.path("accounts")
.queryParam("customer", "1")
.request()
.accept("application/hal+json")
.header("X-Client-Version", "1.0.0")
.header("X-Service-Generation", "1")
.header("X-Log-Token", DiagnosticContext.getLogToken())
.get(Map.class);
assertNotNull(response.get("_embedded"));
Map<String, Object> embedded = (Map<String, Object>) response.get("_embedded");
assertTrue(((List) embedded.get("accounts")).size() >= 2);
}
示例9: testGetAccount
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Test
public void testGetAccount() {
WebTarget target = ClientBuilder.newClient().register(JacksonJaxbJsonProvider.class).target("http://localhost:7001/sample");
Map<String, Object> response = target.path("accounts/5479-1234567")
.request()
.accept("application/hal+json")
.header("X-Client-Version", "1.0.0")
.header("X-Service-Generation", "1")
.header("X-Log-Token", DiagnosticContext.getLogToken())
.get(Map.class);
assertEquals("5479", response.get("regNo"));
assertEquals("1234567", response.get("accountNo"));
assertEquals("Checking account", response.get("name"));
assertNotNull(response.get("_links"));
assertNotNull(response.get("_embedded"));
}
示例10: testGetAccountUsingSpecificContentTypeWithParameters
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Test
public void testGetAccountUsingSpecificContentTypeWithParameters() {
WebTarget target = ClientBuilder.newClient().register(JacksonJaxbJsonProvider.class).target("http://localhost:7001/sample");
Map<String, Object> response = target.path("accounts").path("5479-1234567")
.request()
.accept("application/hal+json;concept=account;v=1")
.header("X-Client-Version", "1.0.0")
.header("X-Service-Generation", "1")
.header("X-Log-Token", DiagnosticContext.getLogToken())
.get(Map.class);
assertEquals("5479", response.get("regNo"));
assertEquals("1234567", response.get("accountNo"));
assertEquals("Checking account", response.get("name"));
assertNotNull(response.get("_links"));
assertNull(response.get("_embedded"));
}
示例11: testCreateAccount
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Ignore("Ignored because a valid OAuth endpoint is not supplied")
@Test
public void testCreateAccount() throws Exception {
String accessToken = requestAccessToken("advisor1");
int accountNo = ThreadLocalRandom.current().nextInt(9999999);
WebTarget bankServices =
ClientBuilder.newClient().register(JacksonJaxbJsonProvider.class).target("http://localhost:7001/sample");
Map<String, String> accountCreate = new ConcurrentHashMap<>();
accountCreate.put("regNo", "5479");
accountCreate.put("accountNo", Integer.toString(accountNo));
accountCreate.put("name", "Savings account");
accountCreate.put("customer", "cust-1");
Map<String, Object> response = bankServices.path("accounts").path("5479-" + accountNo)
.request()
.accept("application/hal+json")
.header("X-Client-Version", "1.0.0")
.header("X-Log-Token", DiagnosticContext.getLogToken())
.header("X-Service-Generation", "1")
.header("Authorization", "Bearer " + accessToken)
.put(Entity.entity(accountCreate, MediaType.APPLICATION_JSON_TYPE), Map.class);
assertEquals("5479", response.get("regNo"));
assertEquals(Integer.toString(accountNo), response.get("accountNo"));
assertEquals("Savings account", response.get("name"));
}
示例12: testCreateAccountAccessDenied
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Ignore("Ignored because a valid OAuth endpoint is not supplied")
@Test
public void testCreateAccountAccessDenied() throws Exception {
String accessToken = requestAccessToken("customer1");
WebTarget bankServices =
ClientBuilder.newClient().register(JacksonJaxbJsonProvider.class).target("http://localhost:7001/sample");
Map<String, String> accountCreate = new ConcurrentHashMap<>();
accountCreate.put("regNo", "5479");
accountCreate.put("accountNo", "5555555");
accountCreate.put("name", "Checking account");
accountCreate.put("customer", "cust-1");
Response response = bankServices.path("accounts").path("5479-5555555")
.request(MediaType.APPLICATION_JSON_TYPE)
.accept("application/hal+json")
.header("X-Client-Version", "1.0.0")
.header("X-Service-Generation", "1")
.header("X-Log-Token", DiagnosticContext.getLogToken())
.header("Authorization", "Bearer " + accessToken)
.put(Entity.entity(accountCreate, MediaType.APPLICATION_JSON_TYPE), Response.class);
assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
}
示例13: configure
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Override
protected Application configure() {
enable(TestProperties.LOG_TRAFFIC);
enable(TestProperties.DUMP_ENTITY);
MockitoAnnotations.initMocks(this);
ResourceConfig rs = new ResourceConfig();
rs.register(TestBinder.forAllMocksOf(this));
rs.register(JacksonJaxbJsonProvider.class);
rs.register(TestResource.class);
rs.property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, Boolean.TRUE);
LinkFactoryResourceConfig.configure(rs);
linkMetaFactory = LinkMetaFactory.createInsecureFactoryForTest();
return rs;
}
示例14: tccCoordinatorClient
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Bean
public WebTarget tccCoordinatorClient() {
Client client = ClientBuilder.newClient();
client.register(new JacksonJaxbJsonProvider());
client.register(new TransactionProvider());
WebTarget target = client.target(tccCoordinatorBaseUrl);
return target.path("/coordinator");
}
开发者ID:jotorren,项目名称:microservices-transactions-tcc,代码行数:9,代码来源:CompositeTransactionConfiguration.java
示例15: init
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入依赖的package包/类
@BeforeClass
public static void init() throws Exception {
try (TimedBlock b = Timer.time("[email protected]")) {
dremioDaemon = DACDaemon.newDremioDaemon(
DACConfig
.newDebugConfig(DremioTest.DEFAULT_SABOT_CONFIG)
.autoPort(true)
.allowTestApis(true)
.writePath(folder.getRoot().getAbsolutePath())
.clusterMode(ClusterMode.LOCAL)
.serveUI(true),
DremioTest.CLASSPATH_SCAN_RESULT);
dremioDaemon.init();
JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
provider.setMapper(JSONUtil.prettyMapper());
client = ClientBuilder.newBuilder().register(provider).register(MultiPartFeature.class).build();
rootTarget = client.target("http://localhost:" + dremioDaemon.getWebServer().getPort());
}
}