Example usage for javax.servlet.http HttpServletResponse sendError

List of usage examples for javax.servlet.http HttpServletResponse sendError

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletResponse sendError.

Prototype

public void sendError(int sc, String msg) throws IOException;

Source Link

Document

Sends an error response to the client using the specified status and clears the buffer.

Usage

From source file:com.br.helpdesk.controller.UserGroupController.java

@ExceptionHandler(DataIntegrityViolationException.class)
public void handleDataIntegrityViolationException(DataIntegrityViolationException ex,
        HttpServletResponse response) throws IOException {
    response.sendError(HttpServletResponse.SC_FORBIDDEN, ex.getMessage());
}

From source file:ch.wisv.areafiftylan.security.RESTAuthenticationEntryPoint.java

@Override
public void commence(HttpServletRequest request, HttpServletResponse response,
        AuthenticationException authException) throws IOException, ServletException {
    response.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException.getMessage());
}

From source file:net.maritimecloud.identityregistry.security.RestAuthenticationEntryPoint.java

@Override
public void commence(HttpServletRequest request, HttpServletResponse responce,
        AuthenticationException exception) throws IOException, ServletException {
    responce.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized");

}

From source file:org.apigw.authserver.shibboleth.ShibbolethSamlEntryPoint.java

@Override
public void commence(HttpServletRequest request, HttpServletResponse response,
        AuthenticationException authException) throws IOException, ServletException {
    response.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException.getMessage()); //TODO: make something better?
}

From source file:org.cbioportal.session_service.web.SessionServiceController.java

@ExceptionHandler
public void handleSessionInvalid(SessionInvalidException e, HttpServletResponse response) throws IOException {
    response.sendError(HttpStatus.BAD_REQUEST.value(), e.getMessage());
}

From source file:com.github.iexel.fontus.web.security.RestAuthenticationEntryPoint.java

@Override
public void commence(HttpServletRequest request, HttpServletResponse response,
        AuthenticationException authException) throws IOException, ServletException {

    response.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException.getMessage());
}

From source file:nl.flotsam.calendar.web.CalendarController.java

@ExceptionHandler(URISyntaxException.class)
public void handleURISyntaxException(HttpServletResponse response) throws IOException {
    response.sendError(HttpStatus.BAD_REQUEST.value(), "Invalid URI passed as a parameter.");
}

From source file:com.ram.topup.api.ws.security.filter.UnauthorizedEntryPoint.java

@Override
public void commence(HttpServletRequest request, HttpServletResponse response,
        AuthenticationException authException) throws IOException, ServletException {

    response.sendError(HttpServletResponse.SC_UNAUTHORIZED,
            "Unauthorized: Authentication token was either missing or invalid.");
}

From source file:uk.ac.ebi.eva.server.ws.ga4gh.GA4GHVariantCallSetWSServer.java

@ExceptionHandler(IllegalArgumentException.class)
public void handleException(IllegalArgumentException e, HttpServletResponse response) throws IOException {
    response.sendError(HttpStatus.BAD_REQUEST.value(), e.getMessage());
}

From source file:fr.mycellar.interfaces.web.security.RestAuthenticationEntryPoint.java

@Override
public void commence(HttpServletRequest request, HttpServletResponse response,
        AuthenticationException authException) throws IOException, ServletException {
    response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized");
}