• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ClientResponseFailure类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jboss.resteasy.client.ClientResponseFailure的典型用法代码示例。如果您正苦于以下问题:Java ClientResponseFailure类的具体用法?Java ClientResponseFailure怎么用?Java ClientResponseFailure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ClientResponseFailure类属于org.jboss.resteasy.client包,在下文中一共展示了ClientResponseFailure类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: listAllCompanies

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
public List<Company> listAllCompanies() throws DeskComException {
	Set<Company> companies = new LinkedHashSet<Company>();
	try {
		Integer page = 1;
		SearchResponse<Company> results;
		do {
			results = companyApi.list(authProvider.genAuthorizationHeader(), page++);
			for(Company company: results.get_embedded().getEntries()) {
				companies.add(company);
			}
		} while (results.hasNextPage());
		return new LinkedList<Company>(companies);
	}catch(ClientResponseFailure t){
		throw new DeskComException(t);
	}
}
 
开发者ID:quintoandar,项目名称:desk.com,代码行数:17,代码来源:DeskApiWrapper.java


示例2: listAllCompanyCases

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
public List<Case> listAllCompanyCases(BigInteger companyId) throws DeskComException {
	Set<Case> cases = new LinkedHashSet<Case>();
	try {
		Integer page = 1;
		SearchResponse<Case> results;
		do {
			results = companyApi.listCases(authProvider.genAuthorizationHeader(), companyId, page++);
			for(Case _case : results.get_embedded().getEntries()) {
				cases.add(_case);
			}
		} while (results.hasNextPage());
		return new LinkedList<Case>(cases);
	}catch(ClientResponseFailure t){
		throw new DeskComException(t);
	}
}
 
开发者ID:quintoandar,项目名称:desk.com,代码行数:17,代码来源:DeskApiWrapper.java


示例3: testRegisterPermissionForInvalidResource

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
/**
 * Test for registering permissions for resource
 */
