本文整理汇总了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() );
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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() );
}
示例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;
}
示例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;
}
示例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
}
示例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;
}
示例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()));
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}