久しぶりに、ZIP 版が生きてましたw
Final は1月末みたいですね。
https://issues.jboss.org/browse/WFLY?selectedTab=com.atlassian.jira.plugin.system.project%3Aroadmap-panel&_sscc=t
@Provider□JBoss AS 7.1.x & RESTEasy 2.3.x
public class ValidationExceptionHandler implements
ExceptionMapper<ResteasyViolationException> {
@Override
@Produces(MediaType.APPLICATION_JSON)
public Response toResponse(ResteasyViolationException exception) {
ValidateMessage errors = new ValidateMessage();
for (ResteasyConstraintViolation violation : exception.getViolations()) {
errors.getMessages().add(
new Message(String.format("%s:%s:%s:%s", violation
.getPath(), violation.getConstraintType().name(),
violation.getValue(), violation.getMessage())));
}
return Response.status(Status.BAD_REQUEST).entity(errors).build();
}
}
@Provider
public class ValidationExceptionHandler implements
ExceptionMapper<MethodConstraintViolationException> {
@Override
@Produces({ MediaType.APPLICATION_JSON })
public Response toResponse(MethodConstraintViolationException ex) {
ValidateMessage errors = new ValidateMessage();
for (MethodConstraintViolation<?> violation : ex
.getConstraintViolations()) {
errors.getMessages().add(
new Message(String.format("%s:%s:%s:%s", violation
.getMethod().getName(), violation
.getParameterName(), violation.getInvalidValue(),
violation.getMessage())));
}
return Response.status(Status.BAD_REQUEST).entity(errors).build();
}
}
@XmlRootElement(name = "validate_message")
public class ValidateMessage implements Serializable {
private static final long serialVersionUID = 1L;
private List<Message> messages = new ArrayList<Message>();
public static class Message {
private String message;
public Message() {
}
public Message(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
@XmlElementWrapper(name = "messages")
@XmlElement(name = "message")
public List<Message> getMessages() {
return messages;
}
public void setMessages(List<Message> messages) {
this.messages = messages;
}
}
<dependency>□pom.xml(RESTEasy 2.3.x)
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-validator-provider-11</artifactId>
<version>3.0.4.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-hibernatevalidator-provider</artifactId>
<version>2.3.7.Final</version>
</dependency>
$ cd /path/to
$ git clone https://github.com/wildfly/wildfly.git
$ cd wildfly
$ git tag
7.0.0.Alpha1
7.0.0.Alpha1-final
7.0.0.Beta1
7.0.0.Beta1-prerelease
7.0.0.Beta2
7.0.0.Beta2-prerelease
7.0.0.Beta3
7.0.0.CR1
7.0.0.Final
7.0.0.Final-prerelease
7.0.0.Final-prerelease2
7.0.0.Final-prerelease3
7.0.1.Final
7.0.2.Final
7.0.2.Final-prerelease
7.0.2.SP1-prerelease
7.1.0.Alpha1
7.1.0.Beta1
7.1.0.Beta1b
7.1.0.Beta1b-prerelease
7.1.0.CR1
7.1.0.CR1b
7.1.0.Final
7.1.0.Final-prerelease
7.1.0.Final-prerelease2
7.1.1.Final
7.1.2-prerelease
7.1.2.Final
7.1.3.Beta1
7.1.3.CR1
7.1.3.Final
7.2.0.Final
7.2.0.Final-prerelease1
7.2.0.Final-testsuite-fix
8.0.0.Alpha1
$ git checkout -b new 8.0.0.Alpha1
$ JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386 ./build.sh -DskipTests
$ mv build/target/wildfly-8.0.0.Alpha1/ /usr/local/jboss/
$ cd /usr/local/jboss/wildfly-8.0.0.Alpha1
$ JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386 ./standalone.sh
15:40:49,486 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.0.0.Alpha1 "WildFly" started in 5917ms - Started 154 of 191 services (57 services are lazy, passive or on-demand)