当前位置: 首页>>代码示例>>Java>>正文


Java JacksonJaxbJsonProvider.setMapper方法代码示例

本文整理汇总了Java中com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.setMapper方法的典型用法代码示例。如果您正苦于以下问题:Java JacksonJaxbJsonProvider.setMapper方法的具体用法?Java JacksonJaxbJsonProvider.setMapper怎么用?Java JacksonJaxbJsonProvider.setMapper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider的用法示例。


在下文中一共展示了JacksonJaxbJsonProvider.setMapper方法的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: 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

示例4: initMasterClient

import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入方法依赖的package包/类
private static void initMasterClient() {
  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);
  masterClient = ClientBuilder.newBuilder().register(provider).register(MultiPartFeature.class).build();
  WebTarget rootTarget = masterClient.target("http://localhost:" + masterDremioDaemon.getWebServer().getPort());
  masterApiV2 = rootTarget.path(API_LOCATION);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:20,代码来源:TestMasterDown.java

示例5: createJerseyRestResource

import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入方法依赖的package包/类
private ResourceConfig createJerseyRestResource(List<Object> resource) {
        ResourceConfig resourceConfig = new ResourceConfig();
//        resourceConfig.register(resource);
        resource.forEach(resourceConfig::register);
        resourceConfig.register(new AllExceptionMapper());

        ObjectMapper mapper = ObjectMapperBuilder.buildNewObjectMapper();

        JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
        provider.setMapper(mapper);
        resourceConfig.register(provider);

        org.glassfish.jersey.logging.LoggingFeature loggingFilter = new org.glassfish.jersey.logging.LoggingFeature(java.util.logging.Logger.getLogger(JettyServerFactory.class.getName()));
        resourceConfig.registerInstances(loggingFilter);
        return resourceConfig;
    }
 
开发者ID:factoryfx,项目名称:factoryfx,代码行数:17,代码来源:ApplicationServerRestServletBridge.java

示例6: jerseySetup

import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入方法依赖的package包/类
private ResourceConfig jerseySetup(List<Object>  resource) {

        ResourceConfig resourceConfig = new ResourceConfig();
//        resourceConfig.register(resource);
        resource.forEach(resourceConfig::register);
        resourceConfig.register(new AllExceptionMapper());
        resourceConfig.register(Soap11Provider.class);
        resourceConfig.register(Soap12Provider.class);

        ObjectMapper mapper = createObjectMapper();

        JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
        provider.setMapper(mapper);
        resourceConfig.register(provider);

        org.glassfish.jersey.logging.LoggingFeature loggingFilter = new org.glassfish.jersey.logging.LoggingFeature(new DelegatingLoggingFilterLogger());
        resourceConfig.registerInstances(loggingFilter);
        return resourceConfig;
    }
 
开发者ID:factoryfx,项目名称:factoryfx,代码行数:20,代码来源:JettyServer.java

示例7: AntiochClient

import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入方法依赖的package包/类
public AntiochClient(final URI antiochURI, SSLContext sslContext) {
  this.antiochURI = antiochURI;
  final ObjectMapper objectMapper = new ObjectMapper()//
      .registerModule(new Jdk8Module())//
      .registerModule(new JavaTimeModule());

  final JacksonJaxbJsonProvider jacksonProvider = new JacksonJaxbJsonProvider();
  jacksonProvider.setMapper(objectMapper);

  PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
  cm.setMaxTotal(50);
  cm.setDefaultMaxPerRoute(50);

  ApacheConnectorProvider connectorProvider = new ApacheConnectorProvider();
  ClientConfig clientConfig = new ClientConfig(jacksonProvider)//
      .connectorProvider(connectorProvider)//
      .property(ApacheClientProperties.CONNECTION_MANAGER, cm)//
      .property(ClientProperties.CONNECT_TIMEOUT, 60000)//
      .property(ClientProperties.READ_TIMEOUT, 60000);

  if (sslContext == null) {
    if ("https".equals(antiochURI.getScheme())) {
      throw new RuntimeException("SSL connections need an SSLContext, use: new AntiochClient(uri, sslContext) instead.");
    }
    client = ClientBuilder.newClient(clientConfig);

  } else {
    client = ClientBuilder.newBuilder()//
        .sslContext(sslContext)//
        .withConfig(clientConfig)//
        .build();
  }
  rootTarget = client.target(antiochURI);
}
 
开发者ID:HuygensING,项目名称:antioch,代码行数:35,代码来源:AntiochClient.java

示例8: makeRestResourceConfig

