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


Java ClientErrorException类代码示例

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


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

示例1: addDefaultSchedules

import javax.ws.rs.ClientErrorException; //导入依赖的package包/类
public void addDefaultSchedules() {		
	
	for (int i = 0; i < defaultSchedules.getSize(); i++) {
		String name = defaultSchedules.getName()[i];
		String start = defaultSchedules.getStart()[i];
		String end = defaultSchedules.getEnd()[i];
		String frequency = defaultSchedules.getFrequency()[i];
		String cron = defaultSchedules.getCron()[i];
		Boolean runOnce = Boolean.valueOf(defaultSchedules.getRunOnce()[i]);
		
		Schedule schedule = new Schedule(name, start, end, frequency, cron, runOnce);
			
		try {
			scheduleClient.add(schedule);
		} catch (ClientErrorException e) {
			// Ignore if the schedule is already present
			// schedule.setId(scheduleClient.scheduleForName(name).getId());
			// scheduleClient.update(schedule);
		}
	}
	
}
 
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:23,代码来源:Scheduler.java

示例2: toResponse

import javax.ws.rs.ClientErrorException; //导入依赖的package包/类
@Override
public Response toResponse(final ClientErrorException exception) {
    final Response response = exception.getResponse();

    final RestError error = new RestError(exception.getMessage(), "Given request is not acceptable", null,
        response.getStatus());

    return Response.fromResponse(response).type(MediaType.APPLICATION_JSON_TYPE).entity(error).build();
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:10,代码来源:ClientErrorExceptionMapper.java

示例3: onUnsubscribeFromProduct

import javax.ws.rs.ClientErrorException; //导入依赖的package包/类
@Override
public void onUnsubscribeFromProduct(VOTriggerProcess triggerProcess,
        String subId) {

    try {
        TriggerProcess process = ds.getReference(TriggerProcess.class,
                triggerProcess.getKey());

        Query q = ds.createNamedQuery("Subscription.findByBusinessKey");

        q.setParameter("subscriptionId", subId);
        q.setParameter("organizationKey", new Long(process
                .getTriggerDefinition().getOrganization().getKey()));

        Subscription sub = (Subscription) q.getSingleResult();

        Product prod = sub.getProduct();

        handleRequest(process, sub, prod);

    } catch (ObjectNotFoundException | ClientErrorException e) {
        throw new SaaSSystemException(
                "Failed to send notification to rest endpoint");
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:26,代码来源:RestNotificationServiceAdapter.java

示例4: addDefaultSchedules

import javax.ws.rs.ClientErrorException; //导入依赖的package包/类
public void addDefaultSchedules() {

    for (int i = 0; i < defaultSchedules.getSize(); i++) {
      String name = defaultSchedules.getName()[i];
      String start = defaultSchedules.getStart()[i];
      String end = defaultSchedules.getEnd()[i];
      String frequency = defaultSchedules.getFrequency()[i];
      String cron = defaultSchedules.getCron()[i];
      Boolean runOnce = Boolean.valueOf(defaultSchedules.getRunOnce()[i]);
      Schedule schedule = new Schedule(name, start, end, frequency, cron, runOnce);

      try {
        scheduleClient.add(schedule);
      } catch (ClientErrorException e) {
        // Ignore if the schedule is already present
        // schedule.setId(scheduleClient.scheduleForName(name).getId());
        // scheduleClient.update(schedule);
      }
    }

  }
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:22,代码来源:Scheduler.java

示例5: addDefaultSchedules

import javax.ws.rs.ClientErrorException; //导入依赖的package包/类
public void addDefaultSchedules() {

    for (int i = 0; i < defaultSchedules.getSize(); i++) {
      String name = defaultSchedules.getName()[i];
      String start = defaultSchedules.getStart()[i];
      String end = defaultSchedules.getEnd()[i];
      String frequency = defaultSchedules.getFrequency()[i];
      String cron = defaultSchedules.getCron()[i];
      Boolean runOnce = Boolean.valueOf(defaultSchedules.getRunOnce()[i]);

      Schedule schedule = new Schedule(name, start, end, frequency, cron, runOnce);

      try {
        scheduleClient.add(schedule);
      } catch (ClientErrorException e) {
        // Ignore if the schedule is already present
        // schedule.setId(scheduleClient.scheduleForName(name).getId());
        // scheduleClient.update(schedule);
      }
    }

  }
 
开发者ID:edgexfoundry,项目名称:device-bacnet,代码行数:23,代码来源:Scheduler.java

示例6: QuerryBillStatus

import javax.ws.rs.ClientErrorException; //导入依赖的package包/类
public String QuerryBillStatus(String merchant_trans_id, String good_code, String trans_id, String merchant_code, String secure_hash) throws ClientErrorException {
    WebTarget resource = webTarget;
    if (merchant_code != null) {
        resource = resource.queryParam("merchant_code", merchant_code);
    }
    if (good_code != null) {
        resource = resource.queryParam("good_code", good_code);
    }
    if (merchant_trans_id != null) {
        resource = resource.queryParam("merchant_trans_id", merchant_trans_id);
    }
    if (secure_hash != null) {
        resource = resource.queryParam("secure_hash", secure_hash);
    }
    if (trans_id != null) {
        resource = resource.queryParam("trans_id", trans_id);
    }
    resource = resource.path("QuerryBillStatus");
    return resource.request(javax.ws.rs.core.MediaType.TEXT_PLAIN).get(String.class);
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:21,代码来源:KPRest.java

示例7: QuerryBillStatus

import javax.ws.rs.ClientErrorException; //导入依赖的package包/类
public String QuerryBillStatus(String merchant_trans_id, String good_code, String trans_id, String merchant_code,
		String secure_hash) throws ClientErrorException {
	WebTarget resource = webTarget;
	if (merchant_code != null) {
		resource = resource.queryParam("merchant_code", merchant_code);
	}
	if (good_code != null) {
		resource = resource.queryParam("good_code", good_code);
	}
	if (merchant_trans_id != null) {
		resource = resource.queryParam("merchant_trans_id", merchant_trans_id);
	}
	if (secure_hash != null) {
		resource = resource.queryParam("secure_hash", secure_hash);
	}
	if (trans_id != null) {
		resource = resource.queryParam("trans_id", trans_id);
	}
	resource = resource.path("QuerryBillStatus");
	return resource.request(javax.ws.rs.core.MediaType.APPLICATION_JSON).get(String.class);
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:22,代码来源:KPJsonRest.java

示例8: toResponse

import javax.ws.rs.ClientErrorException; //导入依赖的package包/类
@Override
public Response toResponse(Throwable throwable) {

  // IF this is a client error simply pas through the original response
  if (throwable instanceof ClientErrorException) {
    return ((ClientErrorException) throwable).getResponse();
  } else if (BiliomiContainer.getParameters().isDebugMode())  {
    ServerErrorResponse response = new ServerErrorResponse();

    response.setErrorMessage(throwable.getMessage());

    if (throwable.getCause() != null) {
      response.setCausedBy(throwable.getCause().getMessage());
    }

    return Responses.serverError(response);
  } else {
    return Responses.serverError();
  }
}
 
开发者ID:Juraji,项目名称:Biliomi,代码行数:21,代码来源:ExceptionResponseMapper.java

示例9: changeVersionStatus

import javax.ws.rs.ClientErrorException; //导入依赖的package包/类
private void changeVersionStatus(String text){
	Storage storage = Storage.getInstance();
	String pages = getPagesString();
	
	String[] pageList = pages.split(",");
	
	if (!pages.equals("") && pageList.length >= 1){
		
		for (String page : pageList){
			int pageNr = Integer.valueOf(page);
			int colId = storage.getCurrentDocumentCollectionId();
			int docId = storage.getDocId();
			int transcriptId = storage.getPage().getCurrentTranscript().getTsId();
			try {
				storage.getConnection().updatePageStatus(colId, docId, pageNr, transcriptId, EditStatus.fromString(text), "test");
			} catch (SessionExpiredException | ServerErrorException | ClientErrorException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:24,代码来源:ThumbnailManager.java

示例10: revokeOAuthToken

import javax.ws.rs.ClientErrorException; //导入依赖的package包/类
public static void revokeOAuthToken(final String refreshToken, final OAuthProvider prov) throws IOException{
	
	final String uriStr;
	switch (prov) {
	case Google:
		uriStr = "https://accounts.google.com/o/oauth2/revoke?token=";
		break;
	default:
		throw new IOException("Unknown OAuth Provider: " + prov);
	}
	
	CloseableHttpClient client = HttpClients.custom().setSSLHostnameVerifier(new NoopHostnameVerifier()).build();		
	HttpGet get = new HttpGet(uriStr + refreshToken);
	HttpResponse response = client.execute(get);
	final int status = response.getStatusLine().getStatusCode();		
	if (status != 200) {
		String reason = response.getStatusLine().getReasonPhrase();
		logger.error(reason);
		throw new ClientErrorException(reason, status);
	}
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:22,代码来源:OAuthGuiUtil.java

示例11: testCreateException

import javax.ws.rs.ClientErrorException; //导入依赖的package包/类
@Test
public void testCreateException() {
    assertExceptionType(Response.Status.INTERNAL_SERVER_ERROR, InternalServerErrorException.class);
    assertExceptionType(Response.Status.NOT_FOUND, NotFoundException.class);
    assertExceptionType(Response.Status.FORBIDDEN, ForbiddenException.class);
    assertExceptionType(Response.Status.BAD_REQUEST, BadRequestException.class);
    assertExceptionType(Response.Status.METHOD_NOT_ALLOWED, NotAllowedException.class);
    assertExceptionType(Response.Status.UNAUTHORIZED, NotAuthorizedException.class);
    assertExceptionType(Response.Status.NOT_ACCEPTABLE, NotAcceptableException.class);
    assertExceptionType(Response.Status.UNSUPPORTED_MEDIA_TYPE, NotSupportedException.class);
    assertExceptionType(Response.Status.SERVICE_UNAVAILABLE, ServiceUnavailableException.class);
    assertExceptionType(Response.Status.TEMPORARY_REDIRECT, RedirectionException.class);
    assertExceptionType(Response.Status.LENGTH_REQUIRED, ClientErrorException.class);
    assertExceptionType(Response.Status.BAD_GATEWAY, ServerErrorException.class);
    assertExceptionType(Response.Status.NO_CONTENT, WebApplicationException.class);
}
 
开发者ID:Microbule,项目名称:microbule,代码行数:17,代码来源:AbstractErrorResponseStrategyTest.java

示例12: testCreateNotificationChannelScenario4

import javax.ws.rs.ClientErrorException; //导入依赖的package包/类
/**
 * When client error exception has been thrown
 */
@Test
public void testCreateNotificationChannelScenario4() {
    resetAll();
    // test data
    final CreateNotificationChannelRequest request = getHelper().getCreateNotificationChannelRequest();
    final CronofyResponse<CreateNotificationChannelResponse> expectedResponse = new CronofyResponse<>(
            ErrorTypeModel.UNPROCESSABLE
    );
    // expectations
    expect(client.target(BASE_PATH)).andThrow(new ClientErrorException(Response.Status.CONFLICT));
    replayAll();
    final CronofyResponse<CreateNotificationChannelResponse> result = cronofyClient.createNotificationChannel(request);
    getHelper().assertResultResponse(expectedResponse, result);
    verifyAll();
}
 
开发者ID:Biacode,项目名称:jcronofy,代码行数:19,代码来源:CronofyClientImplTest.java

示例13: testListCalendarsScenario5

import javax.ws.rs.ClientErrorException; //导入依赖的package包/类
/**
 * When client error exception has been thrown
 */
@Test
public void testListCalendarsScenario5() {
    resetAll();
    // test data
    final ListCalendarsRequest request = getHelper().getListCalendarsRequest();
    final CronofyResponse<ListCalendarsResponse> expectedResponse = new CronofyResponse<>(
            ErrorTypeModel.UNPROCESSABLE
    );
    // expectations
    expect(client.target(BASE_PATH)).andThrow(new ClientErrorException(Response.Status.CONFLICT));
    replayAll();
    final CronofyResponse<ListCalendarsResponse> result = cronofyClient.listCalendars(request);
    getHelper().assertResultResponse(expectedResponse, result);
    verifyAll();
}
 
开发者ID:Biacode,项目名称:jcronofy,代码行数:19,代码来源:CronofyClientImplTest.java

示例14: analyzeLayoutOnCurrentTranscript

import javax.ws.rs.ClientErrorException; //导入依赖的package包/类
public List<String> analyzeLayoutOnCurrentTranscript(List<String> regIds, boolean doBlockSeg, boolean doLineSeg, boolean doWordSeg, boolean doPolygonToBaseline, boolean doBaselineToPolygon, String jobImpl, String pars) throws SessionExpiredException, ServerErrorException, ClientErrorException, IllegalArgumentException, NoConnectionException, IOException {
	checkConnection(true);
	
	if (!isRemoteDoc()) {
		throw new IOException("No remote doc loaded!");
	}
	int colId = getCurrentDocumentCollectionId();
	
	DocumentSelectionDescriptor dd = new DocumentSelectionDescriptor(getDocId());
	PageDescriptor pd = dd.addPage(getPage().getPageId());
	if (regIds != null && !regIds.isEmpty()) {
		pd.getRegionIds().addAll(regIds);
	}
	pd.setTsId(getTranscriptMetadata().getTsId());
	
	List<DocumentSelectionDescriptor> dsds = new ArrayList<>();
	dsds.add(dd);
	
	List<String> jobids = new ArrayList<>();
	List<TrpJobStatus> jobs = conn.analyzeLayout(colId, dsds, doBlockSeg, doLineSeg, doWordSeg, doPolygonToBaseline, doBaselineToPolygon, jobImpl, pars);
	for (TrpJobStatus j : jobs) {
		jobids.add(j.getJobId());
	}
			
	return jobids;
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:27,代码来源:Storage.java

示例15: testFreeBusyScenario5

import javax.ws.rs.ClientErrorException; //导入依赖的package包/类
/**
 * When client error exception has been thrown
 */
@Test
public void testFreeBusyScenario5() {
    resetAll();
    // test data
    final FreeBusyRequest request = getHelper().getFreeBusyRequest();
    final CronofyResponse<FreeBusyResponse> expectedResponse = new CronofyResponse<>(
            ErrorTypeModel.UNPROCESSABLE
    );
    // expectations
    expect(client.target(BASE_PATH)).andThrow(new ClientErrorException(Response.Status.CONFLICT));
    replayAll();
    final CronofyResponse<FreeBusyResponse> result = cronofyClient.freeBusy(request);
    getHelper().assertResultResponse(expectedResponse, result);
    verifyAll();
}
 
开发者ID:Biacode,项目名称:jcronofy,代码行数:19,代码来源:CronofyClientImplTest.java


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