Example usage for org.springframework.http HttpStatus FORBIDDEN

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

Introduction

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

Prototype

HttpStatus FORBIDDEN

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

Click Source Link

Document

403 Forbidden .

Usage

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

@Test
public void report_accessDenied() {
    given().contentType(ContentType.JSON).accept(MEDIA_TYPE_EXCEL)
            .header(authorization(devHelper.login(apiUser.username).token)).body(new ReportParameters()).when()
            .post(UrlSchema.REPORT, "FacilityUsage").then().assertThat()
            .statusCode(HttpStatus.FORBIDDEN.value());
}

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

public UserNotAuthorizedException() {
    super(null, "NOT_AUTHORIZED");
    httpStatus = HttpStatus.FORBIDDEN;
}

From source file:com.tkmtwo.exhandler.handlers.AccessDeniedExceptionHandler.java

public AccessDeniedExceptionHandler() {
    super(HttpStatus.FORBIDDEN);
}

From source file:org.trustedanalytics.utils.errorhandling.ErrorFormatterTest.java

@Test
public void formattedTextContainsHttpStatusReason() throws Exception {
    String formatted = ErrorFormatter.formatErrorMessage(HttpStatus.FORBIDDEN, 123L);

    Assert.assertNotNull(formatted);//www .j av a 2  s .com
    Assert.assertTrue(formatted.toLowerCase().contains("Forbidden".toLowerCase()));
    Assert.assertTrue(formatted.contains("123"));
}

From source file:io.kahu.hawaii.util.exception.AuthenticationException.java

@Override
public HttpStatus getStatus() {
    return HttpStatus.FORBIDDEN; // 403
}

From source file:io.fabric8.che.starter.exception.GlobalExceptionHandler.java

@ResponseStatus(value = HttpStatus.FORBIDDEN)
@ExceptionHandler(KubernetesClientException.class)
public String handleKubernetesClientException(KubernetesClientException e) {
    return e.getMessage();
}

From source file:fr.esiea.windmeal.service.exception.NotPermitException.java

public NotPermitException() {
    super(HttpStatus.FORBIDDEN.value(), "This server is not vulnerable");
}

From source file:runtheshow.resource.BootTests.java

@Test
public void resourceProtected() {
    ResponseEntity<String> response = template.getForEntity("http://localhost:" + port + "/user/current",
            String.class);
    assertEquals(HttpStatus.FORBIDDEN, response.getStatusCode());
}

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));
}

From source file:com.hillert.botanic.controller.BotanicControllerAdvice.java

@ExceptionHandler(value = AuthenticationException.class)
@ResponseStatus(HttpStatus.FORBIDDEN)
@ResponseBody/*from   w  ww .  ja  v  a2s. c  om*/
public ErrorMessage handleAuthenticationException(Exception e) {
    return new ErrorMessage(new Date(), HttpStatus.FORBIDDEN.value(), e.getClass().getName(), e.getMessage());
}