import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入方法依赖的package包/类
@NotNull
    private ResourceConfig makeRestResourceConfig() {
        ResourceConfig resourceConfig = new ResourceConfig();

        //for data binding:
        //we customize it a bit with our own preferences.
        JacksonJaxbJsonProvider jacksonProvider = new JacksonJaxbJsonProvider();
        ObjectMapper objectMapper = ServerJacksonJsonMarshallerFactory.create().getJackson();
        jacksonProvider.setMapper(objectMapper);
        resourceConfig.register(jacksonProvider);
        resourceConfig.register(JacksonFeature.class);
//            resourceConfig.register(JsonErrorRestExceptionMapper.class);
        resourceConfig.register(FaultInfoRestExceptionMapper.class);
        resourceConfig.register(CharsetResponseFilter.class);

        //register rest services
        for (RestWebServiceProvider restWebServiceProvider : restWebServiceProviders) {
            for (RestWebService restWebService : restWebServiceProvider.getAll()) {
                log.info("Publishing rest web services for class: "+restWebService.getClass().getName());
                resourceConfig.register(restWebService);
            }
        }
        return resourceConfig;
    }
 
开发者ID:optimaize,项目名称:anythingworks,代码行数:25,代码来源:GrizzlyWebServer.java

示例9: DrillRestServer

import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入方法依赖的package包/类
public DrillRestServer(final WorkManager workManager) {
  register(DrillRoot.class);
  register(StatusResources.class);
  register(StorageResources.class);
  register(ProfileResources.class);
  register(QueryResources.class);
  register(MetricsResources.class);
  register(ThreadsResources.class);
  register(FreemarkerMvcFeature.class);
  register(MultiPartFeature.class);
  property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true);


  //disable moxy so it doesn't conflict with jackson.
  final String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(CommonProperties.MOXY_JSON_FEATURE_DISABLE, getConfiguration().getRuntimeType());
  property(disableMoxy, true);

  register(JsonParseExceptionMapper.class);
  register(JsonMappingExceptionMapper.class);
  register(GenericExceptionMapper.class);

  JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
  provider.setMapper(workManager.getContext().getConfig().getMapper());
  register(provider);

  register(new AbstractBinder() {
    @Override
    protected void configure() {
      bind(workManager).to(WorkManager.class);
      bind(workManager.getContext().getConfig().getMapper()).to(ObjectMapper.class);
      bind(workManager.getContext().getPersistentStoreProvider()).to(PStoreProvider.class);
      bind(workManager.getContext().getStorage()).to(StoragePluginRegistry.class);
    }
  });
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:36,代码来源:DrillRestServer.java

示例10: generate

import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入方法依赖的package包/类
public Client generate() {
    ClientConfig clientConfig = clientConfigBase != null
            ? new ClientConfig().loadFrom(clientConfigBase)
            : new ClientConfig();
    final List<JerseyConfig.Binder> binders = new ArrayList<>();
    binders.add(binder -> binder.bind(serviceDefinition).to(ServiceDefinition.class).named(SERVICE_DEFINITION_INJECTION));

    JsonConfig jsonConfig = serviceDefinition.getJsonConfig();
    ObjectMapper mapper = jsonConfig.get();
    JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
    provider.setMapper(mapper);
    clientConfig.register(provider);
    binders.add(binder -> binder.bind(mapper).to(ObjectMapper.class));
    if (! Strings.isNullOrEmpty(clientAppName)) {
        binders.add(binder -> binder.bind(clientAppName).to(String.class).named(ClientNameFilter.CLIENT_APPNAME));
    }
    if (appTokenSupplier != null) {
        binders.add(binder -> binder
                .bind(appTokenSupplier)
                .to(new TypeLiteral<Supplier<String>>() {
                })
                .named(AppTokenClientFilter.APP_TOKEN_SUPPLIER_BIND_NAME)
        );
        clientConfig.register(AppTokenClientFilter.class);
    }

    clientConfig.register(new AbstractBinder() {
        @Override
        protected void configure() {
            binders.forEach(it -> it.addBindings(this));
        }
    });

    return ClientBuilder.newClient(clientConfig);
}
 
开发者ID:code-obos,项目名称:servicebuilder,代码行数:36,代码来源:ClientGenerator.java

示例11: registerServiceDefintion

import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入方法依赖的package包/类
private void registerServiceDefintion(ServiceDefinition serviceDefinition) {
    serviceDefinition.getResources().forEach(resourceConfig::register);

    ObjectMapper mapper = serviceDefinition.getJsonConfig().get();
    JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
    provider.setMapper(mapper);
    resourceConfig.register(JacksonFeature.class);
    resourceConfig.register(provider);
}
 
开发者ID:code-obos,项目名称:servicebuilder,代码行数:10,代码来源:JerseyConfig.java

