Search in sources :

Example 1 with CAJsonResponse

use of io.hops.hopsworks.ca.api.exception.mapper.CAJsonResponse in project hopsworks by logicalclocks.

the class NoCacheResponse method buildJsonResponse.

public CAJsonResponse buildJsonResponse(Response.Status status, String message) {
    CAJsonResponse response = new CAJsonResponse();
    response.setSuccessMessage(message);
    return response;
}
Also used : CAJsonResponse(io.hops.hopsworks.ca.api.exception.mapper.CAJsonResponse)

Example 2 with CAJsonResponse

use of io.hops.hopsworks.ca.api.exception.mapper.CAJsonResponse in project hopsworks by logicalclocks.

the class AuthFilter method responseEntity.

@Override
public Object responseEntity(Response.Status status, String msg) {
    JsonResponse jsonResponse = new CAJsonResponse();
    if (null == status) {
        jsonResponse.setErrorCode(RESTCodes.GenericErrorCode.UNKNOWN_ERROR.getCode());
    } else {
        switch(status) {
            case UNAUTHORIZED:
                jsonResponse.setErrorCode(RESTCodes.SecurityErrorCode.EJB_ACCESS_LOCAL.getCode());
                break;
            case FORBIDDEN:
                jsonResponse.setErrorCode(RESTCodes.SecurityErrorCode.REST_ACCESS_CONTROL.getCode());
                break;
            default:
                jsonResponse.setErrorCode(RESTCodes.GenericErrorCode.UNKNOWN_ERROR.getCode());
                break;
        }
    }
    jsonResponse.setErrorMsg(msg);
    return jsonResponse;
}
Also used : CAJsonResponse(io.hops.hopsworks.ca.api.exception.mapper.CAJsonResponse) CAJsonResponse(io.hops.hopsworks.ca.api.exception.mapper.CAJsonResponse) JsonResponse(io.hops.hopsworks.restutils.JsonResponse)

Example 3 with CAJsonResponse

use of io.hops.hopsworks.ca.api.exception.mapper.CAJsonResponse in project hopsworks by logicalclocks.

the class CAException method buildJsonResponse.

@Override
public CAJsonResponse buildJsonResponse(JsonResponse jsonResponse, RESTLogLevel logLevel) {
    CAJsonResponse caJsonResponse = (CAJsonResponse) super.buildJsonResponse(jsonResponse, logLevel);
    caJsonResponse.setCertificateType(certType);
    return caJsonResponse;
}
Also used : CAJsonResponse(io.hops.hopsworks.ca.api.exception.mapper.CAJsonResponse)

Aggregations

CAJsonResponse (io.hops.hopsworks.ca.api.exception.mapper.CAJsonResponse)3 JsonResponse (io.hops.hopsworks.restutils.JsonResponse)1