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


Java JAXRSClientFactory.create方法代码示例

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


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

示例1: runtimeInfoService

import org.apache.cxf.jaxrs.client.JAXRSClientFactory; //导入方法依赖的package包/类
@Test
public void runtimeInfoService()
    throws Exception
{
    RuntimeInfoService service =
        JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaUiServices/",
                                   RuntimeInfoService.class,
                                   Collections.singletonList( new JacksonJaxbJsonProvider() ) );

    ApplicationRuntimeInfo applicationRuntimeInfo = service.getApplicationRuntimeInfo( "en" );

    assertEquals( System.getProperty( "expectedVersion" ), applicationRuntimeInfo.getVersion() );
    assertFalse( applicationRuntimeInfo.isJavascriptLog() );
    assertTrue( applicationRuntimeInfo.isLogMissingI18n() );

}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:17,代码来源:RuntimeInfoServiceTest.java

示例2: createJmsClient

import org.apache.cxf.jaxrs.client.JAXRSClientFactory; //导入方法依赖的package包/类
/**
 * Creates two clients for {@link ITestService} and {@link ITestService2} and invokes them.<br>
 * The first client has some non-default settings, the second client is default.
 * <p>
 * See http://cxf.apache.org/docs/jax-rs-advanced-features.html#JAX-RSAdvancedFeatures-Client
 */
private ITestService createJmsClient(boolean withOneWayRequestHeader)
{
	final JacksonJaxbJsonProvider jacksonJaxbJsonProvider = new JacksonJaxbJsonProvider();

	//
	// setting up the client
	final ITestService client = JAXRSClientFactory.create(
			CLIENT_ADDRESS_URL_ENCODED,
			ITestService.class,
			Collections.singletonList(jacksonJaxbJsonProvider));
	assertThat(client, notNullValue());

	// we don't expect a response. Instead we expect the return code 202.
	// this doesn't work yet. If we set this header, the service won't respond, but this stupid client will still wait and eventually timeout
	if (withOneWayRequestHeader)
	{
		WebClient.client(client).header("OnewayRequest", "true");
	}

	return client;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:28,代码来源:JaxRsOneWayTests.java

示例3: start

import org.apache.cxf.jaxrs.client.JAXRSClientFactory; //导入方法依赖的package包/类
public T start(Class<T> cls, String url, boolean trustAllCerts, String trustStore, String trustStorePassword, 
	List<?> providers, int connectTimeout, int receiveTimeout) {

	try {
		
		T resource = JAXRSClientFactory.create(url, cls, providers);
	    HTTPConduit conduit = WebClient.getConfig(resource).getHttpConduit();
	    WebClient.getConfig(resource).getInInterceptors().add(new LoggingInInterceptor());
	    WebClient.getConfig(resource).getOutInterceptors().add(new LoggingOutInterceptor());
		configureHTTPS(resource, conduit, trustAllCerts, trustStore, trustStorePassword);
		
	    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); 
	    httpClientPolicy.setConnectionTimeout(connectTimeout); 
	    httpClientPolicy.setReceiveTimeout(receiveTimeout); 
	    conduit.setClient(httpClientPolicy);
		
		return resource;
		
	} catch (Exception e) {
		LOG.error(" rest client '{}': NOT STARTED", url);
		return null;
	}
	
}
 
开发者ID:csob,项目名称:paymentgateway,代码行数:25,代码来源:JaxRsClientStarter.java

示例4: getService

import org.apache.cxf.jaxrs.client.JAXRSClientFactory; //导入方法依赖的package包/类
protected <T>T getService(Class<T> clazz, String endpoint) {
        if(services.containsKey(clazz))
            return (T)services.get(clazz);

        if(restUrl == null)
            new IllegalStateException("GeoFence URL not set");

        synchronized(services) {
//            T proxy = JAXRSClientFactory.create(restUrl, clazz, username, password, null);
            
            T proxy = JAXRSClientFactory.create(restUrl+"/"+endpoint, clazz);
            String authorizationHeader = "Basic "  + Base64Utility.encode((username+":"+password).getBytes());
            WebClient.client(proxy).header("Authorization", authorizationHeader);

//        WebClient.client(proxy).accept("text/xml");
            services.put(clazz, proxy);
            return proxy;
        }
    }
 
