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


Java HttpStatus.NOT_FOUND属性代码示例

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


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

示例1: linkSprintIdWithStoryId

@JsonView(JsonViews.Basique.class)
@RequestMapping(value = "/api/sprint/{idSprint}/story/{idStory}", method = RequestMethod.POST, produces = "application/json")
public ResponseEntity<Sprint> linkSprintIdWithStoryId(@PathVariable Long idSprint, @PathVariable Long idStory)
{
    LOGGER.debug("ApiController - linkSprintIdWithStoryId");

    Story story = storyService.findOneByIdWithAll(idStory);
    Sprint sprint = sprintService.findOneByIdWithAll(idSprint);

    if(null==sprint ||null ==story)
    {
        return new ResponseEntity<Sprint>(sprint, HttpStatus.NOT_FOUND);
    }

    story.setStorySprint(sprint);
    story = storyService.save(story);
    sprint = sprintService.findOneByIdWithAll(idSprint);
    return new ResponseEntity<Sprint>(sprint, HttpStatus.CREATED);
}
 
开发者ID:scrumtracker,项目名称:scrumtracker2017,代码行数:19,代码来源:ApiSprintController.java

示例2: exception

@CrossOrigin
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(NotFoundException.class)
public MessageDTO exception(NotFoundException e) {
    return new MessageDTO(e.getMessage());
}
 
开发者ID:Code4SocialGood,项目名称:C4SG-Obsolete,代码行数:6,代码来源:GenericController.java

示例3: handleNotFound

@ResponseStatus(HttpStatus.NOT_FOUND)
// 404
@ExceptionHandler(FlowableObjectNotFoundException.class)
@ResponseBody
public ErrorInfo handleNotFound(FlowableObjectNotFoundException e) {
	LOGGER.error("Not found", e);
	return new ErrorInfo("Not found", e);
}
 
开发者ID:wengwh,项目名称:plumdo-work,代码行数:8,代码来源:ExceptionHandlerAdvice.java

示例4: getBook

@GetMapping("/books/{ISBN}")
public ResponseEntity getBook(@PathVariable long ISBN) {

	Book book = bookDAO.getBook(ISBN);
	if (null == book) {
		return new ResponseEntity<Book>(HttpStatus.NOT_FOUND);
	}

	return new ResponseEntity(book, HttpStatus.OK);
}
 
开发者ID:PacktPublishing,项目名称:Learning-Spring-5.0,代码行数:10,代码来源:MyBookController.java

示例5: getUser

@RequestMapping(value = "/users/{id}", method = RequestMethod.GET)
public ResponseEntity<?> getUser(@PathVariable("id") long id) {
    logger.info("Fetching User with id {}", id);
    User user = userService.getById(id);
    if (user == null) {
        logger.error("User with id {} not found.", id);
        return new ResponseEntity(new CustomErrorType("User with id " + id
                + " not found"), HttpStatus.NOT_FOUND);
    }
    user.setAnswers(null);
    user.setQuestions(null);
    user.setPassword(null);
    return new ResponseEntity<User>(user, HttpStatus.OK);
}
 
开发者ID:noveogroup-amorgunov,项目名称:spring-mvc-react,代码行数:14,代码来源:UserController.java

示例6: updateEngine

/**
 * Updates the Engine configuration for a bot.
 *
 * @param user         the authenticated user making the request.
 * @param engineConfig the Engine config to update.
 * @param botId        the id of the Bot to update the Engine config for.
 * @return 200 'Ok' HTTP status code with updated Engine config if update successful, some other HTTP status code otherwise.
 */
@PreAuthorize("hasRole('ADMIN')")
@RequestMapping(value = "/{botId}" + ENGINE_RESOURCE_PATH, method = RequestMethod.PUT)
public ResponseEntity<?> updateEngine(@AuthenticationPrincipal User user, @RequestBody EngineConfig engineConfig,
                                      @PathVariable String botId) {

    LOG.info("PUT " + CONFIG_ENDPOINT_BASE_URI + botId + ENGINE_RESOURCE_PATH + " - updateEngine() "); //- caller: " + user.getUsername());
    LOG.info("Request: " + engineConfig);

    final EngineConfig updatedConfig = engineConfigService.updateEngineConfig(botId, engineConfig);
    return updatedConfig == null
            ? new ResponseEntity<>(HttpStatus.NOT_FOUND)
            : buildResponseEntity(updatedConfig, HttpStatus.OK);
}
 
开发者ID:gazbert,项目名称:bxbot-ui-server,代码行数:21,代码来源:EngineConfigController.java

示例7: getUpdatedDate

public Date getUpdatedDate() {
    try {
        return restTemplate.getForObject(mirrorGateUrl + MIRROR_GATE_COLLECTOR_ENDPOINT, Date.class, appName);
    }
    catch (final HttpClientErrorException e) {
        if(e.getStatusCode() == HttpStatus.NOT_FOUND) {
            LOGGER.info("Not previous execution date found. Running from the very beginning so this could take a while");
            return null;
        } else {
            LOGGER.error("Error requesting previous collector status", e);
            throw e;
        }
    }
}
 
开发者ID:BBVA,项目名称:mirrorgate-jira-stories-collector,代码行数:14,代码来源:CollectorService.java

示例8: getBucket

@RequestMapping(value = "/api/buckets/{bucketName}", method = RequestMethod.GET)
public
@ResponseBody
ResponseEntity<BucketDto> getBucket(@PathVariable("bucketName") String bucketName)
{
	BucketDto bucket = this.consumeBucketBusinessService.consume(bucketName);
	if (bucket == null)
	{
		return new ResponseEntity<>(HttpStatus.NOT_FOUND);
	}

	return new ResponseEntity<>(bucket, HttpStatus.OK);
}
 
