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


Java JacksonJsonProvider类代码示例

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


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

示例1: ParaClient

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; //导入依赖的package包/类
/**
 * Default constructor.
 * @param accessKey app access key
 * @param secretKey app secret key
 */
public ParaClient(String accessKey, String secretKey) {
	this.accessKey = accessKey;
	this.secretKey = secretKey;
	if (StringUtils.length(secretKey) < 6) {
		logger.warn("Secret key appears to be invalid. Make sure you call 'signIn()' first.");
	}
	ClientConfig clientConfig = new ClientConfig();
	clientConfig.register(GenericExceptionMapper.class);
	clientConfig.register(new JacksonJsonProvider(ParaObjectUtils.getJsonMapper()));
	clientConfig.connectorProvider(new HttpUrlConnectorProvider().useSetMethodWorkaround());
	SSLContext sslContext = SslConfigurator.newInstance().securityProtocol("TLSv1").createSSLContext();
	System.setProperty("https.protocols", "TLSv1");
	apiClient = ClientBuilder.newBuilder().
			sslContext(sslContext).
			withConfig(clientConfig).build();
}
 
开发者ID:Erudika,项目名称:para,代码行数:22,代码来源:ParaClient.java

示例2: JerseyApplication

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

示例3: rebuildHttpClient

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; //导入依赖的package包/类
/**
 * Build the Client used to make HTTP requests with the latest settings,
 * i.e. objectMapper and debugging.
 * TODO: better to use the Builder Pattern?
 */
public ApiClient rebuildHttpClient() {
  // Add the JSON serialization support to Jersey
  JacksonJsonProvider jsonProvider = new JacksonJsonProvider(objectMapper);
  DefaultClientConfig conf = new DefaultClientConfig();
  conf.getSingletons().add(jsonProvider);
  Client client = Client.create(conf);
  if (debugging) {
    client.addFilter(new LoggingFilter());
  }
  
  //to solve the issue of GET:metadata/:guid with accepted encodeing is 'gzip' 
  //in the past, when clients use gzip header, actually it doesn't trigger a gzip encoding... So everything is fine 
  //After the release, the content is return in gzip, while the sdk doesn't handle it correctly
  client.addFilter(new GZIPContentEncodingFilter(false));

  this.httpClient = client;
  return this;
}
 
开发者ID:Autodesk-Forge,项目名称:forge-api-java-client,代码行数:24,代码来源:ApiClient.java

