/** * New constructor * * @param container violation container * @param accept list of accept media types */ public ResteasyViolationException(final SimpleViolationsContainer container, final List<MediaType> accept) { this(container.getViolations(), accept); setException(container.getException()); }
public List<ResteasyConstraintViolation> getPropertyViolations() { convertViolations(); return propertyViolations; }
/** * @return String representation of violation */ public String toString() { return "[" + type() + "]\r[" + path + "]\r[" + message + "]\r[" + value + "]\r"; }
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(); }
public int size() { return getViolations().size(); }
protected ResteasyConstraintViolation convertViolation(ConstraintViolation<?> violation) { Type ct = util.getConstraintType(violation); String path = (suppressPath ? "*" : violation.getPropertyPath().toString()); return new ResteasyConstraintViolation(ct, path, violation.getMessage(), convertArrayToString(violation.getInvalidValue())); }
public ResteasyViolationException(final String stringRep) { super(null); checkSuppressPath(); convertFromString(stringRep); }
/** * New constructor * * @param constraintViolations set of constraint violations * @param accept list of accept media types */ public ResteasyViolationException(final Set<? extends ConstraintViolation<?>> constraintViolations, final List<MediaType> accept) { super(constraintViolations); checkSuppressPath(); this.accept = toCloneableMediaTypeList(accept); }
/** * @return String form of violation type */ public String type() { return constraintType.toString(); }
public void setException(Exception exception) { this.exception = exception; initCause(exception); }
public List<MediaType> getAccept() { return toMediaTypeList(accept); }
public void setAccept(List<MediaType> accept) { this.accept = toCloneableMediaTypeList(accept); }
protected String unwrapException(Throwable t) { StringBuffer sb = new StringBuffer(); doUnwrapException(sb, t); return sb.toString(); }
public SimpleViolationsContainer(final Set<ConstraintViolation<Object>> cvs) { addViolations(cvs); }
/** * New constructor * * @param container violation container */ public ResteasyViolationException(final SimpleViolationsContainer container) { this(container.getViolations()); setException(container.getException()); }
public List<ResteasyConstraintViolation> getParameterViolations() { convertViolations(); return parameterViolations; }
public List<ResteasyConstraintViolation> getFieldViolations() { convertViolations(); return fieldViolations; }
public List<ResteasyConstraintViolation> getReturnValueViolations() { convertViolations(); return returnValueViolations; }
public List<ResteasyConstraintViolation> getClassViolations() { convertViolations(); return classViolations; }
public List<List<ResteasyConstraintViolation>> getViolationLists() { convertViolations(); return violationLists; }