Java Code Examples for org.springframework.http.HttpStatus#GONE

The following examples show how to use org.springframework.http.HttpStatus#GONE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServiceInstanceBindingController.java    From spring-boot-cf-service-broker with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value = BASE_PATH + "/{bindingId}", method = RequestMethod.DELETE)
public ResponseEntity<String> deleteServiceInstanceBinding(
		@PathVariable("instanceId") String instanceId, 
		@PathVariable("bindingId") String bindingId,
		@RequestParam("service_id") String serviceId,
		@RequestParam("plan_id") String planId) throws ServiceBrokerException, ServiceInstanceDoesNotExistException, ServiceBrokerAsyncRequiredException {
	logger.debug( "DELETE: " + BASE_PATH + "/{bindingId}"
			+ ", deleteServiceInstanceBinding(),  serviceInstance.id = " + instanceId 
			+ ", bindingId = " + bindingId 
			+ ", serviceId = " + serviceId
			+ ", planId = " + planId);
       ServiceInstance instance = serviceInstanceService.getServiceInstance(instanceId);
       if (instance == null) {
           throw new ServiceInstanceDoesNotExistException(instanceId);
       }
	ServiceInstanceBinding binding = serviceInstanceBindingService.deleteServiceInstanceBinding(
	        new DeleteServiceInstanceBindingRequest( bindingId, instance, serviceId, planId));
	if (binding == null) {
		return new ResponseEntity<>("{}", HttpStatus.GONE);
	}
	logger.debug("ServiceInstanceBinding Deleted: " + binding.getId());
       return new ResponseEntity<>("{}", HttpStatus.OK);
}
 
Example 2
Source File: AbstractExceptionHandler.java    From yue-library with Apache License 2.0 5 votes vote down vote up
/**
 * 拦截API接口版本弃用异常-410
 * 
 * @param e API接口版本弃用异常
    * @return 结果
 */
   @ResponseBody
   @ResponseStatus(code = HttpStatus.GONE)
   @ExceptionHandler(ApiVersionDeprecatedException.class)
public Result<?> apiVersionDeprecatedExceptionHandler(ApiVersionDeprecatedException e) {
   	ExceptionUtils.printException(e);
   	return ResultInfo.gone();
}
 
Example 3
Source File: TripleService.java    From SDA with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * triple파일을 DM로 전송
 * @param triple_path_file
 * @return String[]
 * @throws Exception
 */
public String[] sendTripleFileToDM(String triple_path_file) throws Exception {
	String[] result = new String[]{"",""};
	
	String[] args = { "/apps/sda/bin/apache-jena-fuseki-2.3.0/bin/s-post",
					"http://192.168.1.1:3030/icbms", "default", "/tmp/test.nt" };

	// conf값을 확인해서 재설정함
	args[0] = Utils.getSdaProperty("com.pineone.icbms.sda.triple.regist.bin");
	args[1] = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.dm.sparql.endpoint");
	args[2] = "default";
	args[3] = triple_path_file;

	log.info("sendTripleFile to DM start==========================>");
	StringBuilder sb = new StringBuilder();

	for (String str : args) {
		sb.append(str);
		sb.append(" ");
	}

	log.debug("sendTripleFile  to DM ==============args============>" + sb.toString());

	// 전송 실행
	result = Utils.runShell(sb);
	
	if(result[1] == null || ! result[1].trim().equals("")) {
		log.debug("result[1](error message) in TripleService.sendTripleFileToDM() == > "+ result[1]);
		if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException")  || result[1].contains("Service Unavailable") ) {
			throw new UserDefinedException(HttpStatus.GONE,  result[1].toString());
		}
	} else {
		// pass
	}
	
	log.info("sendTripleFile to DM  end==========================>");
	return result;
}
 
Example 4
Source File: TripleService.java    From SDA with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * triple파일을 DM로 전송
 * @param triple_path_file
 * @return String[]
 * @throws Exception
 */
