use of org.ovirt.engine.api.v3.types.V3UsageMessage in project ovirt-engine by oVirt.
the class V3UsageFinder method getUsageMessage.
public V3UsageMessage getUsageMessage(UriInfo uriInfo, Request request) throws ClassNotFoundException, IOException {
V3UsageMessage usage = new V3UsageMessage();
usage.setMessage(RESPONSE);
usage.setDetailedLink(findUsage(uriInfo, request.getMethod()));
return usage;
}
use of org.ovirt.engine.api.v3.types.V3UsageMessage in project ovirt-engine by oVirt.
the class V3IOExceptionMapper method toResponse.
@Override
public Response toResponse(IOException exception) {
// Check if the cause of the exception is an invalid value, and generate a specific error message:
Throwable cause = exception.getCause();
if (cause instanceof InvalidValueException) {
V3Fault fault = new V3Fault();
fault.setReason("Invalid value");
fault.setDetail(cause.getMessage());
return Response.status(Status.BAD_REQUEST).entity(fault).build();
}
// the request:
try {
log.error("IO exception while processing \"{}\" request for path \"{}\"", request.getMethod(), uriInfo.getPath());
log.error("Exception", exception);
V3UsageFinder finder = new V3UsageFinder();
V3UsageMessage usage = finder.getUsageMessage(uriInfo, request);
return Response.status(Status.BAD_REQUEST).entity(usage).build();
} catch (Exception error) {
throw new WebApplicationException(error, Response.status(Status.INTERNAL_SERVER_ERROR).build());
}
}
Aggregations