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:org.cloudfoundry.maven.Delete.java

@Override
protected void doExecute() throws MojoExecutionException {
    getLog().info("Deleting application '" + getAppname() + "'");

    try {/*from  ww w.ja va 2  s .c  o m*/
        getClient().getApplication(getAppname());
        getClient().deleteApplication(getAppname());
    } catch (CloudFoundryException e) {
        if (HttpStatus.NOT_FOUND.equals(e.getStatusCode())) {
            getLog().info("Application '" + getAppname() + "' does not exist");
        } else {
            throw new MojoExecutionException(String.format(
                    "Error while deleting application '%s'. Error message: '%s'. Description: '%s'",
                    getAppname(), e.getMessage(), e.getDescription()), e);
        }
    }
}

From source file:nl.pinniq.web.controller.ExceptionController.java

@ExceptionHandler(NoHandlerFoundException.class)
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public ModelAndView handleNoHandlerFoundException(NoHandlerFoundException ex) {
    Map<String, Object> m = new HashMap<String, Object>();
    m.put("exception", ex);
    m.put("errorcode", "404");
    m.put("url", request.getRequestURL().toString());
    ModelAndView mav = new ModelAndView(DEFAULT_ERROR_VIEW, "model", m);
    return mav;/*from  www. j a v  a2 s  .  c  o m*/
}

From source file:org.schedoscope.metascope.config.ServletContainerCusomizerConfiguration.java

@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    return new EmbeddedServletContainerCustomizer() {
        @Override/* w w w  . j  a  v a  2 s .  c o  m*/
        public void customize(ConfigurableEmbeddedServletContainer container) {
            ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/notfound");
            container.addErrorPages(error404Page);
        }
    };
}

From source file:io.springagora.store.rest.controllers.RestExceptionHandlerAdvice.java

@ResponseBody
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(value = EntityNotFoundException.class)
public ErrorResponse entityNotFound(EntityNotFoundException exception, WebRequest request) {
    ErrorResponse response = new ErrorResponse(exception.ERROR_CODE, exception.getMessage());
    return response;
}

From source file:com.castlemock.web.basis.web.mvc.controller.error.ErrorComponent.java

@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {

    return new EmbeddedServletContainerCustomizer() {
        @Override//from w  w w.  j a v a 2 s  .com
        public void customize(ConfigurableEmbeddedServletContainer container) {
            ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/web/error/404");

            container.addErrorPages(error404Page);
        }
    };
}

From source file:org.grails.datastore.mapping.riak.util.Ignore404sErrorHandler.java

@Override
public void handleError(ClientHttpResponse response) throws IOException {
    // Ignore 404s entirely
    if (response.getStatusCode() != HttpStatus.NOT_FOUND) {
        super.handleError(response);
    }//from  w  ww.  j  a v  a2 s  .co m
}

From source file:org.ff4j.spring.boot.exceptions.FF4jExceptionHandler.java

@ExceptionHandler(value = FeatureNotFoundException.class)
@ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "feature not found")
public void featureNotFoundException() {
    // Not necessary to handle this exception
}

From source file:fr.esiea.windmeal.controller.exception.security.NotConnectedException.java

public NotConnectedException() {
    /*
      * Best status to return if not connected but can be discussed
      */
    super(HttpStatus.NOT_FOUND.value(), null);
}

From source file:fr.esiea.esieaddress.service.exception.security.NotConnectedException.java

public NotConnectedException() {
    super(HttpStatus.NOT_FOUND.value(), Collections.EMPTY_MAP);
}

From source file:ru.mystamps.web.support.spring.boot.ErrorPagesServletContainerCustomizer.java

@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    container.addErrorPages(new ErrorPage(HttpStatus.FORBIDDEN, Url.FORBIDDEN_PAGE));
    container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, Url.NOT_FOUND_PAGE));
    container.addErrorPages(new ErrorPage(Exception.class, Url.INTERNAL_ERROR_PAGE));
}