public String[] sendTripleFileToDM(String triple_path_file) throws Exception {
	String[] result = new String[]{"",""};
	
	String[] args = { "/apps/sda/bin/apache-jena-fuseki-2.3.0/bin/s-post",
					"http://192.168.1.1:3030/icbms", "default", "/tmp/test.nt" };

	// conf값을 확인해서 재설정함
	args[0] = Utils.getSdaProperty("com.pineone.icbms.sda.triple.regist.bin");
	args[1] = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.dm.sparql.endpoint");
	args[2] = "default";
	args[3] = triple_path_file;

	log.info("sendTripleFile to DM start==========================>");
	StringBuilder sb = new StringBuilder();

	for (String str : args) {
		sb.append(str);
		sb.append(" ");
	}

	log.debug("sendTripleFile  to DM ==============args============>" + sb.toString());

	// 전송 실행
	result = Utils.runShell(sb);
	
	if(result[1] == null || ! result[1].trim().equals("")) {
		log.debug("result[1](error message) in TripleService.sendTripleFileToDM() == > "+ result[1]);
		if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException")  || result[1].contains("Service Unavailable") ) {
			throw new UserDefinedException(HttpStatus.GONE,  result[1].toString());
		}
	} else {
		// pass
	}
	
	log.info("sendTripleFile to DM  end==========================>");
	return result;
}
 
Example 5
Source File: DdiRootController.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public ResponseEntity<Void> postBasedeploymentActionFeedback(@Valid @RequestBody final DdiActionFeedback feedback,
        @PathVariable("tenant") final String tenant, @PathVariable("controllerId") final String controllerId,
        @PathVariable("actionId") @NotEmpty final Long actionId) {
    LOG.debug("provideBasedeploymentActionFeedback for target [{},{}]: {}", controllerId, actionId, feedback);

    final Target target = controllerManagement.getByControllerId(controllerId)
            .orElseThrow(() -> new EntityNotFoundException(Target.class, controllerId));

    if (!actionId.equals(feedback.getId())) {
        LOG.warn(
                "provideBasedeploymentActionFeedback: action in payload ({}) was not identical to action in path ({}).",
                feedback.getId(), actionId);
        return ResponseEntity.notFound().build();
    }

    final Action action = findActionWithExceptionIfNotFound(actionId);
    if (!action.getTarget().getId().equals(target.getId())) {
        LOG.warn(GIVEN_ACTION_IS_NOT_ASSIGNED_TO_GIVEN_TARGET, action.getId(), target.getId());
        return ResponseEntity.notFound().build();
    }

    if (!action.isActive()) {
        LOG.warn("Updating action {} with feedback {} not possible since action not active anymore.",
                action.getId(), feedback.getId());
        return new ResponseEntity<>(HttpStatus.GONE);
    }

    controllerManagement.addUpdateActionStatus(generateUpdateStatus(feedback, controllerId, feedback.getId()));

    return ResponseEntity.ok().build();

}
 
Example 6
Source File: HttpClientErrorException.java    From spring-analysis-note with MIT License 4 votes vote down vote up
Gone(String statusText, HttpHeaders headers, byte[] body, @Nullable Charset charset) {
	super(HttpStatus.GONE, statusText, headers, body, charset);
}
 
Example 7
Source File: HttpClientErrorException.java    From java-technology-stack with MIT License 4 votes vote down vote up
Gone(String statusText, HttpHeaders headers, byte[] body, @Nullable Charset charset) {
	super(HttpStatus.GONE, statusText, headers, body, charset);
}
 
