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


Java WebClient.delete方法代码示例

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


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

示例1: getOAuthDeleteResponse

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
public static void getOAuthDeleteResponse(AppDefinition app, AppUser user,String requestURI, String baseRequestURI) {
	StringBuilder sb = new StringBuilder();
	InputStream in = null;
	BufferedReader bufferedReader = null;
	try {
		AppOAuth1Config appAuthConfig = AppOAuth1Config.fromDocument(app.getConfig());
		Map<String,String> keySecret = AppOAuth1Config.getKeySecret(user.getAuthenticationData());
		
		OAuthClientUtils.Consumer consumer = new OAuthClientUtils.Consumer(appAuthConfig.getConsumerKey(),appAuthConfig.getConsumerSecret());
		OAuthClientUtils.Token accessToken = new OAuthClientUtils.Token(keySecret.get("key"),keySecret.get("secret"));
		
		requestURI = appAuthConfig.getBaseURL() + requestURI;
		WebClient webclient = WebClient.create(requestURI);
		
		webclient = webclient.replaceHeader("Authorization",OAuthClientUtils.createAuthorizationHeader(consumer, accessToken, "DELETE", appAuthConfig.getBaseURL() + baseRequestURI));
		webclient.delete();
	} catch(Exception e) {
		logger.error("Error getting information from OAuth Service", e);
	} finally {
		IOUtils.closeQuietly(in);
		IOUtils.closeQuietly(bufferedReader);
	}
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:24,代码来源:OAuth1Utils.java

示例2: cleanupEnvironment

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
public void cleanupEnvironment( final EnvironmentId environmentId ) throws PeerException
{
    WebClient client = null;
    Response response;
    try
    {
        remotePeer.checkRelation();
        String path = String.format( "/cleanup/%s", environmentId.getId() );

        client = WebClientBuilder.buildPeerWebClient( peerInfo, path, provider );

        client.type( MediaType.APPLICATION_JSON );
        client.accept( MediaType.APPLICATION_JSON );
        response = client.delete();
    }
    catch ( Exception e )
    {
        LOG.error( e.getMessage(), e );
        throw new PeerException( String.format( "Error cleaning up environment: %s", e.getMessage() ) );
    }
    finally
    {
        WebClientBuilder.close( client );
    }

    WebClientBuilder.checkResponse( response );
}
 
开发者ID:subutai-io,项目名称:base,代码行数:28,代码来源:PeerWebClient.java


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