Example usage for org.springframework.http ResponseEntity notFound

List of usage examples for org.springframework.http ResponseEntity notFound

Introduction

In this page you can find the example usage for org.springframework.http ResponseEntity notFound.

Prototype

public static HeadersBuilder<?> notFound() 

Source Link

Document

Create a builder with a HttpStatus#NOT_FOUND NOT_FOUND status.

Usage

From source file:org.springframework.cloud.gateway.actuate.GatewayControllerEndpoint.java

@GetMapping("/routes/{id}")
public Mono<ResponseEntity<RouteDefinition>> route(@PathVariable String id) {
    // TODO: missing RouteLocator
    return this.routeDefinitionLocator.getRouteDefinitions().filter(route -> route.getId().equals(id))
            .singleOrEmpty().map(ResponseEntity::ok)
            .switchIfEmpty(Mono.just(ResponseEntity.notFound().build()));
}

From source file:org.springframework.cloud.gateway.actuate.GatewayEndpoint.java

@DeleteMapping("/routes/{id}")
public Mono<ResponseEntity<Object>> delete(@PathVariable String id) {
    return this.routeWriter.delete(Mono.just(id)).then(() -> Mono.just(ResponseEntity.ok().build()))
            .otherwise(t -> t instanceof NotFoundException, t -> Mono.just(ResponseEntity.notFound().build()));
}

From source file:org.springframework.cloud.gateway.actuate.GatewayEndpoint.java

@GetMapping("/routes/{id}")
public Mono<ResponseEntity<Route>> route(@PathVariable String id) {
    return this.routeLocator.getRoutes().filter(route -> route.getId().equals(id)).singleOrEmpty()
            .map(route -> ResponseEntity.ok(route))
            .otherwiseIfEmpty(Mono.just(ResponseEntity.notFound().build()));
}

From source file:org.talend.dataprep.preparation.service.PreparationService.java

public ResponseEntity<Void> preparationsThatUseDataset(final String datasetId) {
    final boolean preparationUseDataSet = preparationRepository.exist(Preparation.class,
            "dataSetId = '" + datasetId + "'");
    final boolean dataSetUsedInLookup = isDatasetUsedToLookupInPreparationHead(datasetId);
    if (!preparationUseDataSet && !dataSetUsedInLookup) {
        return ResponseEntity.notFound().build();
    }//from w ww  . j  a  v  a  2 s.co m
    return ResponseEntity.noContent().build();
}