Example 8
Source File: TripleService.java    From SDA with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public String[] sendTripleFile(String triple_path_file) throws Exception {
	String[] result = new String[]{"",""};
	
	String[] args = { "/home/pineone/svc/apps/sda/bin/apache-jena-fuseki-2.3.0/bin/s-post",
					"http://192.168.1.1:3030/icbms", "default", "/tmp/test.nt" };

	// conf값을 확인해서 재설정함
	args[0] = Utils.getSdaProperty("com.pineone.icbms.sda.triple.regist.bin");
	args[1] = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.sparql.endpoint");
	args[2] = "default";
	args[3] = triple_path_file;

	log.info("sendTripleFile start==========================>");
	log.debug("sendTripleFile ==============triple_path_file============>" + triple_path_file);
	
	// 개수확인(before)
	Utils.getTripleCount();

	StringBuilder sb = new StringBuilder();

	for (String str : args) {
		sb.append(str);
		sb.append(" ");
	}

	log.debug("sendTripleFile ==============args============>" + sb.toString());

	// 실행
	result = Utils.runShell(sb);
	log.debug("resultStr in TripleService.sendTripleFile() == > "+ Arrays.toString(result));
	
	if(result[1] == null || ! result[1].trim().equals("")) {
		log.debug("result[1](error message) in TripleService.sendTripleFile() == > "+ result[1]);
		throw new UserDefinedException(HttpStatus.GONE,  result[1].toString());
	}
	
	log.info("sendTripleFile end==========================>");

	// 개수확인(after)
	Utils.getTripleCount();

	return result;
}
 
Example 9
Source File: TripleService.java    From SDA with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * triple파일을 DW로 전송
 * @param triple_path_file
 * @throws Exception
 * @return String[]
 */
public String[] sendTripleFileToDW(String triple_path_file) throws Exception {
	String[] result = new String[]{"",""};
	
	String[] args = { "/home/pineone/svc/apps/sda/bin/apache-jena-fuseki-2.3.0/bin/s-post",
					"http://192.168.1.1:3030/icbms", "default", "/tmp/test.nt" };

	// conf값을 확인해서 재설정함
	args[0] = Utils.getSdaProperty("com.pineone.icbms.sda.triple.regist.bin");
	args[1] = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.dw.sparql.endpoint");
	args[2] = "default";
	args[3] = triple_path_file;

	log.info("sendTripleFile to DW start==========================>");
	log.debug("sendTripleFile ==============triple_path_file============>" + triple_path_file);

	StringBuilder sb = new StringBuilder();

	for (String str : args) {
		sb.append(str);
		sb.append(" ");
	}

	log.debug("sendTripleFile ==============args============>" + sb.toString());

	// 실행(1차)
	log.debug("try (first).......................");
	result = Utils.runShell(sb);
	
	log.debug("resultStr in TripleService.sendTripleFileToDW() == > "+ Arrays.toString(result));
	
	if(result[1] == null || ! result[1].trim().equals("")) {
		log.debug("result[1](error message) in TripleService.sendTripleFileToDW() == > "+ result[1]);
		int waitTime = 15*1000;
		if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException")  || result[1].contains("Service Unavailable") ) {
			
			log.debug("sleep (first)...........................");
			// 일정시간을 대기 한다.(1차)
			Thread.sleep(waitTime);

			// restart fuseki
			Utils.restartFuseki();
			
			log.debug("sleep (final)...........................");
			// 일정시간을 대기 한다.(2차)
			waitTime = 30*1000;
			Thread.sleep(waitTime);
			
			// 실행(2차)
			log.debug("try (final).......................");
			result = Utils.runShell(sb);
			if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException")  || result[1].contains("Service Unavailable") ) {
				throw new UserDefinedException(HttpStatus.GONE,  result[1].toString());
			}
		} else {
			// pass
		}
	}
	
	log.info("sendTripleFile to DW  end==========================>");
	return result;
}
 
Example 10
Source File: TripleService.java    From SDA with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * triple파일 체크(Fuseki만)
 * @param triple_path_file
 * @param result_file_name
 * @return String[]
 * @throws Exception
 */