开发者ID:geoserver,项目名称:geofence,代码行数:20,代码来源:GeoFenceClient.java

示例5: runtimeInfoService

import org.apache.cxf.jaxrs.client.JAXRSClientFactory; //导入方法依赖的package包/类
@Test
public void runtimeInfoService()
    throws Exception
{
    RuntimeInfoService service =
        JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaUiServices/",
                                   RuntimeInfoService.class,
                                   Collections.singletonList( new JacksonJaxbJsonProvider() ) );

    WebClient.client(service).header("Referer","http://localhost");
    ApplicationRuntimeInfo applicationRuntimeInfo = service.getApplicationRuntimeInfo( "en" );

    assertEquals( System.getProperty( "expectedVersion" ), applicationRuntimeInfo.getVersion() );
    assertFalse( applicationRuntimeInfo.isJavascriptLog() );
    assertTrue( applicationRuntimeInfo.isLogMissingI18n() );

}
 
开发者ID:apache,项目名称:archiva,代码行数:18,代码来源:RuntimeInfoServiceTest.java

示例6: getRoleManagementService

import org.apache.cxf.jaxrs.client.JAXRSClientFactory; //导入方法依赖的package包/类
protected RoleManagementService getRoleManagementService( String authzHeader )
{
    RoleManagementService service =
        JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/redbackServices/",
                                   RoleManagementService.class,
                                   Collections.singletonList( new JacksonJaxbJsonProvider() ) );

    WebClient.client( service ).header( "Referer", "http://localhost:" + port );

    // for debuging purpose
    WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 3000000L );

    if ( authzHeader != null )
    {
        WebClient.client( service ).header( "Authorization", authzHeader );
    }
    return service;
}
 
开发者ID:apache,项目名称:archiva,代码行数:19,代码来源:AbstractDownloadTest.java

示例7: getUserService

import org.apache.cxf.jaxrs.client.JAXRSClientFactory; //导入方法依赖的package包/类
protected UserService getUserService( String authzHeader )
{
    UserService service =
        JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/redbackServices/",
                                   UserService.class, Collections.singletonList( new JacksonJaxbJsonProvider() ) );

    WebClient.client( service ).header( "Referer", "http://localhost:" + port );

    // for debuging purpose
    WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 3000000L );

    if ( authzHeader != null )
    {
        WebClient.client( service ).header( "Authorization", authzHeader );
    }
    return service;
}
 
开发者ID:apache,项目名称:archiva,代码行数:18,代码来源:AbstractDownloadTest.java

示例8: getSearchService

import org.apache.cxf.jaxrs.client.JAXRSClientFactory; //导入方法依赖的package包/类
protected SearchService getSearchService( String authzHeader )
{
    // START SNIPPET: cxf-searchservice-creation        
    SearchService service =
        JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
                                   SearchService.class,
                                   Collections.singletonList( new JacksonJaxbJsonProvider() ) );
    // to add authentification
    if ( authzHeader != null )
    {
        WebClient.client( service ).header( "Authorization", authzHeader );
    }
    // Set the Referer header to your archiva server url
    WebClient.client(service).header("Referer","http://localhost:"+port);
    // to configure read timeout
    WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000 );
    // if you want to use json as exchange format xml is supported too
    WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE );
    WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE );
    return service;
    // END SNIPPET: cxf-searchservice-creation

}
 
开发者ID:apache,项目名称:archiva,代码行数:24,代码来源:AbstractArchivaRestTest.java

示例9: getArchivaAdministrationService

