[seam-commits] Seam SVN: r13082 - in modules: resteasy and 40 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Tue Jun 8 09:31:39 EDT 2010
Author: jharting
Date: 2010-06-08 09:31:37 -0400 (Tue, 08 Jun 2010)
New Revision: 13082
Added:
modules/resteasy/
modules/resteasy/branches/
modules/resteasy/tags/
modules/resteasy/trunk/
modules/resteasy/trunk/api/
modules/resteasy/trunk/api/pom.xml
modules/resteasy/trunk/api/src/
modules/resteasy/trunk/api/src/main/
modules/resteasy/trunk/api/src/main/java/
modules/resteasy/trunk/api/src/main/java/org/
modules/resteasy/trunk/api/src/main/java/org/jboss/
modules/resteasy/trunk/api/src/main/java/org/jboss/seam/
modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/
modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/
modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyConfiguration.java
modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/validation/
modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/validation/ValidateRequest.java
modules/resteasy/trunk/api/src/main/resources/
modules/resteasy/trunk/impl/
modules/resteasy/trunk/impl/pom.xml
modules/resteasy/trunk/impl/src/
modules/resteasy/trunk/impl/src/main/
modules/resteasy/trunk/impl/src/main/java/
modules/resteasy/trunk/impl/src/main/java/org/
modules/resteasy/trunk/impl/src/main/java/org/jboss/
modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/
modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/
modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/
modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ConfigurationListener.java
modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/GenericExceptionMapper.java
modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/
modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationException.java
modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationExceptionMapper.java
modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationInterceptor.java
modules/resteasy/trunk/impl/src/main/resources/
modules/resteasy/trunk/impl/src/main/resources/META-INF/
modules/resteasy/trunk/impl/src/main/resources/META-INF/beans.xml
modules/resteasy/trunk/impl/src/main/resources/META-INF/web-fragment.xml
modules/resteasy/trunk/impl/src/test/
modules/resteasy/trunk/impl/src/test/java/
modules/resteasy/trunk/impl/src/test/java/org/
modules/resteasy/trunk/impl/src/test/java/org/jboss/
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ConfigurationTest.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/CustomSeamResteasyConfiguration.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/EntityNotFoundException.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestProvider.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestResource.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/FormBean.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/PartialValidation.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/Person.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/Resource.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/ValidationTest.java
modules/resteasy/trunk/impl/src/test/resources/
modules/resteasy/trunk/impl/src/test/resources/jndi.properties
modules/resteasy/trunk/impl/src/test/resources/org/
modules/resteasy/trunk/impl/src/test/resources/org/jboss/
modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/
modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/
modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/
modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/
modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/web.xml
modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/validation/
modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/validation/beans.xml
modules/resteasy/trunk/pom.xml
modules/resteasy/trunk/readme.txt
Log:
Initial commit of seam-resteasy.
Added: modules/resteasy/trunk/api/pom.xml
===================================================================
--- modules/resteasy/trunk/api/pom.xml (rev 0)
+++ modules/resteasy/trunk/api/pom.xml 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>seam-resteasy-parent</artifactId>
+ <groupId>org.jboss.seam.resteasy</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>seam-resteasy-api</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+
+ <packaging>jar</packaging>
+ <name>Seam RESTEasy Module API</name>
+
+</project>
Added: modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyConfiguration.java
===================================================================
--- modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyConfiguration.java (rev 0)
+++ modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyConfiguration.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,113 @@
+package org.jboss.seam.resteasy.configuration;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.enterprise.context.ApplicationScoped;
+
+/**
+ * Holds configuration options for seam-resteasy extension. It can be used to configure the extension via XML descriptor
+ * using seam-xml extension. Alternatively, you can configure the extension programatically by providing an
+ * @{link @Alternative} subclass of SeamResteasyConfiguration.
+ *
+ * This class allows declarative exception mapping to be used. The way exceptions are treated in the application is based on
+ * what @{link {@link #getExceptionMappings()} returns. Override this method or use seam-xml module to set up exception mapping
+ * declaratively.
+ *
+ * @author <a href="mailto:jharting at redhat.com">Jozef Hartinger</a>
+ *
+ */
+ at ApplicationScoped
+public class SeamResteasyConfiguration
+{
+ private Set<Class<?>> resources = new HashSet<Class<?>>();
+ private Set<Class<?>> providers = new HashSet<Class<?>>();
+
+ private Map<String, String> mediaTypeMappings = new HashMap<String, String>();
+ private Map<String, String> languageMappings = new HashMap<String, String>();
+
+ private Map<Class<? extends Throwable>, Integer> exceptionMappings = new HashMap<Class<? extends Throwable>, Integer>();
+
+ private boolean registerValidationExceptionMapper = true;
+
+ /**
+ * Returns a set of resource classes to be registered.
+ */
+ public Set<Class<?>> getResources()
+ {
+ return resources;
+ }
+
+ public void setResources(Set<Class<?>> resources)
+ {
+ this.resources = resources;
+ }
+
+ /**
+ * Returns a set of provider classes to be registered.
+ */
+ public Set<Class<?>> getProviders()
+ {
+ return providers;
+ }
+
+ public void setProviders(Set<Class<?>> providers)
+ {
+ this.providers = providers;
+ }
+
+ /**
+ * Returns a map of media type mappings to be registered.
+ */
+ public Map<String, String> getMediaTypeMappings()
+ {
+ return mediaTypeMappings;
+ }
+
+
+ public void setMediaTypeMappings(Map<String, String> mediaTypeMappings)
+ {
+ this.mediaTypeMappings = mediaTypeMappings;
+ }
+
+ /**
+ * Returns a map of language mappings to be registered.
+ */
+ public Map<String, String> getLanguageMappings()
+ {
+ return languageMappings;
+ }
+
+ public void setLanguageMappings(Map<String, String> languageMappings)
+ {
+ this.languageMappings = languageMappings;
+ }
+
+ /**
+ * Returns a map of exception mappings.
+ */
+ public Map<Class<? extends Throwable>, Integer> getExceptionMappings()
+ {
+ return exceptionMappings;
+ }
+
+ public void setExceptionMappings(Map<Class<? extends Throwable>, Integer> exceptionMapping)
+ {
+ this.exceptionMappings = exceptionMapping;
+ }
+
+ /**
+ * If set to true, the default exception mapper for {@link org.jboss.seam.resteasy.validation.ValidationException} will be registered.
+ */
+ public boolean isRegisterValidationExceptionMapper()
+ {
+ return registerValidationExceptionMapper;
+ }
+
+ public void setRegisterValidationExceptionMapper(boolean registerValidationExceptionMapper)
+ {
+ this.registerValidationExceptionMapper = registerValidationExceptionMapper;
+ }
+}
Added: modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/validation/ValidateRequest.java
===================================================================
--- modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/validation/ValidateRequest.java (rev 0)
+++ modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/validation/ValidateRequest.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,84 @@
+package org.jboss.seam.resteasy.validation;
+
+import static java.lang.annotation.ElementType.METHOD;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.enterprise.util.Nonbinding;
+import javax.interceptor.InterceptorBinding;
+import javax.validation.groups.Default;
+
+/**
+ * Triggers validation of incomming HTTP requests.
+ * The {@link Default} group is validated if not specified otherwise. By default, the message body parameter
+ * and {@link org.jboss.resteasy.annotations.Form} parameters are validated. This behaviour can be altered
+ * using {@link #validateMessageBody()} and {@link #validateFormParameters()} attributes.
+ *
+ * @author <a href="mailto:jharting at redhat.com">Jozef Hartinger</a>
+ *
+ */
+ at Target( { TYPE, METHOD })
+ at Retention(RUNTIME)
+ at Documented
+ at InterceptorBinding
+public @interface ValidateRequest
+{
+ /**
+ * Validation group that will be used during validation process.
+ */
+ @Nonbinding
+ Class<?>[] groups() default Default.class;
+
+ /**
+ * If set to false, the message body parameter will not be validated.
+ */
+ @Nonbinding
+ boolean validateMessageBody() default true;
+
+ /**
+ * If set to false, {@link org.jboss.resteasy.annotations.Form} parameters will not be validated.
+ * @return
+ */
+ @Nonbinding
+ boolean validateFormParameters() default true;
+
+ /**
+ * Annotation literal for {@link ValidateRequest} interceptor binding.
+ */
+ static class ValidateLiteral extends AnnotationLiteral<ValidateRequest> implements ValidateRequest
+ {
+ private static final long serialVersionUID = 6404662043744038090L;
+
+ private final Class<?>[] groups;
+ private final boolean validateFormParameters;
+ private final boolean validateMessageBody;
+
+ public ValidateLiteral(Class<?>[] groups, boolean validateFormParameters, boolean validateMessageBody)
+ {
+ this.groups = groups;
+ this.validateFormParameters = validateFormParameters;
+ this.validateMessageBody = validateMessageBody;
+ }
+
+ public Class<?>[] groups()
+ {
+ return groups;
+ }
+
+ public boolean validateFormParameters()
+ {
+ return validateFormParameters;
+ }
+
+ public boolean validateMessageBody()
+ {
+ return validateMessageBody;
+ }
+ }
+}
Added: modules/resteasy/trunk/impl/pom.xml
===================================================================
--- modules/resteasy/trunk/impl/pom.xml (rev 0)
+++ modules/resteasy/trunk/impl/pom.xml 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,27 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>seam-resteasy-parent</artifactId>
+ <groupId>org.jboss.seam.resteasy</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>seam-resteasy</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+
+ <packaging>jar</packaging>
+ <name>Seam RESTEasy Module Implementation</name>
+
+ <dependencies>
+ <dependency>
+ <artifactId>seam-resteasy-api</artifactId>
+ <groupId>org.jboss.seam.resteasy</groupId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
+
Added: modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ConfigurationListener.java
===================================================================
--- modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ConfigurationListener.java (rev 0)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ConfigurationListener.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,108 @@
+package org.jboss.seam.resteasy.configuration;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.inject.Inject;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.ext.ExceptionMapper;
+
+import org.jboss.resteasy.core.Dispatcher;
+import org.jboss.resteasy.spi.Registry;
+import org.jboss.resteasy.spi.ResteasyProviderFactory;
+import org.jboss.seam.resteasy.validation.ValidationExceptionMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ConfigurationListener implements ServletContextListener
+{
+ @Inject
+ private SeamResteasyConfiguration configuration;
+ private Dispatcher dispatcher;
+ private ResteasyProviderFactory factory;
+ private Registry registry;
+
+ private static final Logger log = LoggerFactory.getLogger(ConfigurationListener.class);
+
+ public void contextInitialized(ServletContextEvent sce)
+ {
+ dispatcher = (Dispatcher) sce.getServletContext().getAttribute(Dispatcher.class.getName());
+ factory = dispatcher.getProviderFactory();
+ registry = dispatcher.getRegistry();
+
+ log.info("Processing seam-resteasy configuration.");
+
+ registerProviders();
+ registerResources();
+ dispatcher.setLanguageMappings(configuration.getLanguageMappings());
+ registerMediaTypeMappings();
+ registerExceptionMappings();
+ }
+
+ private void registerResources()
+ {
+ for (Class<?> clazz : configuration.getResources())
+ {
+ log.info("Adding root resource {}.", clazz);
+ registry.addPerRequestResource(clazz);
+ }
+ }
+
+ private void registerProviders()
+ {
+ for (Class<?> clazz : configuration.getProviders())
+ {
+ log.info("Adding provider {}.", clazz);
+ factory.registerProvider(clazz);
+ }
+ }
+
+ private void registerExceptionMappings()
+ {
+ for (Entry<Class<? extends Throwable>, Integer> item : configuration.getExceptionMappings().entrySet())
+ {
+ if (Throwable.class.isAssignableFrom(item.getKey()))
+ {
+ Class<? extends Throwable> exceptionType = item.getKey();
+ int status = item.getValue();
+ ExceptionMapper<? extends Throwable> provider = new GenericExceptionMapper<Throwable>(status);
+ log.info("Adding exception mapping {} -> {}", exceptionType, status);
+ try
+ {
+ factory.addExceptionMapper(provider, exceptionType);
+ }
+ catch (NoSuchMethodError e)
+ {
+ log.warn("You are using old version of RESTEasy. Exception mapper for {} will not be registered.", exceptionType);
+ }
+ }
+ else
+ {
+ log.warn("{} is not an exception. Skipping mapping of the exception to {} status code.", item.getKey(), item.getValue());
+ }
+ }
+
+ // register ExceptionMapper for Bean Validation integration
+ if (configuration.isRegisterValidationExceptionMapper())
+ {
+ factory.addExceptionMapper(ValidationExceptionMapper.class);
+ }
+ }
+
+ private void registerMediaTypeMappings()
+ {
+ Map<String, MediaType> mediaTypeMappings = new HashMap<String, MediaType>();
+ for (Entry<String, String> entry : configuration.getMediaTypeMappings().entrySet())
+ {
+ mediaTypeMappings.put(entry.getKey(), MediaType.valueOf(entry.getValue()));
+ }
+ dispatcher.setMediaTypeMappings(mediaTypeMappings);
+ }
+
+ public void contextDestroyed(ServletContextEvent sce)
+ {
+ }
+}
Added: modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/GenericExceptionMapper.java
===================================================================
--- modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/GenericExceptionMapper.java (rev 0)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/GenericExceptionMapper.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,19 @@
+package org.jboss.seam.resteasy.configuration;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+
+public class GenericExceptionMapper<T extends Throwable> implements ExceptionMapper<T>
+{
+ private int status;
+
+ public GenericExceptionMapper(int status)
+ {
+ this.status = status;
+ }
+
+ public Response toResponse(T exception)
+ {
+ return Response.status(status).build();
+ }
+}
Added: modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationException.java
===================================================================
--- modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationException.java (rev 0)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationException.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,22 @@
+package org.jboss.seam.resteasy.validation;
+
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+
+public class ValidationException extends RuntimeException
+{
+ private static final long serialVersionUID = -2779809222298578247L;
+
+ private Set<ConstraintViolation<Object>> violations;
+
+ public ValidationException(Set<ConstraintViolation<Object>> violations)
+ {
+ this.violations = violations;
+ }
+
+ public Set<ConstraintViolation<Object>> getViolations()
+ {
+ return violations;
+ }
+}
Added: modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationExceptionMapper.java
===================================================================
--- modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationExceptionMapper.java (rev 0)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationExceptionMapper.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,23 @@
+package org.jboss.seam.resteasy.validation;
+
+import javax.validation.ConstraintViolation;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+
+import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
+import javax.ws.rs.ext.ExceptionMapper;
+
+public class ValidationExceptionMapper implements ExceptionMapper<ValidationException>
+{
+ public Response toResponse(ValidationException exception)
+ {
+ ResponseBuilder response = Response.status(BAD_REQUEST);
+
+ StringBuilder str = new StringBuilder();
+ for (ConstraintViolation<Object> violation : exception.getViolations())
+ {
+ str.append(violation.getMessage());
+ }
+ return response.entity(str.toString()).build();
+ }
+}
Added: modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationInterceptor.java
===================================================================
--- modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationInterceptor.java (rev 0)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationInterceptor.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,84 @@
+package org.jboss.seam.resteasy.validation;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.groups.Default;
+
+import org.jboss.resteasy.annotations.Form;
+
+ at Interceptor
+ at ValidateRequest
+public class ValidationInterceptor implements Serializable
+{
+ private static final long serialVersionUID = -5804986456381504613L;
+ private static final Class<?>[] DEFAULT_GROUPS = new Class<?>[] {Default.class};
+ private static final ValidateRequest DEFAULT_INTERCEPTOR_BINDING = new ValidateRequest.ValidateLiteral(DEFAULT_GROUPS, true, true);
+
+ @Inject
+ private Validator validator;
+
+ @AroundInvoke
+ public Object intercept(InvocationContext ctx) throws Exception
+ {
+ Set<ConstraintViolation<Object>> violations = new HashSet<ConstraintViolation<Object>>();
+
+ ValidateRequest interceptorBinding = getInterceptorBinding(ctx);
+ Class<?>[] groups = interceptorBinding.groups();
+
+ // perform validation
+ Annotation[][] parameterAnnotations = ctx.getMethod().getParameterAnnotations();
+ for (int i = 0; i < parameterAnnotations.length; i++)
+ {
+ if (parameterAnnotations[i].length == 0 && interceptorBinding.validateMessageBody())
+ {
+ // entity body
+ violations.addAll(validator.validate(ctx.getParameters()[i], groups));
+ }
+
+ if (parameterAnnotations[i].length > 0 && interceptorBinding.validateFormParameters())
+ {
+ // @Form parameters
+ for (Annotation annotation : parameterAnnotations[i])
+ {
+ if (annotation instanceof Form)
+ {
+ violations.addAll(validator.validate(ctx.getParameters()[i], groups));
+ }
+ }
+ }
+ }
+
+ if (violations.isEmpty())
+ {
+ return ctx.proceed();
+ }
+ else
+ {
+ throw new ValidationException(violations);
+ }
+ }
+
+ private ValidateRequest getInterceptorBinding(InvocationContext ctx)
+ {
+ ValidateRequest interceptorBinding = ctx.getMethod().getAnnotation(ValidateRequest.class);
+ if (interceptorBinding == null)
+ {
+ // There is no @Validate on the method
+ // The interceptor is probably bound to the bean by @Interceptors annotation
+ return DEFAULT_INTERCEPTOR_BINDING;
+ }
+ else
+ {
+ return interceptorBinding;
+ }
+ }
+}
Added: modules/resteasy/trunk/impl/src/main/resources/META-INF/beans.xml
===================================================================
--- modules/resteasy/trunk/impl/src/main/resources/META-INF/beans.xml (rev 0)
+++ modules/resteasy/trunk/impl/src/main/resources/META-INF/beans.xml 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,6 @@
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:s="urn:java:seam:core" xmlns:test="urn:java:org.jboss.seam.resteasy.configuration"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+</beans>
\ No newline at end of file
Added: modules/resteasy/trunk/impl/src/main/resources/META-INF/web-fragment.xml
===================================================================
--- modules/resteasy/trunk/impl/src/main/resources/META-INF/web-fragment.xml (rev 0)
+++ modules/resteasy/trunk/impl/src/main/resources/META-INF/web-fragment.xml 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-fragment xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"
+ version="3.0">
+
+ <!-- Seam-RESTEasy Configuration Listener -->
+ <listener>
+ <listener-class>org.jboss.seam.resteasy.configuration.ConfigurationListener</listener-class>
+ </listener>
+</web-fragment>
\ No newline at end of file
Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ConfigurationTest.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ConfigurationTest.java (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ConfigurationTest.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,89 @@
+package org.jboss.seam.resteasy.test.configuration;
+
+
+import static org.testng.Assert.assertEquals;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.api.Run;
+import org.jboss.arquillian.api.RunModeType;
+import org.jboss.arquillian.testng.Arquillian;
+import org.jboss.seam.resteasy.configuration.ConfigurationListener;
+import org.jboss.seam.resteasy.configuration.GenericExceptionMapper;
+import org.jboss.seam.resteasy.configuration.SeamResteasyConfiguration;
+import org.jboss.seam.resteasy.validation.ValidationException;
+import org.jboss.seam.resteasy.validation.ValidationExceptionMapper;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.testng.annotations.Test;
+
+ at Run(RunModeType.AS_CLIENT)
+public class ConfigurationTest
+extends Arquillian
+{
+ private HttpClient client = new HttpClient();
+
+ @Deployment
+ public static WebArchive createDeployment()
+ {
+ JavaArchive jar = ShrinkWrap.create("seam-resteasy.jar", JavaArchive.class);
+ jar.addManifestResource("META-INF/web-fragment.xml", "web-fragment.xml");
+ jar.addManifestResource("META-INF/beans.xml", ArchivePaths.create("beans.xml"));
+ jar.addClass(SeamResteasyConfiguration.class);
+ jar.addClass(ConfigurationListener.class);
+ jar.addClass(GenericExceptionMapper.class);
+ jar.addClass(ValidationExceptionMapper.class);
+ jar.addClass(ValidationException.class);
+ WebArchive war = ShrinkWrap.create("test.war", WebArchive.class);
+ war.addClass(CustomSeamResteasyConfiguration.class);
+ war.addClass(EntityNotFoundException.class);
+ war.addClass(TestProvider.class);
+ war.addClass(TestResource.class);
+ war.addLibrary(jar);
+ war.addResource("META-INF/beans.xml", ArchivePaths.create("WEB-INF/beans.xml"));
+ war.setWebXML("org/jboss/seam/resteasy/test/configuration/web.xml");
+ return war;
+ }
+
+
+ @Test
+ public void testResource() throws Exception
+ {
+ test("http://localhost:8080/test/foo", 200, "foo");
+ }
+
+ @Test
+ public void testProvider() throws Exception
+ {
+ GetMethod get = new GetMethod("http://localhost:8080/test/foo/bar");
+ get.setRequestHeader("Accept", "foo/bar");
+ assertEquals(client.executeMethod(get), 200);
+ assertEquals(get.getResponseBodyAsString(), "foobar");
+ }
+
+ @Test
+ public void testExceptionMapping() throws Exception
+ {
+ test("http://localhost:8080/test/foo/notFound", 404, null);
+ }
+
+ @Test
+ public void testMediaTypeMapping() throws Exception
+ {
+ test("http://localhost:8080/test/foo.xml", 200, "<foo/>");
+ }
+
+ private void test(String url, int expectedStatus, String expectedBody) throws Exception
+ {
+ GetMethod get = new GetMethod(url);
+ get.setRequestHeader("Accept", "text/plain");
+ assertEquals(client.executeMethod(get), expectedStatus);
+ if (expectedBody != null)
+ {
+ assertEquals(get.getResponseBodyAsString(), expectedBody);
+ }
+ }
+}
Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/CustomSeamResteasyConfiguration.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/CustomSeamResteasyConfiguration.java (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/CustomSeamResteasyConfiguration.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,18 @@
+package org.jboss.seam.resteasy.test.configuration;
+
+import javax.enterprise.inject.Specializes;
+
+import org.jboss.seam.resteasy.configuration.SeamResteasyConfiguration;
+
+ at Specializes
+public class CustomSeamResteasyConfiguration extends SeamResteasyConfiguration
+{
+
+ public CustomSeamResteasyConfiguration()
+ {
+ getResources().add(TestResource.class);
+ getProviders().add(TestProvider.class);
+ getExceptionMappings().put(EntityNotFoundException.class, 404);
+ getMediaTypeMappings().put("xml", "application/xml");
+ }
+}
Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/EntityNotFoundException.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/EntityNotFoundException.java (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/EntityNotFoundException.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,6 @@
+package org.jboss.seam.resteasy.test.configuration;
+
+public class EntityNotFoundException extends RuntimeException
+{
+ private static final long serialVersionUID = 1L;
+}
Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestProvider.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestProvider.java (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestProvider.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,34 @@
+package org.jboss.seam.resteasy.test.configuration;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+
+ at Provider
+public class TestProvider implements MessageBodyWriter<String>
+{
+ public long getSize(String t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
+ {
+ return -1;
+ }
+
+ public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
+ {
+ return mediaType.equals(MediaType.valueOf("foo/bar"));
+ }
+
+ public void writeTo(String t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException
+ {
+ OutputStreamWriter writer = new OutputStreamWriter(entityStream);
+ writer.write("foo"+t);
+ writer.flush();
+ }
+}
Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestResource.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestResource.java (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestResource.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,38 @@
+package org.jboss.seam.resteasy.test.configuration;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+ at Path("foo")
+ at Produces("text/plain")
+public class TestResource
+{
+ @GET
+ public String foo()
+ {
+ return "foo";
+ }
+
+ @GET
+ @Produces("application/xml")
+ public String xmlFoo()
+ {
+ return "<foo/>";
+ }
+
+ @GET
+ @Path("bar")
+ @Produces("foo/bar")
+ public String bar()
+ {
+ return "bar";
+ }
+
+ @GET
+ @Path("notFound")
+ public void notFound()
+ {
+ throw new EntityNotFoundException();
+ }
+}
Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/FormBean.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/FormBean.java (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/FormBean.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,41 @@
+package org.jboss.seam.resteasy.test.validation;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.ws.rs.FormParam;
+
+public class FormBean
+{
+ @FormParam("foo")
+ @NotNull
+ private String foo;
+ @FormParam("bar")
+ @Size(min = 2)
+ private String bar;
+
+ public FormBean(String foo, String bar)
+ {
+ this.foo = foo;
+ this.bar = bar;
+ }
+
+ public String getFoo()
+ {
+ return foo;
+ }
+
+ public void setFoo(String foo)
+ {
+ this.foo = foo;
+ }
+
+ public String getBar()
+ {
+ return bar;
+ }
+
+ public void setBar(String bar)
+ {
+ this.bar = bar;
+ }
+}
Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/PartialValidation.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/PartialValidation.java (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/PartialValidation.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,5 @@
+package org.jboss.seam.resteasy.test.validation;
+
+public interface PartialValidation
+{
+}
Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/Person.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/Person.java (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/Person.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,90 @@
+package org.jboss.seam.resteasy.test.validation;
+
+import javax.validation.constraints.AssertFalse;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.validation.groups.Default;
+
+public class Person
+{
+
+ @Size(min = 2, max = 20, groups = { PartialValidation.class, Default.class })
+ private String firstName;
+ @Size(min = 2, max = 20, groups = { PartialValidation.class, Default.class })
+ private String surname;
+ @Min(value = 18, groups = { PartialValidation.class, Default.class })
+ private int age;
+ @AssertFalse(groups = { PartialValidation.class, Default.class })
+ private boolean zombie;
+ @NotNull // not validated during partial validation
+ private String bio;
+
+ public Person(String firstName, String surname, int age, boolean zombie)
+ {
+ this.firstName = firstName;
+ this.surname = surname;
+ this.age = age;
+ this.zombie = zombie;
+ }
+
+ public Person(String firstName, String surname, int age, boolean zombie, String bio)
+ {
+ this(firstName, surname, age, zombie);
+ this.bio = bio;
+ }
+
+ public Person()
+ {
+ }
+
+ public String getFirstName()
+ {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName)
+ {
+ this.firstName = firstName;
+ }
+
+ public String getSurname()
+ {
+ return surname;
+ }
+
+ public void setSurname(String surname)
+ {
+ this.surname = surname;
+ }
+
+ public int getAge()
+ {
+ return age;
+ }
+
+ public void setAge(int age)
+ {
+ this.age = age;
+ }
+
+ public boolean isZombie()
+ {
+ return zombie;
+ }
+
+ public void setZombie(boolean zombie)
+ {
+ this.zombie = zombie;
+ }
+
+ public String getBio()
+ {
+ return bio;
+ }
+
+ public void setBio(String bio)
+ {
+ this.bio = bio;
+ }
+}
Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/Resource.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/Resource.java (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/Resource.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,33 @@
+package org.jboss.seam.resteasy.test.validation;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+import org.jboss.resteasy.annotations.Form;
+import org.jboss.seam.resteasy.validation.ValidateRequest;
+
+ at Path("validation")
+ at Produces("text/plain")
+ at Consumes("text/plain")
+public class Resource
+{
+ @POST
+ @ValidateRequest(groups = PartialValidation.class)
+ public void partiallyValidatedOperation(Person person)
+ {
+ }
+
+ @POST
+ @ValidateRequest
+ public void completelyValidatedOperation(Person person)
+ {
+ }
+
+ @POST
+ @ValidateRequest
+ public void formOperation(@Form FormBean form1, @Form FormBean form2)
+ {
+ }
+}
Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/ValidationTest.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/ValidationTest.java (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/ValidationTest.java 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,107 @@
+package org.jboss.seam.resteasy.test.validation;
+
+import static org.testng.Assert.assertEquals;
+
+import javax.inject.Inject;
+import javax.ws.rs.core.Response;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.testng.Arquillian;
+import org.jboss.seam.resteasy.validation.ValidateRequest;
+import org.jboss.seam.resteasy.validation.ValidationException;
+import org.jboss.seam.resteasy.validation.ValidationExceptionMapper;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.testng.annotations.Test;
+
+public class ValidationTest extends Arquillian
+{
+ @Inject
+ private Resource testResource;
+
+ @Deployment
+ public static JavaArchive createDeployment()
+ {
+ JavaArchive jar = ShrinkWrap.create("test.jar", JavaArchive.class);
+ jar.addManifestResource("org/jboss/seam/resteasy/test/validation/beans.xml", ArchivePaths.create("beans.xml"));
+ jar.addPackage(ValidateRequest.class.getPackage());
+ jar.addPackage(ValidationTest.class.getPackage());
+ return jar;
+ }
+
+ @Test
+ public void testCorrectMessageBody()
+ {
+ Person tester = new Person("Jozef", "Hartinger", 22, false);
+ testResource.partiallyValidatedOperation(tester);
+ }
+
+ @Test
+ public void testIncorrectMessageBody()
+ {
+ Person tester = new Person("foo", "b", 5, true);
+ try
+ {
+ testResource.partiallyValidatedOperation(tester);
+ throw new RuntimeException("Expected exception not thrown.");
+ }
+ catch (ValidationException e)
+ {
+ assertEquals(e.getViolations().size(), 3);
+ }
+ }
+
+ @Test
+ public void testIncorrectFormBean()
+ {
+ FormBean form1 = new FormBean(null, "a");
+ FormBean form2 = new FormBean(null, "bb");
+ try
+ {
+ testResource.formOperation(form1, form2);
+ throw new RuntimeException("Expected exception not thrown.");
+ }
+ catch (ValidationException e)
+ {
+ assertEquals(e.getViolations().size(), 3);
+ }
+ }
+
+ @Test
+ public void testValidationExceptionMapper()
+ {
+ Person tester = new Person("foo", "bar", 100, true);
+ ValidationExceptionMapper mapper = new ValidationExceptionMapper();
+ try
+ {
+ testResource.partiallyValidatedOperation(tester);
+ throw new RuntimeException("Expected exception not thrown.");
+ }
+ catch (ValidationException e)
+ {
+ Response response = mapper.toResponse(e);
+ assertEquals(response.getEntity().toString(), "must be false");
+ }
+ }
+
+ @Test
+ public void testGroups()
+ {
+ Person partiallyValidPerson = new Person("foo", "bar", 100, false);
+ Person completelyValidPerson = new Person("foo", "bar", 100, false, "foobar");
+
+ testResource.partiallyValidatedOperation(partiallyValidPerson);
+ testResource.completelyValidatedOperation(completelyValidPerson);
+
+ try
+ {
+ testResource.completelyValidatedOperation(partiallyValidPerson);
+ throw new RuntimeException("Expected exception not thrown.");
+ }
+ catch (ValidationException e)
+ {
+ // expected
+ }
+ }
+}
Added: modules/resteasy/trunk/impl/src/test/resources/jndi.properties
===================================================================
--- modules/resteasy/trunk/impl/src/test/resources/jndi.properties (rev 0)
+++ modules/resteasy/trunk/impl/src/test/resources/jndi.properties 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming\:org.jnp.interfaces
+java.naming.provider.url=jnp\://localhost\:1099
Added: modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/web.xml
===================================================================
--- modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/web.xml (rev 0)
+++ modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/web.xml 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+ <context-param>
+ <param-name>resteasy.scan</param-name>
+ <param-value>false</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>Resteasy</servlet-name>
+ <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Resteasy</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
\ No newline at end of file
Added: modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/validation/beans.xml
===================================================================
--- modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/validation/beans.xml (rev 0)
+++ modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/validation/beans.xml 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+ <interceptors>
+ <class>org.jboss.seam.resteasy.validation.ValidationInterceptor</class>
+ </interceptors>
+</beans>
Added: modules/resteasy/trunk/pom.xml
===================================================================
--- modules/resteasy/trunk/pom.xml (rev 0)
+++ modules/resteasy/trunk/pom.xml 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>seam-parent</artifactId>
+ <version>1</version>
+ </parent>
+
+ <groupId>org.jboss.seam.resteasy</groupId>
+ <artifactId>seam-resteasy-parent</artifactId>
+ <name>Seam RESTEasy Module</name>
+ <version>3.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <properties>
+ <seam.version>3.0.0.b01</seam.version>
+ </properties>
+
+ <url>http://www.seamframework.org</url>
+
+ <developers>
+ <developer>
+ <name>Jozef Hartinger</name>
+ <email>jharting at redhat.com</email>
+ <timezone>GMT+1</timezone>
+ <roles>
+ <role>Module Lead</role>
+ </roles>
+ </developer>
+ </developers>
+
+ <modules>
+ <module>api</module>
+ <module>impl</module>
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>seam</artifactId>
+ <version>${seam.version}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <!-- CDI (JSR-299) -->
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <!-- Bean validation -->
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <!-- Interceptors -->
+ <dependency>
+ <groupId>org.jboss.spec.javax.interceptor</groupId>
+ <artifactId>jboss-interceptors-api_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <!-- RESTEasy -->
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <version>2.0-beta-3-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- Required until the Servlet 3.0 API can be resolved in Central -->
+ <dependency>
+ <groupId>org.jboss.spec.javax.servlet</groupId>
+ <artifactId>jboss-servlet-api_3.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-testng</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-jbossas-remote-60</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <version>6.0.0.20100429-M3</version>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <classifier>jdk15</classifier>
+ <version>5.10</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <!-- We need test dependencies on server's classpath until ARQ-165 is resolved -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <configuration>
+ <includeArtifactIds>arquillian-testng,arquillian-api,arquillian-spi,commons-httpclient,testng,shrinkwrap-api,shrinkwrap-impl-base,resteasy-jaxrs</includeArtifactIds>
+ <outputDirectory>${basedir}/test-dependencies</outputDirectory>
+ </configuration>
+ </plugin>
+ <!-- Remove test-dependencies -->
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>${basedir}/test-dependencies</directory>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/resteasy/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/seam/modules/resteasy/trunk</developerConnection>
+ <url>http://fisheye.jboss.org/browse/Seam/modules/resteasy/trunk</url>
+ </scm>
+</project>
Added: modules/resteasy/trunk/readme.txt
===================================================================
--- modules/resteasy/trunk/readme.txt (rev 0)
+++ modules/resteasy/trunk/readme.txt 2010-06-08 13:31:37 UTC (rev 13082)
@@ -0,0 +1,4 @@
+seam-resteasy
+=============
+
+TODO
More information about the seam-commits
mailing list