public String[] checkTripleFile(String triple_path_file, String result_file_name) throws Exception {
	String[] result = new String[]{"",""};

	String[] args = { "/bin/jena/apache-jena-3.0.0/bin/riot",
					"--check", "/tmp/test.nt" };

	// conf값을 확인해서 재설정함
	String result_path = Utils.getSdaProperty("com.pineone.icbms.sda.riot.result.save_path");
	args[0] = Utils.getSdaProperty("com.pineone.icbms.sda.riot.bin");
	args[1] = Utils.getSdaProperty("com.pineone.icbms.sda.riot.mode");;
	args[2] = triple_path_file;

	log.info("checkTripleFile start============================>");
	log.debug("checkTripleFile ==============triple_path_file============>" + triple_path_file);
	log.debug("result_path ==============result_path============>" + result_path);
	
	StringBuilder sb = new StringBuilder();

	for (String str : args) {
		sb.append(str); 
		sb.append(" ");
	}

	log.debug("checkTripleFile ==============args============>" + sb.toString());

	//실행(1차)
	log.debug("try (first)...........................");
	result = Utils.runShell(sb);
	
	if(result[1] == null || ! result[1].trim().equals("")) {
		log.debug("result[1](error message) in TripleService.checkTripleFile() == > "+ result[1]);
		int waitTime = 15*1000;
		if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException")  || result[1].contains("Service Unavailable") ) {
			log.debug("sleep (first)...........................");
			// 일정시간을 대기 한다.(1차)
			Thread.sleep(waitTime);

			// restart fuseki
			Utils.restartFuseki();
			
			log.debug("sleep (final)...........................");
			// 일정시간을 대기 한다.(2차)
			waitTime = 30*1000;
			Thread.sleep(waitTime);
			
			// 실행(2차)
			log.debug("try (final)...........................");
			result = Utils.runShell(sb);
			if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException")  || result[1].contains("Service Unavailable") ) {
				throw new UserDefinedException(HttpStatus.GONE,  result[1].toString());
			}
		} else {
			throw new UserDefinedException(HttpStatus.CONTINUE,  result[1].toString());
		}
	}


	
	log.info("checkTripleFile end==========================>");

	return result;
}
 
Example 11
Source File: TripleService.java    From SDA with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public String[] sendTripleFile(String triple_path_file) throws Exception {
	String[] result = new String[]{"",""};
	
	String[] args = { "/home/pineone/svc/apps/sda/bin/apache-jena-fuseki-2.3.0/bin/s-post",
					"http://192.168.1.1:3030/icbms", "default", "/tmp/test.nt" };

	// conf값을 확인해서 재설정함
	args[0] = Utils.getSdaProperty("com.pineone.icbms.sda.triple.regist.bin");
	args[1] = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.sparql.endpoint");
	args[2] = "default";
	args[3] = triple_path_file;

	log.info("sendTripleFile start==========================>");
	log.debug("sendTripleFile ==============triple_path_file============>" + triple_path_file);
	
	// 개수확인(before)
	Utils.getTripleCount();

	StringBuilder sb = new StringBuilder();

	for (String str : args) {
		sb.append(str);
		sb.append(" ");
	}

	log.debug("sendTripleFile ==============args============>" + sb.toString());

	// 실행
	result = Utils.runShell(sb);
	log.debug("resultStr in TripleService.sendTripleFile() == > "+ Arrays.toString(result));
	
	if(result[1] == null || ! result[1].trim().equals("")) {
		log.debug("result[1](error message) in TripleService.sendTripleFile() == > "+ result[1]);
		throw new UserDefinedException(HttpStatus.GONE,  result[1].toString());
	}
	
	log.info("sendTripleFile end==========================>");

	// 개수확인(after)
	Utils.getTripleCount();

	return result;
}
 
Example 12
Source File: TripleService.java    From SDA with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * triple파일을 DW로 전송
 * @param triple_path_file
 * @throws Exception
 * @return String[]
 */