import org.apache.cxf.jaxrs.client.JAXRSClientFactory; //导入方法依赖的package包/类
protected ArchivaAdministrationService getArchivaAdministrationService()
{
    ArchivaAdministrationService service =
        JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
                                   ArchivaAdministrationService.class,
                                   Collections.singletonList( new JacksonJaxbJsonProvider() ) );

    WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE );
    WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE );

    WebClient.client( service ).header( "Authorization", authorizationHeader );
    WebClient.client(service).header("Referer","http://localhost:"+port);

    WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 );
    return service;
}
 
开发者ID:apache,项目名称:archiva,代码行数:17,代码来源:AbstractArchivaRestTest.java

示例10: init

import org.apache.cxf.jaxrs.client.JAXRSClientFactory; //导入方法依赖的package包/类
@Before
public void init() {
	restClient = JAXRSClientFactory.create(getBaseCxf() + CXFConfig.REST_SIGNATURE_ONE_DOCUMENT, RestDocumentSignatureService.class,
			Arrays.asList(new JacksonJsonProvider()));

	restMultiDocsClient = JAXRSClientFactory.create(getBaseCxf() + CXFConfig.REST_SIGNATURE_MULTIPLE_DOCUMENTS, RestMultipleDocumentSignatureService.class,
			Arrays.asList(new JacksonJsonProvider()));
}
 
开发者ID:esig,项目名称:dss-demonstrations,代码行数:9,代码来源:SignatureRestServiceIT.java

示例11: setup

import org.apache.cxf.jaxrs.client.JAXRSClientFactory; //导入方法依赖的package包/类
@Before
public void setup() {
    JacksonJsonProvider provider = new JacksonJsonProvider();
    List providers = new ArrayList();
    providers.add(provider);
    
    api = JAXRSClientFactory.create("http://localhost", RemoteAccessApi.class, providers);
    org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
    
    ClientConfiguration config = WebClient.getConfig(client); 
}
 
开发者ID:cliffano,项目名称:swaggy-jenkins,代码行数:12,代码来源:RemoteAccessApiTest.java

示例12: setup

import org.apache.cxf.jaxrs.client.JAXRSClientFactory; //导入方法依赖的package包/类
@Before
public void setup() {
    JacksonJsonProvider provider = new JacksonJsonProvider();
    List providers = new ArrayList();
    providers.add(provider);
    
    api = JAXRSClientFactory.create("http://localhost", BlueOceanApi.class, providers);
    org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
    
    ClientConfiguration config = WebClient.getConfig(client); 
}
 
开发者ID:cliffano,项目名称:swaggy-jenkins,代码行数:12,代码来源:BlueOceanApiTest.java

示例13: getProxyConnectorService

import org.apache.cxf.jaxrs.client.JAXRSClientFactory; //导入方法依赖的package包/类
protected ProxyConnectorService getProxyConnectorService()
{
    ProxyConnectorService service =
        JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
                                   ProxyConnectorService.class,
                                   Collections.singletonList( new JacksonJaxbJsonProvider() ) );

    WebClient.client( service ).header( "Authorization", authorizationHeader );
    WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
    return service;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:12,代码来源:AbstractDownloadTest.java

示例14: getService

import org.apache.cxf.jaxrs.client.JAXRSClientFactory; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:SAP,项目名称:SAP-cloud-dqm-sample-java,代码行数:32,代码来源:DataQualityServiceFactory.java

示例15: getManagedRepositoriesService

import org.apache.cxf.jaxrs.client.JAXRSClientFactory; //导入方法依赖的package包/类
protected ManagedRepositoriesService getManagedRepositoriesService()
{
    ManagedRepositoriesService service =
        JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
                                   ManagedRepositoriesService.class,
                                   Collections.singletonList( new JacksonJaxbJsonProvider() ) );

    WebClient.client( service ).header( "Authorization", authorizationHeader );
    WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
    return service;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:12,代码来源:AbstractDownloadTest.java


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