示例12: createBackup

import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入方法依赖的package包/类
public static BackupStats createBackup(DACConfig dacConfig, String userName, String password, KeyStore trustStore, URI uri) throws IOException {
  final JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
  provider.setMapper(JSONUtil.prettyMapper());
  ClientBuilder clientBuilder = ClientBuilder.newBuilder()
      .register(provider)
      .register(MultiPartFeature.class);

  if (trustStore != null) {
    clientBuilder.trustStore(trustStore);
  } else {
    SSLContext sslContext = SSLHelper.newAllTrustingSSLContext("SSL");
    HostnameVerifier verifier = SSLHelper.newAllValidHostnameVerifier();
    clientBuilder.hostnameVerifier(verifier);
    clientBuilder.sslContext(sslContext);
  }

  final Client client = clientBuilder.build();
  WebTarget target = client.target(format("%s://%s:%d",
      dacConfig.webSSLEnabled ? "https" : "http", dacConfig.masterNode, dacConfig.getHttpPort())).path("apiv2");

  final UserLogin userLogin = new UserLogin(userName, password);
  final UserLoginSession userLoginSession = readEntity(UserLoginSession.class, target.path("/login").request(JSON).buildPost(Entity.json(userLogin)));


  return readEntity(BackupStats.class, target.path("/backup").request(JSON).header(HttpHeader.AUTHORIZATION.toString(),
    TokenUtils.AUTH_HEADER_PREFIX + userLoginSession.getToken()).buildPost(Entity.json(uri.toString())));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:28,代码来源:Backup.java

示例13: init

import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入方法依赖的package包/类
@BeforeClass
public static void init() throws Exception {
  assumeNonMaprProfile();
  startMiniDfsCluster(TestHdfs.class.getName());
  String[] hostPort = dfsCluster.getNameNode().getHostAndPort().split(":");
  host = hostPort[0];
  port = Integer.parseInt(hostPort[1]);
  fs.mkdirs(new Path("/dir1/"), new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL));
  fs.mkdirs(new Path("/dir1/json"), new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL));
  fs.mkdirs(new Path("/dir1/text"), new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL));
  fs.mkdirs(new Path("/dir1/parquet"), new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL));
  fs.mkdirs(new Path("/dir2"), new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL));
  fs.copyFromLocalFile(false, true, new Path(FileUtils.getResourceAsFile("/datasets/users.json").getAbsolutePath()),
    new Path("/dir1/json/users.json"));
  fs.setPermission(new Path("/dir1/json/users.json"), new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL));
  try (Timer.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,
      new DACDaemonModule(),
      new HDFSSourceConfigurator());
    dremioDaemon.init();
    dremioBinder = BaseTestServer.createBinder(dremioDaemon.getBindingProvider());
    JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
    provider.setMapper(JSONUtil.prettyMapper());
    client = ClientBuilder.newBuilder().register(provider).register(MultiPartFeature.class).build();
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:35,代码来源:TestHdfs.java

示例14: connect

import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入方法依赖的package包/类
public void connect() throws IOException {


    ClientConfig configuration = new ClientConfig();
    configuration.property(ClientProperties.READ_TIMEOUT, readTimeoutMillis);

    client = ClientBuilder.newBuilder()
        .withConfig(configuration)
        .hostnameVerifier(SSLHelper.newAllValidHostnameVerifier())
        .sslContext(SSLHelper.newAllTrustingSSLContext("SSL"))
        .build();

    if(REQUEST_LOGGER.isInfoEnabled()){
      java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger(REQUEST_LOGGER_NAME);
      client.register(new LoggingFeature(julLogger, Level.INFO, LoggingFeature.Verbosity.PAYLOAD_TEXT, 65536));
    }

    final JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
    provider.setMapper(ElasticMappingSet.MAPPER);
    client.register(provider);
    if (username != null) {
      client.register(HttpAuthenticationFeature.basic(username, password));
    }

    updateClients();
  }
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:27,代码来源:ElasticConnectionPool.java

示例15: configureMapper

import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; //导入方法依赖的package包/类
public static void configureMapper(ResourceConfig resourceConfig) {
    // create custom ObjectMapper
    ObjectMapper mapper = new ObjectMapper();
    mapper.setNodeFactory(JsonNodeFactory.withExactBigDecimals(true));
    mapper.enable(SerializationFeature.INDENT_OUTPUT);

    // create JsonProvider to provide custom ObjectMapper
    JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
    provider.setMapper(mapper);
    resourceConfig.register(provider);
}
 
开发者ID:dsx-tech,项目名称:e-voting,代码行数:12,代码来源:JettyRunner.java


注:本文中的com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.setMapper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。