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


Java WebClient.header方法代码示例

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


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

示例1: testEntitledAttributesJSON

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void testEntitledAttributesJSON() {
    if (!waitForWADL()) {
        return;
    }

    WebClient client = WebClient.create(ENDPOINT_ADDRESS);

    client.header("Authorization", "Basic YWRtaW46YWRtaW4=");
    client.type("application/json");
    client.accept("application/json");

    client.path("entitled-attribs");

    String request = readReource("json/request-entitled-attribs-1.json");
    String response = readReource("json/response-entitled-attribs-1.json");

    String webRespose = client.post(request, String.class);
    assertEquals(response, webRespose);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:21,代码来源:TestService.java

示例2: testHomeXML

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void testHomeXML() {
    if (!waitForWADL()) {
        return;
    }

    WebClient client = WebClient.create(ENDPOINT_ADDRESS);

    client.header("Authorization", "Basic YWRtaW46YWRtaW4=");
    client.type("application/xml");
    client.accept("application/xml");

    client.path("home");

    String response = readReource("xml/response-home.xml");

    String webRespose = client.get(String.class);
    assertEquals(response, webRespose);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:20,代码来源:TestService.java

示例3: testHomeJSON

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void testHomeJSON() {
    if (!waitForWADL()) {
        return;
    }

    WebClient client = WebClient.create(ENDPOINT_ADDRESS);

    client.header("Authorization", "Basic YWRtaW46YWRtaW4=");
    client.type("application/json");
    client.accept("application/json");

    client.path("home");

    String response = readReource("json/response-home.json");

    String webRespose = client.get(String.class);
    assertEquals(response, webRespose);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:20,代码来源:TestService.java

示例4: testPdpXML

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void testPdpXML() {
    if (!waitForWADL()) {
        return;
    }

    WebClient client = WebClient.create(ENDPOINT_ADDRESS);

    client.header("Authorization", "Basic YWRtaW46YWRtaW4=");
    client.type("application/xml");
    client.accept("application/xml");

    client.path("pdp");

    String request = readReource("xml/request-pdp-1.xml");
    String response = readReource("xml/response-pdp-1.xml");

    String webRespose = client.post(request, String.class);
    assertEquals(response, webRespose);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:21,代码来源:TestService.java

示例5: testPdpJSON

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void testPdpJSON() {
    if (!waitForWADL()) {
        return;
    }

    WebClient client = WebClient.create(ENDPOINT_ADDRESS);

    client.header("Authorization", "Basic YWRtaW46YWRtaW4=");
    client.type("application/json");
    client.accept("application/json");

    client.path("pdp");

    String request = readReource("json/request-pdp-1.json");
    String response = readReource("json/response-pdp-1.json");

    String webRespose = client.post(request, String.class);
    assertEquals(response, webRespose);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:21,代码来源:TestService.java

示例6: testGetDecisionByAttributesXML

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void testGetDecisionByAttributesXML() {
    if (!waitForWADL()) {
        return;
    }

    WebClient client = WebClient.create(ENDPOINT_ADDRESS);

    client.header("Authorization", "Basic YWRtaW46YWRtaW4=");
    client.type("application/xml");
    client.accept("application/xml");

    client.path("by-attrib");

    String request = readReource("xml/request-by-attrib-1.xml");
    String response = readReource("xml/response-by-attrib-1.xml");

    String webRespose = client.post(request, String.class);

    assertEquals(response, webRespose);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:22,代码来源:TestService.java

示例7: testGetDecisionByAttributesJSON

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void testGetDecisionByAttributesJSON() {
    if (!waitForWADL()) {
        return;
    }

    WebClient client = WebClient.create(ENDPOINT_ADDRESS);

    client.header("Authorization", "Basic YWRtaW46YWRtaW4=");
    client.type("application/json");
    client.accept("application/xml");

    client.path("by-attrib");

    String request = readReource("json/request-by-attrib-1.json");
    String response = readReource("json/response-by-attrib-1.xml");

    String webRespose = client.post(request, String.class);

    assertEquals(response, webRespose);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:22,代码来源:TestService.java

示例8: testGetDecisionByAttributesBooleanXML

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void testGetDecisionByAttributesBooleanXML() {
    if (!waitForWADL()) {
        return;
    }

    WebClient client = WebClient.create(ENDPOINT_ADDRESS);

    client.header("Authorization", "Basic YWRtaW46YWRtaW4=");
    client.type("application/xml");
    client.accept("application/xml");

    client.path("by-attrib-boolean");

    String request = readReource("xml/request-by-attrib-bool-1.xml");
    String response = readReource("xml/response-by-attrib-bool-1.xml");

    String webRespose = client.post(request, String.class);

    assertEquals(response, webRespose);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:22,代码来源:TestService.java

示例9: testGetDecisionByAttributesBooleanJSON

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void testGetDecisionByAttributesBooleanJSON() {
    if (!waitForWADL()) {
        return;
    }

    WebClient client = WebClient.create(ENDPOINT_ADDRESS);

    client.header("Authorization", "Basic YWRtaW46YWRtaW4=");
    client.type("application/json");
    client.accept("application/json");

    client.path("by-attrib-boolean");

    String request = readReource("json/request-by-attrib-bool-1.json");
    String response = readReource("json/response-by-attrib-bool-1.json");

    String webRespose = client.post(request, String.class);
    assertEquals(response, webRespose);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:21,代码来源:TestService.java

示例10: testEntitledAttributesXML

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void testEntitledAttributesXML() {
    if (!waitForWADL()) {
        return;
    }

    WebClient client = WebClient.create(ENDPOINT_ADDRESS);

    client.header("Authorization", "Basic YWRtaW46YWRtaW4=");
    client.type("application/xml");
    client.accept("application/xml");

    client.path("entitled-attribs");

    String request = readReource("xml/request-entitled-attribs-1.xml");
    String response = readReource("xml/response-entitled-attribs-1.xml");

    String webRespose = client.post(request, String.class);
    assertEquals(response, webRespose);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:21,代码来源:TestService.java

示例11: testAllEntitlementsXML

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void testAllEntitlementsXML() {
    if (!waitForWADL()) {
        return;
    }

    WebClient client = WebClient.create(ENDPOINT_ADDRESS);

    client.header("Authorization", "Basic YWRtaW46YWRtaW4=");
    client.type("application/xml");
    client.accept("application/xml");

    client.path("entitlements-all");

    String request = readReource("xml/request-all-entitlements-1.xml");
    String response = readReource("xml/response-all-entitlements-1.xml");

    String webRespose = client.post(request, String.class);
    assertEquals(response, webRespose);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:21,代码来源:TestService.java

示例12: testAllEntitlementsJSON

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void testAllEntitlementsJSON() {
    if (!waitForWADL()) {
        return;
    }

    WebClient client = WebClient.create(ENDPOINT_ADDRESS);

    client.header("Authorization", "Basic YWRtaW46YWRtaW4=");
    client.type("application/json");
    client.accept("application/json");

    client.path("entitlements-all");

    String request = readReource("json/request-all-entitlements-1.json");
    String response = readReource("json/response-all-entitlements-1.json");

    String webRespose = client.post(request, String.class);
    assertEquals(response, webRespose);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:21,代码来源:TestService.java

示例13: createAuthorizationHeader

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Override
protected void createAuthorizationHeader(WebClient client, String username, String password) {
	
	if (username == null) {
		return;
	}
	
	String authzHeader = "{"
			+ "\"user\" : \""+ username +"\","
			+ "\"answer\" : ["
				+ "{ "
					+ "\"qid\" : \"http://midpoint.evolveum.com/xml/ns/public/security/question-2#q001\"," 
					+ "\"qans\" : \"" + (password == null ? "" : password) + "\""
				+ "}"
			+ "]"
			+ "}";
	
		String authorizationHeader = "SecQ "
				+ org.apache.cxf.common.util.Base64Utility.encode((authzHeader).getBytes());
		client.header("Authorization", authorizationHeader);
	
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:23,代码来源:TestRestServiceJsonSecQ.java

示例14: MatterMostBotClient

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
public MatterMostBotClient(final String host, final String personalToken, final Optional<WsSocketListener> listener)
{
	final WebClient client = WebClient.create("http://" + host + apiV4);
	final String bearer = "Bearer " + personalToken;
	client.header("Authorization", bearer);
	_client = client;
	_asyncClient = new WebSocketClient("ws://" + host + apiV4 + "/websocket", bearer, listener);
}
 
开发者ID:Cloud-Temple,项目名称:Mattermost-client,代码行数:9,代码来源:MatterMostBotClient.java

示例15: prepareClient

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
private WebClient prepareClient(String proxyUserOid) {
	WebClient client = prepareClient("proxy", "proxyPassword");
	if (StringUtils.isNotBlank(proxyUserOid)){
		client.header("Switch-To-Principal", proxyUserOid);
	}
	return client;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:8,代码来源:TestRestServiceProxyAuthentication.java


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