示例4: getSingletons

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; //导入依赖的package包/类
@Override
public Set<Object> getSingletons() {
    Swagger2Feature swagger = new Swagger2Feature();
    swagger.setBasePath("/");
    swagger.setHost("localhost:9000");
    swagger.setTitle("Order Service");
    swagger.setDescription("Rider Auto Parts Order Service");
    swagger.setVersion("2.0.0");
    swagger.setContact("[email protected]");
    swagger.setPrettyPrint(true);

    Set<Object> answer = new HashSet<>();
    answer.add(orderService);
    answer.add(new JacksonJsonProvider());
    answer.add(swagger);
    // to turn on verbose logging
    answer.add(new LoggingFeature());
    return answer;
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:20,代码来源:RestOrderApplication.java

示例5: BaseApplicaionConfig

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; //导入依赖的package包/类
public BaseApplicaionConfig() {
    //设置默认时区
    System.setProperty("user.timezone", "Asia/Shanghai");

    register(ValidationContextResolver.class);
    property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
    property(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK, true);

    this.packages(packages());
    register(ObjectMapperResolver.class);
    register(JacksonFeature.class);
    register(JacksonJsonProvider.class);
    register(new BaseExceptionMapper(createExcetionWrapper()));
    register(RequestContextFilter.class);

    register(DefaultWebFilter.class);

    if (FilterConfig.apiDocEnabled()) {
        register(SwaggerSerializers.class);
    }
}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:22,代码来源:BaseApplicaionConfig.java

示例6: configureMessage

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; //导入依赖的package包/类
@Test
public void configureMessage() throws IllegalArgumentException, IllegalAccessException {
	final ServerProviderFactory instance = ServerProviderFactory.getInstance();
	@SuppressWarnings("unchecked")
	final List<ProviderInfo<ExceptionMapper<?>>> object = (List<ProviderInfo<ExceptionMapper<?>>>) FieldUtils
			.getField(ServerProviderFactory.class, "exceptionMappers", true).get(instance);
	final FailSafeExceptionMapper provider = new FailSafeExceptionMapper();
	object.add(new ProviderInfo<>(provider, null, true));
	final JacksonJsonProvider jacksonJsonProvider = new JacksonJsonProvider();
	FieldUtils.getField(FailSafeExceptionMapper.class, "jacksonJsonProvider", true).set(provider, jacksonJsonProvider);

	final UserImportEntry entry = Mockito.mock(UserImportEntry.class);
	Mockito.when(entry.getId()).thenThrow(new RuntimeException());
	final BatchTaskVo<UserImportEntry> importTask = new BatchTaskVo<>();
	importTask.setEntries(Collections.singletonList(entry));
	task.configure(importTask);
	task.jaxrsFactory = instance;
	task.run();
	Assert.assertEquals(Boolean.TRUE, importTask.getStatus().getStatus());
	Assert.assertEquals(1, importTask.getStatus().getDone());
	Assert.assertEquals(1, importTask.getStatus().getEntries());
}
 
开发者ID:ligoj,项目名称:plugin-id,代码行数:23,代码来源:UserFullLdapTaskTest.java

示例7: getSingletons

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; //导入依赖的package包/类
@Override
    public Set<Object> getSingletons() {
        if (!preloaded) {
            preloaded = true;
            forgeInitialiser.preloadCommands(commandsResource);
        }

        return new HashSet<Object>(
                Arrays.asList(
                        rootResource,
                        commandsResource,
                        repositoriesResource,
                        new JacksonJsonProvider(),
                        new CamelCatalogRest()
/*
                        new SwaggerFeature(),
                        new EnableJMXFeature(),
*/
                )
        );
    }
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:22,代码来源:ForgeRestApplication.java

示例8: BaseApplicaionConfig

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; //导入依赖的package包/类
public BaseApplicaionConfig() {
	//设置默认时区
	System.setProperty("user.timezone","Asia/Shanghai");
	
	register(ValidationContextResolver.class);
	property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
    property(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK, true);
			
	this.packages(packages());
	
	register(ObjectMapperResolver.class);
	register(JacksonFeature.class);
	register(JacksonJsonProvider.class);
	register(new BaseExceptionMapper(createExcetionWrapper()));
	register(RequestContextFilter.class);
	
	register(DefaultWebFilter.class);
	//
	if(FilterConfig.apiDocEnabled()){
		register(SwaggerSerializers.class);
	}
}
 
开发者ID:vakinge,项目名称:jeesuite-libs,代码行数:23,代码来源:BaseApplicaionConfig.java

示例9: jaxRsServer

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; //导入依赖的package包/类
@Bean
  @DependsOn("cxf")
  public Server jaxRsServer() {
      JAXRSServerFactoryBean serverFactory = RuntimeDelegate.getInstance().createEndpoint(jaxRsApiApplication(), JAXRSServerFactoryBean.class);
      
      //factory.setServiceBean(new DenialCategoryRest());
      
// get all the class annotated with @JaxrsService
      List<Object> beans = configUtil.findBeans( JaxrsService.class );

if (beans.size() > 0) {
	
	// add all the CXF service classes into the CXF stack
	serverFactory.setServiceBeans( beans );
	serverFactory.setAddress("/"+ serverFactory.getAddress());
	serverFactory.setBus(springBus);
	serverFactory.setStart(true);
	
	// set JSON as the response serializer
	JacksonJsonProvider provider = new JacksonJsonProvider();
	serverFactory.setProvider(provider);
       
}
      
return serverFactory.create();
  }
 
开发者ID:amoldavsky,项目名称:restful-api-cxf-spring-java,代码行数:27,代码来源:CxfConfig.java

示例10: setup

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; //导入依赖的package包/类
@Before
public void setup() {
    catalog = new CamelCatalogRest();

    port = AvailablePortFinder.getNextAvailable(9000);

    // setup Apache CXF REST server
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setResourceClasses(CamelCatalogRest.class);
    sf.setResourceProvider(CamelCatalogRest.class, new SingletonResourceProvider(catalog));
    // to use jackson for json
    sf.setProvider(JacksonJsonProvider.class);
    sf.setAddress("http://localhost:" + port);

    // create and start the CXF server (non blocking)
    server = sf.create();
    server.start();
}
 
开发者ID:fabric8io,项目名称:django,代码行数:19,代码来源:CamelCatalogRestTest.java

示例11: testCalendarIdParameterEncoding

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; //导入依赖的package包/类
@Test
public void testCalendarIdParameterEncoding() {
    // test data
    final Client client = ClientBuilder.newBuilder().register(JacksonJsonProvider.class).build();
    final WebTarget eventsTarget = client.target("https://api.cronofy.com/")
            .path("v1")
            .path("events");
    // expectations
    final WebTarget noCalendars = eventsTarget.queryParam("calendar_ids[]", null);
    final WebTarget emptyCalendars = eventsTarget.queryParam("calendar_ids[]", new String[]{});
    final WebTarget twoCalendars1 = eventsTarget.queryParam("calendar_ids[]", new String[]{"a", "b"});
    final WebTarget twoCalendars2 = eventsTarget.queryParam("calendar_ids[]", "a", "b");
    // test scenario
    assertEquals("https://api.cronofy.com/v1/events", noCalendars.getUri().toString());
    assertEquals("https://api.cronofy.com/v1/events", emptyCalendars.getUri().toString());
    assertEquals("https://api.cronofy.com/v1/events?calendar_ids%5B%5D=a&calendar_ids%5B%5D=b", twoCalendars1.getUri().toString());
    assertEquals("https://api.cronofy.com/v1/events?calendar_ids%5B%5D=a&calendar_ids%5B%5D=b", twoCalendars2.getUri().toString());
}
 
开发者ID:Biacode,项目名称:jcronofy,代码行数:19,代码来源:CronofyClientImplTest.java

示例12: getWebTarget

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; //导入依赖的package包/类
private WebTarget getWebTarget() {
    if (client == null) {
        client = ClientBuilder.newClient();
        client.register(JacksonJsonProvider.class);

        // register the basic authentication filter if authentication information is provided
        if (authenticationToken != null) {
            client.register(new ClientRequestFilter() {
                @Override
                public void filter(ClientRequestContext requestContext) throws IOException {
                    requestContext.getHeaders().add("Authorization", "Basic " + authenticationToken);
                }
            });
        }

    }

    WebTarget target = client.target(targetUrl);

    return target;
}
 
开发者ID:nikfoundas,项目名称:etcd-viewer,代码行数:22,代码来源:EtcdProxyImpl.java

示例13: configure

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; //导入依赖的package包/类
@Override
protected Application configure() {
    final ResourceConfig application =
            new ResourceConfig(TestWebserviceWithPath.class, TestWebserviceWithPutDelete.class,
                    TestWebserviceMultipart.class, TestWebserviceExceptionHandling.class,
                    JacksonJsonProvider.class);
    final Injector injector =
            Guice.createInjector(new ClientModule(), new ExceptionObjectMapperModule());

    // register multi part feature.
    application.register(MultiPartFeature.class);

    // register the application mapper.
    application.register(injector.getInstance(TestExceptionMapper.class));
    return application;
}
 
开发者ID:strandls,项目名称:alchemy-rest-client-generator,代码行数:17,代码来源:AlchemyRestClientFactoryTest.java

示例14: configure

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; //导入依赖的package包/类
@Override
public void configure()
{
    ApplicationBindingBuilder builder = bindApplication()
        .matches("/api/*")
        .addProvider(JacksonJsonProvider.class, JsonProviderProvider.class)
        .addProvider(AuthRequestFilter.class)
        .addProvider(CustomHeaderFilter.class)
        .addProvider(AdminRestrictedFilter.class)
        ;
    bindResources(builder);
    bindAuthenticator();
    bindExceptionhandlers(builder);
    bindSecrets();
    bindUiApplication();
}
 
开发者ID:treasure-data,项目名称:digdag,代码行数:17,代码来源:ServerModule.java

示例15: getClasses

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; //导入依赖的package包/类
@Override
public Set<Class<?>> getClasses() {
    Set<Class<?>> classes = new HashSet<>();
    classes.add(DeciserviceResource.class);
    classes.add(NotesResource.class);
    classes.add(BrowserNotesResource.class);
    classes.add(JacksonJsonProvider.class);
    classes.add(StaticContentFilter.class);
    classes.add(Templater.class);
    classes.add(FreemarkerTemplater.class);
    classes.add(SanitizedNotesService.class);
    classes.add(ExceptionMappers.class);
    classes.add(ExceptionMappers.AppExceptionMapper.class);
    classes.add(ExceptionMappers.NotFoundMapper.class);
    return classes;
}
 
开发者ID:redsaz,项目名称:deciservice,代码行数:17,代码来源:DeciserviceApplication.java


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