return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); if (e != null) return buildResponse(unwrapException(e), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); return buildViolationReportResponse(resteasyViolationException, Status.BAD_REQUEST); return buildViolationReportResponse(resteasyViolationException, Status.INTERNAL_SERVER_ERROR); return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR);
protected String unwrapException(Throwable t) { StringBuffer sb = new StringBuffer(); doUnwrapException(sb, t); return sb.toString(); }
protected Response buildViolationReportResponse(ResteasyViolationException exception, Status status) { ResponseBuilder builder = Response.status(status); builder.header(Validation.VALIDATION_HEADER, "true"); // Check standard media types. MediaType mediaType = getAcceptMediaType(exception.getAccept()); if (mediaType != null) { builder.type(mediaType); builder.entity(new ViolationReport(exception)); return builder.build(); } // Default media type. builder.type(MediaType.TEXT_PLAIN); builder.entity(exception.toString()); return builder.build(); }
return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); if (e != null) return buildResponse(unwrapException(e), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); return buildViolationReportResponse(resteasyViolationException, Status.BAD_REQUEST); return buildViolationReportResponse(resteasyViolationException, Status.INTERNAL_SERVER_ERROR); return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR);
private void doUnwrapException(StringBuffer sb, Throwable t) { if (t == null) { return; } sb.append(t.toString()); if (t.getCause() != null && t != t.getCause()) { sb.append('['); doUnwrapException(sb, t.getCause()); sb.append(']'); } }
protected Response buildViolationReportResponse(ResteasyViolationException exception, Status status) { ResponseBuilder builder = Response.status(status); builder.header(Validation.VALIDATION_HEADER, "true"); // Check standard media types. MediaType mediaType = getAcceptMediaType(exception.getAccept()); if (mediaType != null) { builder.type(mediaType); builder.entity(new ViolationReport(exception)); return builder.build(); } // Default media type. builder.type(MediaType.TEXT_PLAIN); builder.entity(exception.toString()); return builder.build(); }
return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); if (e != null) return buildResponse(unwrapException(e), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR); return buildViolationReportResponse(resteasyViolationException, Status.BAD_REQUEST); return buildViolationReportResponse(resteasyViolationException, Status.INTERNAL_SERVER_ERROR); return buildResponse(unwrapException(exception), MediaType.TEXT_PLAIN, Status.INTERNAL_SERVER_ERROR);
protected String unwrapException(Throwable t) { StringBuffer sb = new StringBuffer(); doUnwrapException(sb, t); return sb.toString(); }
protected Response buildViolationReportResponse(ResteasyViolationException exception, Status status) { ResponseBuilder builder = Response.status(status); builder.header(Validation.VALIDATION_HEADER, "true"); // Check standard media types. MediaType mediaType = getAcceptMediaType(exception.getAccept()); if (mediaType != null) { builder.type(mediaType); builder.entity(new ViolationReport(exception)); return builder.build(); } // Default media type. builder.type(MediaType.TEXT_PLAIN); builder.entity(exception.toString()); return builder.build(); }
protected String unwrapException(Throwable t) { StringBuffer sb = new StringBuffer(); doUnwrapException(sb, t); return sb.toString(); }
private void doUnwrapException(StringBuffer sb, Throwable t) { if (t == null) { return; } sb.append(t.toString()); if (t.getCause() != null && t != t.getCause()) { sb.append('['); doUnwrapException(sb, t.getCause()); sb.append(']'); } }
private void doUnwrapException(StringBuffer sb, Throwable t) { if (t == null) { return; } sb.append(t.toString()); if (t.getCause() != null && t != t.getCause()) { sb.append('['); doUnwrapException(sb, t.getCause()); sb.append(']'); } }