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