Java 类org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider 实例源码

项目:webshell-xpages-ext-lib    文件:WebSocketService.java   
public HashSet<Object> getSingletons(){
    ObjectMapper mapper = new ObjectMapper();
    JacksonJaxbJsonProvider jaxbProvider = new JacksonJaxbJsonProvider();
    jaxbProvider.setMapper(mapper);
    singletons.add(jaxbProvider);

    if(Activator.BUNDLE==null){
        throw new IllegalArgumentException("WebSocketService.BUNDLE is null!");
    }

    IGuicer guicer = Guicer.getInstance(Activator.BUNDLE);

    //create the rest object make sure dependencies are injected via guice.
    IRestWebSocket restWebSocket = guicer.createObject(IRestWebSocket.class);


    if(restWebSocket==null){
        throw new IllegalArgumentException("restWebSocket is null!!!");
    }

    //add it
    singletons.add(restWebSocket);

    return singletons;

}
项目:jeta    文件:RestClient.java   
static ClientResponse getJSONResponse(String url, String content_type) {
    ClientConfig config = new DefaultClientConfig();
    config.getClasses().add(JacksonJaxbJsonProvider.class);
    config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    WebResource webResource = getWebResource(url,config,content_type);
    return webResource.accept(content_type).get(ClientResponse.class);
}
项目:jeta    文件:RestClient.java   
static ClientResponse postJSONResponse(String url, String content_type,String body) {
    ClientConfig config = new DefaultClientConfig();
    config.getClasses().add(JacksonJaxbJsonProvider.class);
    config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    WebResource webResource = getWebResource(url,config,content_type);
    return webResource.accept(content_type).post(ClientResponse.class,body);
}
项目:ditb    文件:TestModelBase.java   
protected TestModelBase(Class<?> clazz) throws Exception {
  super();
  this.clazz = clazz;
  context = new JAXBContextResolver().getContext(clazz);
  mapper = new JacksonJaxbJsonProvider().locateMapper(clazz,
      MediaType.APPLICATION_JSON_TYPE);
}
项目:SAP-cloud-dqm-sample-java    文件:DataQualityServiceFactory.java   
/**
 * Returns a reference to the Data Quality service (proxy) to be used. 
 * 
 * @return A reference to the Data Quality service (proxy) to be used
 */