public String[] sendTripleFileToDW(String triple_path_file) throws Exception {
	String[] result = new String[]{"",""};
	
	String[] args = { "/home/pineone/svc/apps/sda/bin/apache-jena-fuseki-2.3.0/bin/s-post",
					"http://192.168.1.1:3030/icbms", "default", "/tmp/test.nt" };

	// conf값을 확인해서 재설정함
	args[0] = Utils.getSdaProperty("com.pineone.icbms.sda.triple.regist.bin");
	args[1] = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.dw.sparql.endpoint");
	args[2] = "default";
	args[3] = triple_path_file;

	log.info("sendTripleFile to DW start==========================>");
	log.debug("sendTripleFile ==============triple_path_file============>" + triple_path_file);

	StringBuilder sb = new StringBuilder();

	for (String str : args) {
		sb.append(str);
		sb.append(" ");
	}

	log.debug("sendTripleFile ==============args============>" + sb.toString());

	// 실행(1차)
	log.debug("try (first).......................");
	result = Utils.runShell(sb);
	
	log.debug("resultStr in TripleService.sendTripleFileToDW() == > "+ Arrays.toString(result));
	
	if(result[1] == null || ! result[1].trim().equals("")) {
		log.debug("result[1](error message) in TripleService.sendTripleFileToDW() == > "+ result[1]);
		int waitTime = 15*1000;
		if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException")  || result[1].contains("Service Unavailable") ) {
			
			log.debug("sleep (first)...........................");
			// 일정시간을 대기 한다.(1차)
			Thread.sleep(waitTime);

			// restart fuseki
			Utils.restartFuseki();
			
			log.debug("sleep (final)...........................");
			// 일정시간을 대기 한다.(2차)
			waitTime = 30*1000;
			Thread.sleep(waitTime);
			
			// 실행(2차)
			log.debug("try (final).......................");
			result = Utils.runShell(sb);
			if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException")  || result[1].contains("Service Unavailable") ) {
				throw new UserDefinedException(HttpStatus.GONE,  result[1].toString());
			}
		} else {
			// pass
		}
	}
	
	log.info("sendTripleFile to DW  end==========================>");
	return result;
}
 
Example 13
Source File: TripleService.java    From SDA with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * triple파일 체크(Fuseki만)
 * @param triple_path_file
 * @param result_file_name
 * @return String[]
 * @throws Exception
 */
public String[] checkTripleFile(String triple_path_file, String result_file_name) throws Exception {
	String[] result = new String[]{"",""};

	String[] args = { "/bin/jena/apache-jena-3.0.0/bin/riot",
					"--check", "/tmp/test.nt" };

	// conf값을 확인해서 재설정함
	String result_path = Utils.getSdaProperty("com.pineone.icbms.sda.riot.result.save_path");
	args[0] = Utils.getSdaProperty("com.pineone.icbms.sda.riot.bin");
	args[1] = Utils.getSdaProperty("com.pineone.icbms.sda.riot.mode");;
	args[2] = triple_path_file;

	log.info("checkTripleFile start============================>");
	log.debug("checkTripleFile ==============triple_path_file============>" + triple_path_file);
	log.debug("result_path ==============result_path============>" + result_path);
	
	StringBuilder sb = new StringBuilder();

	for (String str : args) {
		sb.append(str); 
		sb.append(" ");
	}

	log.debug("checkTripleFile ==============args============>" + sb.toString());

	//실행(1차)
	log.debug("try (first)...........................");
	result = Utils.runShell(sb);
	
	if(result[1] == null || ! result[1].trim().equals("")) {
		log.debug("result[1](error message) in TripleService.checkTripleFile() == > "+ result[1]);
		int waitTime = 15*1000;
		if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException")  || result[1].contains("Service Unavailable") ) {
			log.debug("sleep (first)...........................");
			// 일정시간을 대기 한다.(1차)
			Thread.sleep(waitTime);

			// restart fuseki
			Utils.restartFuseki();
			
			log.debug("sleep (final)...........................");
			// 일정시간을 대기 한다.(2차)
			waitTime = 30*1000;
			Thread.sleep(waitTime);
			
			// 실행(2차)
			log.debug("try (final)...........................");
			result = Utils.runShell(sb);
			if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException")  || result[1].contains("Service Unavailable") ) {
				throw new UserDefinedException(HttpStatus.GONE,  result[1].toString());
			}
		} else {
			throw new UserDefinedException(HttpStatus.CONTINUE,  result[1].toString());
		}
	}


	
	log.info("checkTripleFile end==========================>");

	return result;
}