开发者ID:tmply,项目名称:tmply,代码行数:13,代码来源:BucketResource.java

示例9: settingsPictureTokenGet

@Override  
    public ResponseEntity<Object> settingsPictureTokenGet(@RequestParam(value = "token", required = false) String token) throws ApiException{ 
     
//        System.out.println("token:" + token);
        
        if(token==null || token.trim().length()==0){
            //throw new ApiException(403, "Invalid token");
            return new ResponseEntity<>(HttpStatus.FORBIDDEN);
        }
        
        Long clientUserId = 0L;
        try{
            Claims claims = JwtCodec.decode(token);
            clientUserId = Long.parseLong(claims.getSubject());
        } catch(JwtException e){
            //throw new ApiException(403, "Access denied");
            return new ResponseEntity<>(HttpStatus.FORBIDDEN);
        } 
        
        com.jrtechnologies.yum.data.entity.User userDAO = userRepo.findById(clientUserId);               
        
        if(!userDAO.hasPicture()){
            //throw new ApiException(404, "No picture");
            return new ResponseEntity<>(HttpStatus.NOT_FOUND);
        }
        
        ByteArrayInputStream inputStream = new ByteArrayInputStream(userDAO.getPicture());        
        
        return ResponseEntity
        .ok()
        .contentLength(userDAO.getPictureLength())
        .contentType(MediaType.parseMediaType("image/jpeg"))
        .body(new InputStreamResource(inputStream));
        
    }
 
开发者ID:jrtechnologies,项目名称:yum,代码行数:35,代码来源:SettingsApiController.java

示例10: getRequestByOrderAndUser

@RequestMapping(value = "/order/{order_id}/user/{user_id}", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<?> getRequestByOrderAndUser(@PathVariable("order_id") long orderId,
                                                  @PathVariable("user_id") long userId) {
    LOGGER.info("Start getRequestByOrderAndUser");
    Request request = requestService.findByOrderIdAndCourierId(orderId, userId);

    if (request == null) {
        LOGGER.error("Request {} is not found");
        return new ResponseEntity<>("Request not found", HttpStatus.NOT_FOUND);
    }

    RequestDto requestDto = RequestDto.toDto(request);
    return new ResponseEntity<>(requestDto, HttpStatus.OK);
}
 
开发者ID:atereshkov,项目名称:Diber-backend,代码行数:15,代码来源:RequestController.java

示例11: handleNotImplementedException

@ExceptionHandler(NotFoundException.class)
@ResponseStatus(value = HttpStatus.NOT_FOUND)
@ResponseBody
public XAPIErrorInfo handleNotImplementedException(final HttpServletRequest request, final NotFoundException e) {
    final XAPIErrorInfo result = new XAPIErrorInfo(HttpStatus.NOT_FOUND, request, e.getLocalizedMessage());
    this.logException(e);
    this.logError(result);
    return result;
}
 
开发者ID:Apereo-Learning-Analytics-Initiative,项目名称:OpenLRW,代码行数:9,代码来源:XAPIExceptionHandlerAdvice.java

示例12: findById

public Game findById(long gameId) {
    GameEntity result = gameRepository.findOne(gameId);
    if (result == null) {
        throw new HttpClientErrorException(HttpStatus.NOT_FOUND);
    }
    return gameTranslator.translate(result);
}
 
开发者ID:MannanM,项目名称:corporate-game-share,代码行数:7,代码来源:GameService.java

示例13: createPerson

@RequestMapping(value = "/person", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Person> createPerson(@RequestBody Person person) {
	person.setId(null);
	Person current = service.createPerson(person);
	if (null != current) {
		return new ResponseEntity<Person>(person, HttpStatus.OK);
	}
	return new ResponseEntity<Person>(HttpStatus.NOT_FOUND);
}
 
开发者ID:appNG,项目名称:appng-examples,代码行数:9,代码来源:PersonRestService.java

示例14: requestHandlingNoHandlerFound

@ExceptionHandler(NoHandlerFoundException.class)
@ResponseStatus(HttpStatus.NOT_FOUND)
public Map<String,String> requestHandlingNoHandlerFound() {
    Map message = new HashMap();
    message.put("error","router is not exists");
    return message;
}
 
开发者ID:Nbsaw,项目名称:miaohu,代码行数:7,代码来源:GlobalExceptionAdvice.java

示例15: deleteStrategy

/**
 * Deletes a Strategy configuration for a given id.
 *
 * @param user       the authenticated user.
 * @param botId      the id of the Bot to delete the Strategy config for.
 * @param strategyId the id of the Strategy configuration to delete.
 * @return 204 'No Content' HTTP status code if delete successful, some other HTTP status code otherwise.
 */
@PreAuthorize("hasRole('ADMIN')")
@RequestMapping(value = "/{botId}" + STRATEGIES_RESOURCE_PATH + "/{strategyId}", method = RequestMethod.DELETE)
public ResponseEntity<?> deleteStrategy(@AuthenticationPrincipal User user, @PathVariable String botId,
                                        @PathVariable String strategyId) {

    LOG.info("DELETE " + CONFIG_ENDPOINT_BASE_URI + botId + STRATEGIES_RESOURCE_PATH + "/" + strategyId +" - deleteStrategy()"); // - caller: " + user.getUsername());

    final boolean result = strategyConfigService.deleteStrategyConfig(botId, strategyId);
    return !result
            ? new ResponseEntity<>(HttpStatus.NOT_FOUND)
            : new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
 
开发者ID:gazbert,项目名称:bxbot-ui-server,代码行数:20,代码来源:StrategiesConfigController.java


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