• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java JsonMappingExceptionMapper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.fasterxml.jackson.jaxrs.base.JsonMappingExceptionMapper的典型用法代码示例。如果您正苦于以下问题:Java JsonMappingExceptionMapper类的具体用法?Java JsonMappingExceptionMapper怎么用?Java JsonMappingExceptionMapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JsonMappingExceptionMapper类属于com.fasterxml.jackson.jaxrs.base包,在下文中一共展示了JsonMappingExceptionMapper类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: JerseyApplication

import com.fasterxml.jackson.jaxrs.base.JsonMappingExceptionMapper; //导入依赖的package包/类
@Inject
public JerseyApplication(ServiceLocator serviceLocator) {
	GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
	GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
    guiceBridge.bridgeGuiceInjector(AppLoader.injector);
    
    String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(
    		CommonProperties.MOXY_JSON_FEATURE_DISABLE,
               getConfiguration().getRuntimeType());
       property(disableMoxy, true);
       property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);

       // add the default Jackson exception mappers
       register(JsonParseExceptionMapper.class);
       register(JsonMappingExceptionMapper.class);
       register(JacksonJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
       
       packages(JerseyApplication.class.getPackage().getName());
       
    for (JerseyConfigurator configurator: AppLoader.getExtensions(JerseyConfigurator.class)) {
    	configurator.configure(this);
    }
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:24,代码来源:JerseyApplication.java


示例2: backstopperOnlyExceptionMapperFactory_removes_all_exception_mappers_except_Jersey2ApiExceptionHandler

import com.fasterxml.jackson.jaxrs.base.JsonMappingExceptionMapper; //导入依赖的package包/类
@Test
public void backstopperOnlyExceptionMapperFactory_removes_all_exception_mappers_except_Jersey2ApiExceptionHandler()
    throws NoSuchFieldException, IllegalAccessException {
    // given
    AbstractBinder lotsOfExceptionMappersBinder = new AbstractBinder() {
        @Override
        protected void configure() {
            bind(JsonMappingExceptionMapper.class).to(ExceptionMapper.class).in(Singleton.class);
            bind(JsonParseExceptionMapper.class).to(ExceptionMapper.class).in(Singleton.class);
            bind(generateJerseyApiExceptionHandler(projectApiErrors, utils)).to(ExceptionMapper.class);
        }
    };

    ServiceLocator locator = ServiceLocatorUtilities.bind(lotsOfExceptionMappersBinder);

    // when
    BackstopperOnlyExceptionMapperFactory overrideExceptionMapper = new BackstopperOnlyExceptionMapperFactory(locator);

    // then
    Set<Object> emTypesLeft = overrideExceptionMapper.getFieldObj(
        ExceptionMapperFactory.class, overrideExceptionMapper, "exceptionMapperTypes"
    );
    assertThat(emTypesLeft).hasSize(1);
    ServiceHandle serviceHandle = overrideExceptionMapper.getFieldObj(emTypesLeft.iterator().next(), "mapper");
    assertThat(serviceHandle.getService()).isInstanceOf(Jersey2ApiExceptionHandler.class);
}
 
开发者ID:Nike-Inc,项目名称:backstopper,代码行数:27,代码来源:Jersey2BackstopperConfigHelperTest.java


示例3: DrillRestServer

import com.fasterxml.jackson.jaxrs.base.JsonMappingExceptionMapper; //导入依赖的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


示例4: configure

import com.fasterxml.jackson.jaxrs.base.JsonMappingExceptionMapper; //导入依赖的package包/类
public boolean configure(FeatureContext context) {
    context.property("jersey.config.server.disableMoxyJson", Boolean.valueOf(true));
    Configuration config = context.getConfiguration();
    context.property(getPropertyNameForRuntime("jersey.config.jsonFeature", config.getRuntimeType()), JSON_FEATURE);
    if (!config.isRegistered(JacksonJaxbJsonProvider.class)) {
        context.register(JsonParseExceptionMapper.class);
        context.register(JsonMappingExceptionMapper.class);
        context.register(JacksonJaxbJsonProvider.class, new Class[]{MessageBodyReader.class, MessageBodyWriter.class});
    }

    return true;
}
 
开发者ID:igorzg,项目名称:payara-micro-docker-starter-kit,代码行数:13,代码来源:JacksonFeature.java


示例5: configure

import com.fasterxml.jackson.jaxrs.base.JsonMappingExceptionMapper; //导入依赖的package包/类
@Override
public boolean configure(FeatureContext context) {
    final Configuration config = context.getConfiguration();
    context.property("jersey.config." + config.getRuntimeType().toString().toLowerCase(Locale.ENGLISH) + ".jsonFeature", "JacksonFeature");
    context.register(JsonParseExceptionMapper.class, Priorities.ENTITY_CODER);
    context.register(JsonMappingExceptionMapper.class, Priorities.ENTITY_CODER);
    context.register(JacksonJsonProviderForJsonMediaType.class, Priorities.ENTITY_CODER);
    return true;
}
 
开发者ID:anton-tregubov,项目名称:javaee-design-patterns,代码行数:10,代码来源:JacksonActivator.java


示例6: init

import com.fasterxml.jackson.jaxrs.base.JsonMappingExceptionMapper; //导入依赖的package包/类
protected void init(ScanResult result) {
  // FILTERS
  register(JSONPrettyPrintFilter.class);
  register(MediaTypeFilter.class);

  // RESOURCES
  for (Class<?> resource : result.getAnnotatedClasses(APIResource.class)) {
    register(resource);
  }

  // FEATURES
  register(DACAuthFilterFeature.class);
  register(DACJacksonJaxbJsonFeature.class);
  register(DACExceptionMapperFeature.class);

  // EXCEPTION MAPPERS
  register(JsonParseExceptionMapper.class);
  register(JsonMappingExceptionMapper.class);

  // PROPERTIES
  property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true);
  property(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, "true");

  final String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(CommonProperties.MOXY_JSON_FEATURE_DISABLE,
    getConfiguration().getRuntimeType());
  property(disableMoxy, true);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:28,代码来源:APIServer.java


示例7: configure

import com.fasterxml.jackson.jaxrs.base.JsonMappingExceptionMapper; //导入依赖的package包/类
@Override
public boolean configure(FeatureContext context) {
	final String disableMoxy = CommonProperties.MOXY_JSON_FEATURE_DISABLE + '.'
			+ context.getConfiguration().getRuntimeType().name().toLowerCase();
	context.property(disableMoxy, true);

	// add the default Jackson exception mappers
	context.register(JsonParseExceptionMapper.class);
	context.register(JsonMappingExceptionMapper.class);
	context.register(JacksonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
	return true;
}
 
开发者ID:infinitiessoft,项目名称:keystone4j,代码行数:13,代码来源:JacksonFeature.java


示例8: buildClient

import com.fasterxml.jackson.jaxrs.base.JsonMappingExceptionMapper; //导入依赖的package包/类
private static Client buildClient(ClientConfiguration clientConfiguration) {
    ClientConfig clientConfig = new ClientConfig();
    clientConfig
            .register(JsonMappingExceptionMapper.class)
            .register(JsonParseExceptionMapper.class)
            .register(JacksonJaxbJsonProvider.class, new Class[]{MessageBodyReader.class, MessageBodyWriter.class})
            .register(RequestBodyLogger.class)
            .register(HttpAuthenticationFeature.basic(clientConfiguration.getUsername(), clientConfiguration.getPassword()))
    ;

    if (clientConfiguration.isEnableBatchCompression()) {
        clientConfig.register(GZipWriterInterceptor.class);
    }

    if (log.isDebugEnabled()) {
        clientConfig.register(new LoggingFilter(legacyLogger, true));
    }

    configureHttps(clientConfiguration, clientConfig);

    clientConfig.connectorProvider(new ApacheConnectorProvider());

    Client builtClient = ClientBuilder.newBuilder().withConfig(clientConfig).build();
    builtClient.property(ClientProperties.CONNECT_TIMEOUT, clientConfiguration.getConnectTimeoutMillis());
    builtClient.property(ClientProperties.READ_TIMEOUT, clientConfiguration.getReadTimeoutMillis());
    return builtClient;
}
 
开发者ID:axibase,项目名称:atsd-api-java,代码行数:28,代码来源:HttpClient.java


示例9: init

import com.fasterxml.jackson.jaxrs.base.JsonMappingExceptionMapper; //导入依赖的package包/类
protected void init(ScanResult result) {
  // FILTERS //
  register(JSONPrettyPrintFilter.class);
  register(MediaTypeFilter.class);

  // RESOURCES //
  for (Class<?> resource : result.getAnnotatedClasses(RestResource.class)) {
    register(resource);
  }

  // FEATURES
  property(FreemarkerMvcFeature.TEMPLATE_OBJECT_FACTORY, getFreemarkerConfiguration());
  register(FreemarkerMvcFeature.class);
  register(MultiPartFeature.class);
  register(FirstTimeFeature.class);
  register(DACAuthFilterFeature.class);
  register(DACExceptionMapperFeature.class);
  register(DACJacksonJaxbJsonFeature.class);
  register(TestResourcesFeature.class);

  // LISTENERS //
  register(TimingApplicationEventListener.class);

  // EXCEPTION MAPPERS //
  register(JsonParseExceptionMapper.class);
  register(JsonMappingExceptionMapper.class);


  //  BODY WRITERS //
  register(QlikAppMessageBodyGenerator.class);
  register(TableauMessageBodyGenerator.class);


  // PROPERTIES //
  property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true);
  property(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, "true");

  final String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(CommonProperties.MOXY_JSON_FEATURE_DISABLE,
      getConfiguration().getRuntimeType());
  property(disableMoxy, true);
  property(TableauMessageBodyGenerator.CUSTOMIZATION_ENABLED, false);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:43,代码来源:RestServerV2.java


示例10: DrillRestServer

import com.fasterxml.jackson.jaxrs.base.JsonMappingExceptionMapper; //导入依赖的package包/类
public DrillRestServer(final WorkManager workManager, final ServletContext servletContext, final Drillbit drillbit) {
  register(DrillRoot.class);
  register(StatusResources.class);
  register(StorageResources.class);
  register(ProfileResources.class);
  register(QueryResources.class);
  register(MetricsResources.class);
  register(ThreadsResources.class);
  register(LogsResources.class);

  property(FreemarkerMvcFeature.TEMPLATE_OBJECT_FACTORY, getFreemarkerConfiguration(servletContext));
  register(FreemarkerMvcFeature.class);

  register(MultiPartFeature.class);
  property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true);

  final boolean isAuthEnabled =
      workManager.getContext().getConfig().getBoolean(ExecConstants.USER_AUTHENTICATION_ENABLED);

  if (isAuthEnabled) {
    register(LogInLogOutResources.class);
    register(AuthDynamicFeature.class);
    register(RolesAllowedDynamicFeature.class);
  }

  //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().getLpPersistence().getMapper());
  register(provider);

  // Get an EventExecutor out of the BitServer EventLoopGroup to notify listeners for WebUserConnection. For
  // actual connections between Drillbits this EventLoopGroup is used to handle network related events. Though
  // there is no actual network connection associated with WebUserConnection but we need a CloseFuture in
  // WebSessionResources, so we are using EvenExecutor from network EventLoopGroup pool.
  final EventExecutor executor = workManager.getContext().getBitLoopGroup().next();

  register(new AbstractBinder() {
    @Override
    protected void configure() {
      bind(drillbit).to(Drillbit.class);
      bind(workManager).to(WorkManager.class);
      bind(executor).to(EventExecutor.class);
      bind(workManager.getContext().getLpPersistence().getMapper()).to(ObjectMapper.class);
      bind(workManager.getContext().getStoreProvider()).to(PersistentStoreProvider.class);
      bind(workManager.getContext().getStorage()).to(StoragePluginRegistry.class);
      bind(new UserAuthEnabled(isAuthEnabled)).to(UserAuthEnabled.class);
      if (isAuthEnabled) {
        bindFactory(DrillUserPrincipalProvider.class).to(DrillUserPrincipal.class);
        bindFactory(AuthWebUserConnectionProvider.class).to(WebUserConnection.class);
      } else {
        bindFactory(AnonDrillUserPrincipalProvider.class).to(DrillUserPrincipal.class);
        bindFactory(AnonWebUserConnectionProvider.class).to(WebUserConnection.class);
      }
    }
  });
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:65,代码来源:DrillRestServer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GetBlocksResponseProto类代码示例发布时间:2022-05-22
下一篇:
Java EntityReddustFX类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap