Example usage for org.springframework.http HttpStatus NOT_FOUND

List of usage examples for org.springframework.http HttpStatus NOT_FOUND

Introduction

In this page you can find the example usage for org.springframework.http HttpStatus NOT_FOUND.

Prototype

HttpStatus NOT_FOUND

To view the source code for org.springframework.http HttpStatus NOT_FOUND.

Click Source Link

Document

404 Not Found .

Usage

From source file:io.ignitr.dispatchr.manager.core.error.TopicNotFoundException.java

/**
 * Initializes this instance of {@link TopicNotFoundException}.
 *
 * @param topicName name of the topic/*from   w  w  w.  j av a 2  s  .  c om*/
 */
public TopicNotFoundException(String topicName) {
    super(HttpStatus.NOT_FOUND, "Topic, '" + topicName + "', does not exist!", ErrorCode.TOPIC_NOT_FOUND);
}

From source file:org.cloudifysource.rest.util.NotFoundHttpException.java

public NotFoundHttpException(String message) {
    super(HttpStatus.NOT_FOUND, message);
}

From source file:com.ugam.collage.plus.controller.ExceptionHandlerController.java

@ResponseStatus(HttpStatus.NOT_FOUND)
public String resourceNotFoundException() {

    return "error-bad-request";
}

From source file:fi.hsl.parkandride.itest.ErrorHandlingITest.java

@Test
public void non_existing_resource_is_communicated_with_status_code_only() {
    when().get(UrlSchema.FACILITIES + "/42").then().statusCode(HttpStatus.NOT_FOUND.value()).body(is(""));
}

From source file:fr.olympicinsa.riocognized.exception.MyExceptionHandler.java

@ExceptionHandler(EmptyResultDataAccessException.class)
@ResponseBody//www . j  a  v a2  s  . c o m
@ResponseStatus(HttpStatus.NOT_FOUND)
public ErrorMessage handleResourceNotFoundException(EmptyResultDataAccessException e, HttpServletRequest req) {
    return new ErrorMessage("ATHLETE_NOT_FOUND");
}

From source file:de.codecentric.boot.admin.actuate.LogfileMvcEndpointTest.java

@Test
public void logfile_noProperty() throws IOException {
    assertEquals(HttpStatus.NOT_FOUND, controller.available().getStatusCode());

    MockHttpServletResponse response = new MockHttpServletResponse();
    controller.invoke(response);/* w w  w  . j a  va  2 s .  co  m*/
    assertEquals(HttpStatus.NOT_FOUND.value(), response.getStatus());
}

From source file:de.hska.ld.core.exception.NotFoundException.java

public NotFoundException() {
    super(null, "NOT_FOUND");
    httpStatus = HttpStatus.NOT_FOUND;
}

From source file:bookmarks.BookmarkControllerAdvice.java

@ResponseBody
@ExceptionHandler(UserNotFoundException.class)
@ResponseStatus(HttpStatus.NOT_FOUND)
VndErrors userNotFoundExceptionHandler(UserNotFoundException ex) {
    return new VndErrors("error", ex.getMessage());
}

From source file:io.github.jhipster.web.util.ResponseUtil.java

/**
 * Wrap the optional into a {@link ResponseEntity} with an {@link HttpStatus#OK} status with the headers,
 * or if it's empty, it returns a {@link ResponseEntity} with {@link HttpStatus#NOT_FOUND}.
 *
 * @param <X>           type of the response
 * @param maybeResponse response to return if present
 * @param header        headers to be added to the response
 * @return response containing {@code maybeResponse} if present or {@link HttpStatus#NOT_FOUND}
 *///from   w w w  . j  av a  2 s  . c  o  m
public static <X> ResponseEntity<X> wrapOrNotFound(Optional<X> maybeResponse, HttpHeaders header) {
    return maybeResponse.map(response -> ResponseEntity.ok().headers(header).body(response))
            .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
}

From source file:org.camunda.bpm.spring.boot.starter.webapp.WebappTest.java

@Test
public void testLicenseEndpointNotAvailable() throws Exception {
    final ResponseEntity<String> response = testRestTemplate.getForEntity(
            "http://localhost:" + this.port + "/api/admin/plugin/license/default/key", String.class);

    assertEquals(HttpStatus.NOT_FOUND, response.getStatusCode());
}