public DataQualityService getService()
{
    DataQualityService retVal = null;

    // set up providers
    List<Object> providers = new ArrayList<Object>();
    JacksonJaxbJsonProvider jsonProvider = new JacksonJaxbJsonProvider(new CustomObjectMapper(), DEFAULT_ANNOTATIONS);
    ErrorResponseExceptionMapper srvExMapper = new ErrorResponseExceptionMapper();

    providers.add(jsonProvider);
    providers.add(srvExMapper);

    if (endPoint != null)
    {
        // initialize proxy
        retVal  = JAXRSClientFactory.create(endPoint, DataQualityService.class, providers);
    }
    else // fall-back (local or non-NEO runtime env)
    {
        // TODO - remove hard-coded URL
        String remoteProxy = MessageFormat.format("https://dqaas{0}.hanatrial.ondemand.com/dq", System.getenv("HC_ACCOUNT"));
        retVal  = JAXRSClientFactory.create(remoteProxy, DataQualityService.class, providers);
    }

    return retVal;
}
项目:gopay-java-api    文件:ResteasyGPConnector.java   
@Override
protected <T> T createRESTClientProxy(String apiUrl, Class<T> proxy) {
    URI i = null;
    try {
        i = new URI(apiUrl);
    } catch (URISyntaxException ex) {
        throw new RuntimeException(ex);
    }
    ResteasyClientBuilder builder = new ResteasyClientBuilder();
    builder.connectionCheckoutTimeout(CONNECTION_SETUP_TO, TimeUnit.SECONDS);
    builder.socketTimeout(CONNECTION_SETUP_TO, TimeUnit.SECONDS);
    builder.httpEngine(new URLConnectionEngine());

    ResteasyProviderFactory.getInstance().register(builder);

    ResteasyClient client = builder.build();
    client.register(new ClientRequestFilter() {
        @Override
        public void filter(ClientRequestContext requestContext) throws IOException {
            requestContext.getHeaders().add("User-Agent", getImplementationName() + "=" + getVersion());
        }
    });
    ObjectMapper mapper = new ObjectMapper();
    JacksonJaxbJsonProvider jaxbProvider
            = new JacksonJaxbJsonProvider(mapper, JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS);
    mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector());

    mapper.configure(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    builder.register(jaxbProvider);
    builder.register(proxy);

    ResteasyWebTarget resteasyWebTarget = client.target(i);
    return resteasyWebTarget.proxy(proxy);
}
项目:xockets.io    文件:WebSocketService.java   
@Override
public HashSet<Object> getSingletons(){
    ObjectMapper mapper = new ObjectMapper();
    JacksonJaxbJsonProvider jaxbProvider = new JacksonJaxbJsonProvider();
    jaxbProvider.setMapper(mapper);
    singletons.add(jaxbProvider);

    if(Activator.bundle==null){
        throw new IllegalArgumentException("WebSocketService.BUNDLE is null!");
    }

    IGuicer guicer = Guicer.getInstance(Activator.bundle);

    //create the rest object make sure dependencies are injected via guice.
    IRestWebSocket restWebSocket = guicer.createObject(IRestWebSocket.class);


    if(restWebSocket==null){
        throw new IllegalArgumentException("restWebSocket is null!!!");
    }

    //add it
    singletons.add(restWebSocket);

    return singletons;

}
项目:rtc2jira    文件:JiraRestAccess.java   
public JiraRestAccess(String url, String user, String password) {
  this.restHome = url + JIRA_REST_API_SUFFIX;
  String userAndPassword = user + ':' + password;
  this.authentification = new String(Base64.getEncoder().encode(userAndPassword.getBytes()));

  JacksonJsonProvider jacksonJsonProvider =
      new JacksonJaxbJsonProvider().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  objectMapper = jacksonJsonProvider.locateMapper(Object.class, MediaType.APPLICATION_JSON_TYPE);

  ClientConfig cfg = new DefaultClientConfig();
  cfg.getSingletons().add(jacksonJsonProvider);
  this.client = Client.create(cfg);
  // this.client.addFilter(new LoggingFilter(System.out));
}
项目:HIndex    文件:TestModelBase.java   
protected TestModelBase(Class<?> clazz) throws Exception {
  super();
  this.clazz = clazz;
  context = new JAXBContextResolver().getContext(clazz);
  mapper = new JacksonJaxbJsonProvider().locateMapper(clazz,
      MediaType.APPLICATION_JSON_TYPE);
}
项目:incubator-myriad    文件:MyriadServletModule.java   
@Override
protected void configureServlets() {
  bind(ClustersResource.class);
  bind(ConfigurationResource.class);
  bind(SchedulerStateResource.class);
  bind(ControllerResource.class);
  bind(ArtifactsResource.class);
  bind(GuiceContainer.class);
  bind(JacksonJaxbJsonProvider.class).in(Scopes.SINGLETON);

  serve("/api/*").with(GuiceContainer.class);
}
项目:olat    文件:OlatRestApplication.java   
@Override
public Set<Class<?>> getClasses() {
    final Set<Class<?>> classes = new HashSet<Class<?>>();
    classes.add(JacksonJaxbJsonProvider.class);
    classes.addAll(getRestRegistrationService().getClasses());
    return classes;
}
项目:olat    文件:OlatRestApplication.java   
@Override
public Set<Class<?>> getClasses() {
    final Set<Class<?>> classes = new HashSet<Class<?>>();
    classes.add(JacksonJaxbJsonProvider.class);
    classes.addAll(getRestRegistrationService().getClasses());
    return classes;
}
项目:hippo-addon-restful-webservices    文件:WebservicesIntegrationTest.java   
@Before
public void setUp() throws Exception {
    HippoRepositoryFactory.setDefaultRepository(background);
    super.setUp();
    startServer();
    client = WebClient.create(HTTP_ENDPOINT_ADDRESS, Collections.singletonList(new JacksonJaxbJsonProvider()), "admin", "admin", null);
}
项目:hippo-addon-restful-webservices    文件:WebservicesIntegrationTest.java   
private static void startServer() throws Exception {
    Object jacksonJaxbJsonProvider = new JacksonJaxbJsonProvider();
    Object crossOriginResourceSharingFilter = new CrossOriginResourceSharingFilter();
    Object customWebApplicationExceptionMapper = new CustomWebApplicationExceptionMapper();
    Object hippoAuthenticationRequestHandler = new HippoAuthenticationRequestHandler();
    Object apiDeclarationProvider = new ApiDeclarationProvider();
    Object resourceListingProvider = new ResourceListingProvider();
    Object customJacksonConfig = new CustomJacksonConfig();

    List<Object> providers = new ArrayList<Object>();
    providers.add(customJacksonConfig);
    providers.add(jacksonJaxbJsonProvider);
    providers.add(crossOriginResourceSharingFilter);
    providers.add(customWebApplicationExceptionMapper);
    providers.add(hippoAuthenticationRequestHandler);
    providers.add(apiDeclarationProvider);
    providers.add(resourceListingProvider);

    List<Class<?>> serviceClasses = new ArrayList<Class<?>>();
    serviceClasses.add(ApiListingResourceJSON.class);
    serviceClasses.add(RootResource.class);
    serviceClasses.add(SystemResource.class);
    serviceClasses.add(NodesResource.class);
    serviceClasses.add(PropertiesResource.class);
    serviceClasses.add(QueryResource.class);
    serviceClasses.add(StatsResource.class);
    serviceClasses.add(UsersResource.class);
    serviceClasses.add(GroupsResource.class);

    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();

    sf.setProviders(providers);
    sf.setResourceClasses(serviceClasses);
    sf.setAddress(HTTP_ENDPOINT_ADDRESS);
    cxfServer = sf.create();
}
项目:PyroDB    文件:TestModelBase.java   
protected TestModelBase(Class<?> clazz) throws Exception {
  super();
  this.clazz = clazz;
  context = new JAXBContextResolver().getContext(clazz);
  mapper = new JacksonJaxbJsonProvider().locateMapper(clazz,
      MediaType.APPLICATION_JSON_TYPE);
}
项目:c5    文件:TestModelBase.java   
protected TestModelBase(Class<?> clazz) throws Exception {
  super();
  this.clazz = clazz;
  context = new JAXBContextResolver().getContext(clazz);
  mapper = new JacksonJaxbJsonProvider().locateMapper(clazz,
      MediaType.APPLICATION_JSON_TYPE);
}
项目:java-openstack-sdk-cli-example    文件:JerseyConnector.java   
public JerseyConnector(Logger logger) {
    if (logger != null)
        this.logger = new JerseyLoggingFilter(logger);
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getClasses().add(JacksonJaxbJsonProvider.class);
    clientConfig.getClasses().add(OpenStackObjectMapper.class);
    client = Client.create(clientConfig);
}
项目:ldap2rest    文件:RESTApplication.java   
@Inject
public RESTApplication(ServiceLocator serviceLocator) {
    log.info("Initialisation de l'application");
    classes.add(LdapResource.class);
    classes.add(NameNotFoundMapper.class);

    classes.add(MultiPartFeature.class);

    JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
    singletons.add(provider);

    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(SPRING_CONFIG);
    Rest2LdapConfig config = ctx.getBean("rest2ldapConfig", Rest2LdapConfig.class);
    ILdapDAO ldapDAO = ctx.getBean(ILdapDAO.class);

       DynamicConfiguration dc = Injections.getConfiguration(serviceLocator);
       Injections.addBinding(
               Injections.newBinder(ctx).to(ApplicationContext.class), dc);
       Injections.addBinding(
               Injections.newBinder(config).to(Rest2LdapConfig.class), dc);
       Injections.addBinding(
            Injections.newBinder(ldapDAO).to(ILdapDAO.class), dc);

       dc.commit();

    testLdapConnection(ctx);        
}
项目:webshell-xpages-ext-lib    文件:WebshellService.java   
public HashSet<Object> getSingletons(){
    ObjectMapper mapper = new ObjectMapper();
    JacksonJaxbJsonProvider jaxbProvider = new JacksonJaxbJsonProvider();
    jaxbProvider.setMapper(mapper);
    singletons.add(jaxbProvider);

    if(WebshellServiceActivator.BUNDLE==null){
        throw new IllegalArgumentException("WebshellServiceActivator.BUNDLE is null!");
    }

    IGuicer guicer = Guicer.getInstance(WebshellServiceActivator.BUNDLE);

    //create the rest object make sure dependencies are injected via guice.
    IRestWebshell restWebshell = (IRestWebshell) guicer.createObject(IRestWebshell.class);

    RestSimple restSimple = (RestSimple) guicer.createObject(RestSimple.class);

    if(restWebshell==null){
        throw new IllegalArgumentException("restWebshell is null!!!");
    }

    //add it
    singletons.add(restWebshell);
    singletons.add(restSimple);

    return singletons;

}
项目:webshell-xpages-ext-lib    文件:APNService.java   
public HashSet<Object> getSingletons(){
    ObjectMapper mapper = new ObjectMapper();
    JacksonJaxbJsonProvider jaxbProvider = new JacksonJaxbJsonProvider();
    jaxbProvider.setMapper(mapper);
    singletons.add(jaxbProvider);

    if(APNActivator.BUNDLE==null){
        throw new IllegalArgumentException("APNActivator.BUNDLE is null!");
    }

    IGuicer guicer = Guicer.getInstance(APNActivator.BUNDLE);

    //create the rest object make sure dependencies are injected via guice.
    IRestApn restPush = (IRestApn) guicer.createObject(IRestApn.class);

    RestSimple restSimple = (RestSimple)guicer.createObject(RestSimple.class);

    if(restPush==null){
        throw new IllegalArgumentException("restPush is null!!!");
    }

    //add it
    singletons.add(restPush);
    singletons.add(restSimple);

    return singletons;

}
项目:paymentgateway    文件:JaxRsClientConfig.java   
@Bean
public JacksonJaxbJsonProvider jacksonJaxbJsonProvider() {
    return new JacksonJaxbJsonProvider();
}
项目:paymentgateway    文件:JaxRsClientConfig.java   
@Bean
public JacksonJaxbJsonProvider jacksonJaxbJsonProvider() {
    return new JacksonJaxbJsonProvider();
}
项目:openstack-maven-CIET-students    文件:JerseyConnector.java   
public JerseyConnector() {
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getClasses().add(JacksonJaxbJsonProvider.class);
    clientConfig.getClasses().add(OpenStackObjectMapper.class);
    client = Client.create(clientConfig);
}
项目:socialeyeser    文件:InfluenceResourcesModule.java   
private void bindJackson() {

    bind(JacksonJaxbJsonProvider.class).asEagerSingleton();
    bind(MessageBodyReader.class).to(JacksonJsonProvider.class);
    bind(MessageBodyWriter.class).to(JacksonJsonProvider.class);
}
项目:socialeyeser    文件:TestJerseyServletModule.java   
private void bindJackson() {

    bind(JacksonJaxbJsonProvider.class).asEagerSingleton();
    bind(MessageBodyReader.class).to(JacksonJsonProvider.class);
    bind(MessageBodyWriter.class).to(JacksonJsonProvider.class);
}
项目:moskito-central    文件:RESTConnector.java   
protected ClientConfig getClientConfig() {
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getClasses().add(JacksonJaxbJsonProvider.class);
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    return clientConfig;
}
项目:configureme    文件:RestConfigurationRepositorySourceLoader.java   
private ClientConfig getClientConfig() {
    final ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getClasses().add(JacksonJaxbJsonProvider.class);
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    return clientConfig;
}