@Test
public void testRegisterPermissionForInvalidResource() throws Exception {
    showTitle("testRegisterPermissionForInvalidResource");

    UmaPermission permission = new UmaPermission();
    permission.setResourceId(this.registerResourceTest.resourceId + "1");
    permission.setScopes(Arrays.asList("http://photoz.example.com/dev/scopes/view", "http://photoz.example.com/dev/scopes/all"));

    PermissionTicket ticket = null;
    try {
        ticket = getPermissionService().registerPermission(
                "Bearer " + this.registerResourceTest.pat.getAccessToken(), UmaPermissionList.instance(permission));
    } catch (ClientResponseFailure ex) {
        System.err.println(ex.getResponse().getEntity(String.class));
        assertTrue(ex.getResponse().getStatus() != Response.Status.CREATED.getStatusCode() &&
                ex.getResponse().getStatus() != Response.Status.OK.getStatusCode()
                , "Unexpected response status");
    }

    assertNull(ticket, "Resource permission is not null");
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:25,代码来源:UmaRegisterPermissionFlowHttpTest.java


示例4: registerResource

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
public String registerResource(List<String> scopes) throws Exception {
    try {
        UmaResource resource = new UmaResource();
        resource.setName("Photo Album");
        resource.setIconUri("http://www.example.com/icons/flower.png");
        resource.setScopes(scopes);
        resource.setType("myType");

        UmaResourceResponse resourceStatus = getResourceService().addResource("Bearer " + pat.getAccessToken(), resource);
        UmaTestUtil.assert_(resourceStatus);

        this.resourceId = resourceStatus.getId();
        return this.resourceId;
    } catch (ClientResponseFailure ex) {
        System.err.println(ex.getResponse().getEntity(String.class));
        throw ex;
    }
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:19,代码来源:RegisterResourceFlowHttpTest.java


示例5: registerResourceWithScopeExpression

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
public String registerResourceWithScopeExpression(String scopeExpression) throws Exception {
    try {
        UmaResource resource = new UmaResource();
        resource.setName("Photo Album");
        resource.setIconUri("http://www.example.com/icons/flower.png");
        resource.setScopeExpression(scopeExpression);
        resource.setType("myType");

        UmaResourceResponse resourceStatus = getResourceService().addResource("Bearer " + pat.getAccessToken(), resource);
        UmaTestUtil.assert_(resourceStatus);

        this.resourceIdWithScopeExpression = resourceStatus.getId();
        return this.resourceIdWithScopeExpression;
    } catch (ClientResponseFailure ex) {
        System.err.println(ex.getResponse().getEntity(String.class));
        throw ex;
    }
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:19,代码来源:RegisterResourceFlowHttpTest.java


示例6: modifyNotExistingResource

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
/**
 * Test non existing UMA resource description modification
 */
@Test(dependsOnMethods = {"modifyResource"})
public void modifyNotExistingResource() throws Exception {
    showTitle("modifyNotExistingResource");

    try {
        UmaResource resource = new UmaResource();
        resource.setName("Photo Album 3");
        resource.setIconUri("http://www.example.com/icons/flower.png");
        resource.setScopes(Arrays.asList("http://photoz.example.com/dev/scopes/view", "http://photoz.example.com/dev/scopes/all"));

        getResourceService().updateResource("Bearer " + pat.getAccessToken(), "fake_resource_id", resource);
    } catch (ClientResponseFailure ex) {
        System.err.println(ex.getResponse().getEntity(String.class));
        int status = ex.getResponse().getStatus();
        assertTrue(status != Response.Status.OK.getStatusCode(), "Unexpected response status");
    }
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:21,代码来源:RegisterResourceFlowHttpTest.java


示例7: testModifyResourceWithInvalidPat

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
/**
 * Test UMA resource description modification with invalid PAT
 */
@Test(dependsOnMethods = {"modifyResource"})
public void testModifyResourceWithInvalidPat() throws Exception {
    showTitle("testModifyResourceWithInvalidPat");

    UmaResourceResponse resourceStatus = null;
    try {
        UmaResource resource = new UmaResource();
        resource.setName("Photo Album 4");
        resource.setIconUri("http://www.example.com/icons/flower.png");
        resource.setScopes(Arrays.asList("http://photoz.example.com/dev/scopes/view", "http://photoz.example.com/dev/scopes/all"));

        resourceStatus = getResourceService().updateResource("Bearer " + pat.getAccessToken() + "_invalid", this.resourceId + "_invalid", resource);
    } catch (ClientResponseFailure ex) {
        System.err.println(ex.getResponse().getEntity(String.class));
        assertEquals(ex.getResponse().getStatus(), Response.Status.UNAUTHORIZED.getStatusCode(), "Unexpected response status");
    }

    assertNull(resourceStatus, "Resource status is not null");
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:23,代码来源:RegisterResourceFlowHttpTest.java


示例8: getOneResource

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
/**
 * Get resource
 */
@Test(dependsOnMethods = {"modifyResource"})
public void getOneResource() throws Exception {
    showTitle("getOneResource");

    try {
        UmaResourceWithId resource = getResourceService().getResource("Bearer " + pat.getAccessToken(), this.resourceId);
        assertEquals(resource.getType(), "myType");

        UmaResourceWithId resourceWithExpression = getResourceService().getResource("Bearer " + pat.getAccessToken(), this.resourceIdWithScopeExpression);
        assertEquals(resourceWithExpression.getScopeExpression(), MODIFY_SCOPE_EXPRESSION);
    } catch (ClientResponseFailure ex) {
        System.err.println(ex.getResponse().getEntity(String.class));
        throw ex;
    }
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:19,代码来源:RegisterResourceFlowHttpTest.java


示例9: getResources

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
/**
 * Get resources
 */
@Test(dependsOnMethods = {"getOneResource"})
public void getResources() throws Exception {
    showTitle("getResources");

    List<String> resources = null;
    try {
        resources = getResourceService().getResourceList("Bearer " + pat.getAccessToken(), "");
    } catch (ClientResponseFailure ex) {
        System.err.println(ex.getResponse().getEntity(String.class));
        throw ex;
    }

    assertNotNull(resources, "Resources is null");
    assertTrue(resources.contains(this.resourceId), "Resource list doesn't contain added resource");
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:19,代码来源:RegisterResourceFlowHttpTest.java


示例10: testGetUmaMetaDataConfiguration

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
/**
 * Test for getting meta data configuration
 */
@Test
@Parameters({"umaMetaDataUrl"})
public void testGetUmaMetaDataConfiguration(final String umaMetaDataUrl) throws Exception {
    showTitle("testGetUmaMetaDataConfiguration");

    UmaMetadataService metaDataConfigurationService = UmaClientFactory.instance().createMetadataService(umaMetaDataUrl, clientExecutor(true));

    // Get meta data
    UmaMetadata c = null;
    try {
        c = metaDataConfigurationService.getMetadata();
    } catch (ClientResponseFailure ex) {
        System.err.println(ex.getResponse().getEntity(String.class));
        throw ex;
    }

    UmaTestUtil.assert_(c);
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:22,代码来源:MetaDataFlowHttpTest.java


示例11: configure

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
public void configure() {

        //@formatter:off
        from("switchyard://GreetingCamelProxy")
            .routeId(getClass().getName())
            .log("********************************************************************************")
            .log("body = ${body}")
            .log("********************************************************************************")
            .doTry()
                .to("switchyard://GreetingService")
            .doCatch(ClientResponseFailure.class)
                .process(new FailureStatusProcessor())
            .end();
        //@formatter:on

    }
 
开发者ID:tadayosi,项目名称:samples-switchyard,代码行数:17,代码来源:GreetingProxyRoute.java


示例12: invoke

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
private String invoke(String operation, Object content) {
    int statusCode = 500;
    ClientResponse<?> response = null;

    ReferenceInvocation invocation = null;
    try {
        invocation = greeting.newInvocation(operation);
        Message message = invocation.invoke(content).getMessage();
        response = message.getContent(ClientResponse.class);
        statusCode = response.getStatus();
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
        // TODO this won't work due to SWITCHYARD-1890
        if (e.getCause() instanceof ClientResponseFailure) {
            response = ((ClientResponseFailure) e.getCause()).getResponse();
            statusCode = response.getStatus();
        }
    }

    String replyContent = response != null ? response.getEntity(String.class) : "";
    sendReply(statusCode, replyContent);
    return replyContent;
}
 
开发者ID:tadayosi,项目名称:samples-switchyard,代码行数:24,代码来源:GreetingProxyBean.java


示例13: handleException

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
public static void handleException(String guid, Exception ex) throws ServiceException {
    if (ex instanceof ClientResponseFailure) {
        ClientResponseFailure e = (ClientResponseFailure) ex;
        ClientResponse response = e.getResponse();
        if (response.getResponseStatus().equals(Response.Status.FORBIDDEN)) {
            throw new ServiceException(guid, "Authentification failed", e);
        }
        throw new ServiceException(guid, "Error in the communication to the server " + response.getResponseStatus().getStatusCode(), e);
    } else {
        String msg = ex.getMessage();
        if (msg.startsWith(ClientProtocolException.class.getName())) {
            throw new ServiceException(guid, "The server is not valid address.", ex);
        }
        throw new ServiceException(guid, "Could not connect to the server", ex);
    }
}
 
开发者ID:lorislab,项目名称:smonitor,代码行数:17,代码来源:RSClientUtil.java


示例14: searchCustomer

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
public List<Customer> searchCustomer(Set<String> email, Set<String> externalId) throws DeskComException{
	try {
		SearchCustomerResponse<Customer> customer = customerApi.search(authProvider.genAuthorizationHeader(), null, null, email, externalId);
		return customer.get_embedded().getEntries();
	}catch(ClientResponseFailure t){
		throw new DeskComException(t);
	}
}
 
开发者ID:quintoandar,项目名称:desk.com,代码行数:9,代码来源:DeskApiWrapper.java


示例15: showCustomer

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
public Customer showCustomer(BigInteger id) throws DeskComException{
	try{
		return customerApi.show(authProvider.genAuthorizationHeader(), id.toString());
	}catch(ClientResponseFailure t){
		throw new DeskComException(t);
	}
}
 
开发者ID:quintoandar,项目名称:desk.com,代码行数:8,代码来源:DeskApiWrapper.java


示例16: newCustomer

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
public Customer newCustomer(Customer customer) throws DeskComException{
	try{
		return customerApi.create(authProvider.genAuthorizationHeader(), customer);
	}catch(ClientResponseFailure t){
		throw new DeskComException(t);
	}
}
 
开发者ID:quintoandar,项目名称:desk.com,代码行数:8,代码来源:DeskApiWrapper.java


示例17: showCase

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
/**
 * if caseId is present, case id. Other wise tries caseExternalId
 * @param caseId
 * @param caseExternalId
 * @param embeds (optional)
 * @return
 * @throws DeskComException
 */
public Case showCase(BigInteger caseId, String caseExternalId, Set<String> embeds) throws DeskComException {
	try {
		if(caseId != null){
			return caseApi.showCase(authProvider.genAuthorizationHeader(), caseId,embeds);
		} else {
			return caseApi.showCase(authProvider.genAuthorizationHeader(), caseExternalId, embeds);
		}
	}catch(ClientResponseFailure t){
		throw new DeskComException(t);
	}
}
 
开发者ID:quintoandar,项目名称:desk.com,代码行数:20,代码来源:DeskApiWrapper.java


示例18: searchUser

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
public List<User> searchUser(Set<String> emails) throws DeskComException {
	Set<User> usuarios = new LinkedHashSet<User>();
	try{
		for(User us: userApi.users(authProvider.genAuthorizationHeader(), null, null).get_embedded().getEntries()) {
			if(emails.contains(us.getEmail())){
				usuarios.add(us);
			}
		}
		return new LinkedList(usuarios);
	}catch(ClientResponseFailure t){
		throw new DeskComException(t);
	}
}
 
开发者ID:quintoandar,项目名称:desk.com,代码行数:14,代码来源:DeskApiWrapper.java


示例19: newMessage

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
public Message newMessage(BigInteger id, Message msg) throws DeskComException {
	try {
		return caseApi.createReplyCase(authProvider.genAuthorizationHeader(), id, msg);
	}catch(ClientResponseFailure t){
		throw new DeskComException(t);
	}
}
 
开发者ID:quintoandar,项目名称:desk.com,代码行数:8,代码来源:DeskApiWrapper.java


示例20: listCases

import org.jboss.resteasy.client.ClientResponseFailure; //导入依赖的package包/类
public List<Case> listCases(BigInteger customerId) throws DeskComException {
	Set<Case> cases = new LinkedHashSet<Case>();
	try {
		for(Case kase:caseApi.casesFromCustomer(authProvider.genAuthorizationHeader(), customerId,null,null).get_embedded().getEntries()){
			cases.add(kase);
		}
		return new LinkedList<Case>(cases);
	}catch(ClientResponseFailure t){
		throw new DeskComException(t);
	}
}
 
开发者ID:quintoandar,项目名称:desk.com,代码行数:12,代码来源:DeskApiWrapper.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MisfireException类代码示例发布时间:2022-05-22
下一篇:
Java SendToUser类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap