當前位置: 首頁>>代碼示例>>Java>>正文


Java JacksonJaxbJsonProvider類代碼示例

本文整理匯總了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);
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:20,代碼來源:TestMasterDown.java

示例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;
  }
 
開發者ID:aol,項目名稱:micro-server,代碼行數:19,代碼來源:JacksonFeature.java

示例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());
}
 
開發者ID:swissquote,項目名稱:carnotzet,代碼行數:20,代碼來源:DockerRegistry.java

示例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"));
}
 
開發者ID:psd2-in-a-box,項目名稱:mid-tier,代碼行數:17,代碼來源:CustomerServiceExposureIT.java

示例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"));
}
 
開發者ID:psd2-in-a-box,項目名稱:mid-tier,代碼行數:27,代碼來源:CustomerServiceExposureIT.java

示例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);
}
 
開發者ID:psd2-in-a-box,項目名稱:mid-tier,代碼行數:21,代碼來源:CustomerServiceExposureIT.java

示例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);
}
 
開發者ID:psd2-in-a-box,項目名稱:mid-tier,代碼行數:17,代碼來源:AccountServiceExposureIT.java

示例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"));
}
 
開發者ID:psd2-in-a-box,項目名稱:mid-tier,代碼行數:18,代碼來源:AccountServiceExposureIT.java

示例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"));
}
 
開發者ID:psd2-in-a-box,項目名稱:mid-tier,代碼行數:17,代碼來源:AccountServiceExposureIT.java

示例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"));
}
 
開發者ID:psd2-in-a-box,項目名稱:mid-tier,代碼行數:27,代碼來源:AccountServiceExposureIT.java

示例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());
}
 
開發者ID:psd2-in-a-box,項目名稱:mid-tier,代碼行數:23,代碼來源:AccountServiceExposureIT.java

示例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;
}
 
開發者ID:Mercateo,項目名稱:rest-jersey-utils,代碼行數:18,代碼來源:AbstractListingResourceTest.java

示例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());
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:20,代碼來源:TestUIServer.java


注:本文中的com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。