[seam-commits] Seam SVN: r13798 - in modules/resteasy/trunk: api and 14 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Oct 6 09:57:11 EDT 2010


Author: jharting
Date: 2010-10-06 09:57:10 -0400 (Wed, 06 Oct 2010)
New Revision: 13798

Added:
   modules/resteasy/trunk/api/src/main/resources/META-INF/
   modules/resteasy/trunk/api/src/main/resources/META-INF/beans.xml
   modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ErrorMessageWrapper.java
   modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/util/
   modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/util/Annotations.java
   modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/util/Interpolator.java
   modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/InjectionInterceptor.java
   modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationErrorMessageWrapper.java
   modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/Fox.java
   modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/EjbResource.java
   modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestInterceptor.java
   modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestInterceptorBinding.java
   modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/util/
   modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/util/InterpolatorTest.java
   modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/ResourceChild.java
   modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/ResourceParent.java
   modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/beans.xml
Modified:
   modules/resteasy/trunk/api/pom.xml
   modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/ExceptionMapping.java
   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/ValidateRequest.java
   modules/resteasy/trunk/impl/pom.xml
   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/SeamExceptionMapper.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/test/java/org/jboss/seam/resteasy/test/SeamResteasyClientTest.java
   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/TestResource.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/org/jboss/seam/resteasy/test/configuration/web.xml
   modules/resteasy/trunk/pom.xml
Log:
Batch update of seam-resteasy.

Modified: modules/resteasy/trunk/api/pom.xml
===================================================================
--- modules/resteasy/trunk/api/pom.xml	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/api/pom.xml	2010-10-06 13:57:10 UTC (rev 13798)
@@ -14,5 +14,4 @@
 
 	<packaging>jar</packaging>
 	<name>Seam RESTEasy Module API</name>
-
 </project>

Modified: modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/ExceptionMapping.java
===================================================================
--- modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/ExceptionMapping.java	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/ExceptionMapping.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -1,7 +1,5 @@
 package org.jboss.seam.resteasy.configuration;
 
-import javax.ws.rs.core.MediaType;
-
 /**
  * Represents a mapping of an exception to an HTTP status code and response body.
  * 
@@ -12,8 +10,8 @@
 {
    private Class<? extends Throwable> exceptionType;
    private int statusCode;
-   private String messageBody;
-   private MediaType mediaType = MediaType.TEXT_PLAIN_TYPE;
+   private String message;
+   private boolean interpolateMessageBody = true;
 
    public ExceptionMapping()
    {
@@ -25,16 +23,16 @@
       this.statusCode = statusCode;
    }
 
-   public ExceptionMapping(Class<? extends Throwable> exceptionType, int statusCode, String messageBody, MediaType mediaType)
+   public ExceptionMapping(Class<? extends Throwable> exceptionType, int statusCode, String message)
    {
       this(exceptionType, statusCode);
-      this.messageBody = messageBody;
-      this.mediaType = mediaType;
+      this.message = message;
    }
    
-   public ExceptionMapping(Class<? extends Throwable> exceptionType, int statusCode, String messageBody, String mediaType)
+   public ExceptionMapping(Class<? extends Throwable> exceptionType, int statusCode, String message, boolean interpolateMessageBody)
    {
-      this(exceptionType, statusCode, messageBody, MediaType.valueOf(mediaType));
+      this(exceptionType, statusCode, message);
+      this.interpolateMessageBody = interpolateMessageBody;
    }
 
    public Class<? extends Throwable> getExceptionType()
@@ -57,23 +55,23 @@
       this.statusCode = statusCode;
    }
 
-   public String getMessageBody()
+   public String getMessage()
    {
-      return messageBody;
+      return message;
    }
 
-   public void setMessageBody(String messageBody)
+   public void setMessage(String message)
    {
-      this.messageBody = messageBody;
+      this.message = message;
    }
 
-   public MediaType getMediaType()
+   public boolean isInterpolateMessageBody()
    {
-      return mediaType;
+      return interpolateMessageBody;
    }
 
-   public void setMediaType(MediaType mediaType)
+   public void setInterpolateMessageBody(boolean interpolateMessageBody)
    {
-      this.mediaType = mediaType;
+      this.interpolateMessageBody = interpolateMessageBody;
    }
 }

Modified: 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	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyConfiguration.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -36,6 +36,7 @@
 
    private boolean registerValidationExceptionMapper = true;
 
+
    /**
     * Returns a set of resource classes to be registered.
     */

Modified: 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	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/validation/ValidateRequest.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -6,6 +6,7 @@
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
 import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
 import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
 
@@ -26,6 +27,7 @@
 @Target( { TYPE, METHOD })
 @Retention(RUNTIME)
 @Documented
+ at Inherited
 @InterceptorBinding
 public @interface ValidateRequest
 {

Added: modules/resteasy/trunk/api/src/main/resources/META-INF/beans.xml
===================================================================
--- modules/resteasy/trunk/api/src/main/resources/META-INF/beans.xml	                        (rev 0)
+++ modules/resteasy/trunk/api/src/main/resources/META-INF/beans.xml	2010-10-06 13:57:10 UTC (rev 13798)
@@ -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

Modified: modules/resteasy/trunk/impl/pom.xml
===================================================================
--- modules/resteasy/trunk/impl/pom.xml	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/impl/pom.xml	2010-10-06 13:57:10 UTC (rev 13798)
@@ -15,39 +15,186 @@
 	<packaging>jar</packaging>
 	<name>Seam RESTEasy Module Implementation</name>
 
+	<properties>
+		<arquillian.version>1.0.0.Alpha3</arquillian.version>
+		<resteasy.version>2.0.1.GA</resteasy.version>
+	</properties>
+
 	<dependencies>
 		<dependency>
+			<groupId>org.jboss.spec.javax.servlet</groupId>
+			<artifactId>jboss-servlet-api_3.0_spec</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
 			<artifactId>seam-resteasy-api</artifactId>
 			<groupId>org.jboss.seam.resteasy</groupId>
 			<version>${project.version}</version>
 		</dependency>
+		<dependency>
+			<groupId>org.jboss.weld</groupId>
+			<artifactId>weld-extensions</artifactId>
+			<version>1.0.0-SNAPSHOT</version>
+			<exclusions>
+				<exclusion>
+					<groupId>javax.transaction</groupId>
+					<artifactId>jta</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>org.javassist</groupId>
+					<artifactId>javassist</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>javax.persistence</groupId>
+					<artifactId>persistence-api</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+
+		<!-- Provided dependencies -->
+		<dependency>
+			<groupId>org.jboss.resteasy</groupId>
+			<artifactId>resteasy-jaxrs</artifactId>
+			<version>${resteasy.version}</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.jboss.resteasy</groupId>
+			<artifactId>resteasy-jaxb-provider</artifactId>
+			<version>${resteasy.version}</version>
+			<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.jbossas</groupId>
+			<artifactId>jboss-as-client</artifactId>
+			<version>${jbossas.version}</version>
+			<type>pom</type>
+			<scope>test</scope>
+		</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>
+			<version>5.12.1</version>
+			<scope>test</scope>
+		</dependency>
 	</dependencies>
-	
-   <profiles>
-      <profile>
-         <id>code-coverage</id>
-         <build>
-            <plugins>
-               <plugin>
-                  <groupId>org.codehaus.mojo</groupId>
-                  <artifactId>emma-maven-plugin</artifactId>
-               </plugin>
-               <plugin>
-                  <groupId>org.apache.maven.plugins</groupId>
-                  <artifactId>maven-surefire-plugin</artifactId>
-               </plugin>
-               <plugin>
-                  <groupId>org.apache.maven.plugins</groupId>
-                  <artifactId>maven-antrun-plugin</artifactId>
-               </plugin>
-               <plugin>
-                  <groupId>org.sonatype.maven.plugin</groupId>
-                  <artifactId>emma4it-maven-plugin</artifactId>
-               </plugin>
-            </plugins>
-         </build>
-      </profile>
-   </profiles>
 
+	<profiles>
+		<profile>
+			<id>code-coverage</id>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.codehaus.mojo</groupId>
+						<artifactId>emma-maven-plugin</artifactId>
+					</plugin>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-surefire-plugin</artifactId>
+					</plugin>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-antrun-plugin</artifactId>
+						<executions>
+							<execution>
+								<id>deploy-emma-jar</id>
+								<phase>process-test-sources</phase>
+								<goals>
+									<goal>run</goal>
+								</goals>
+								<configuration>
+									<tasks>
+										<echo message="Deploying emma jar to server lib directory" />
+										<copy file="${emma.jar.file}" todir="${env.JBOSS_HOME}/server/default/lib"
+											overwrite="true" />
+									</tasks>
+								</configuration>
+							</execution>
+							<execution>
+								<id>retrieve-coverage-file</id>
+								<phase>test</phase>
+								<goals>
+									<goal>run</goal>
+								</goals>
+								<configuration>
+									<tasks>
+										<move file="${env.JBOSS_HOME}/bin/coverage.ec" todir="${basedir}"
+											failonerror="false" />
+										<delete file="${basedir}/transaction.log" failonerror="false" />
+									</tasks>
+								</configuration>
+							</execution>
+						</executions>
+					</plugin>
+					<plugin>
+						<groupId>org.codehaus.mojo</groupId>
+						<artifactId>emma-maven-plugin</artifactId>
+					</plugin>
+					<plugin>
+						<groupId>org.sonatype.maven.plugin</groupId>
+						<artifactId>emma4it-maven-plugin</artifactId>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+
+		<profile>
+			<activation>
+				<property>
+					<name>managed</name>
+				</property>
+			</activation>
+			<id>jbossas-managed-6</id>
+			<properties>
+				<bindAddress>localhost</bindAddress>
+				<httpPort>8080</httpPort>
+			</properties>
+			<dependencies>
+				<dependency>
+					<groupId>org.jboss.arquillian.container</groupId>
+					<artifactId>arquillian-jbossas-managed-6</artifactId>
+					<version>${arquillian.version}</version>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.jboss.jbossas</groupId>
+					<artifactId>jboss-server-manager</artifactId>
+					<version>${jboss.server.manager.version}</version>
+					<scope>test</scope>
+				</dependency>
+			</dependencies>
+		</profile>
+
+		<profile>
+			<activation>
+				<property>
+					<name>!managed</name>
+				</property>
+			</activation>
+			<id>jbossas-remote-6</id>
+			<dependencies>
+				<dependency>
+					<groupId>org.jboss.arquillian.container</groupId>
+					<artifactId>arquillian-jbossas-remote-6</artifactId>
+					<version>${arquillian.version}</version>
+					<scope>test</scope>
+				</dependency>
+			</dependencies>
+		</profile>
+	</profiles>
 </project>
 

Modified: 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	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ConfigurationListener.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -4,12 +4,12 @@
 import java.util.Map;
 import java.util.Map.Entry;
 
+import javax.enterprise.inject.Instance;
 import javax.inject.Inject;
 import javax.servlet.ServletContext;
 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;
@@ -23,6 +23,8 @@
 {
    @Inject
    private SeamResteasyConfiguration configuration;
+   @Inject 
+   private Instance<SeamExceptionMapper> seamExceptionMapperInstance;
    private Dispatcher dispatcher;
    private ResteasyProviderFactory factory;
    private Registry registry;
@@ -116,11 +118,12 @@
          {
             Class<? extends Throwable> exceptionType = item.getKey();
             int status = item.getValue();
-            ExceptionMapper<? extends Throwable> provider = new BasicExceptionMapper<Throwable>(status);
+            SeamExceptionMapper exceptionMapper = seamExceptionMapperInstance.get();
+            exceptionMapper.initialize(status);
             log.info("Adding basic exception mapping {} -> {}", exceptionType, status);
             try
             {
-               factory.addExceptionMapper(provider, exceptionType);
+               factory.addExceptionMapper(exceptionMapper, exceptionType);
             }
             catch (NoSuchMethodError e)
             {
@@ -136,7 +139,8 @@
       // exception mapping (exception -> status code, http body, mime type)
       for (ExceptionMapping mapping : configuration.getExceptionMappings())
       {
-         SeamExceptionMapper provider = new SeamExceptionMapper(mapping);
+         SeamExceptionMapper provider = seamExceptionMapperInstance.get();
+         provider.initialize(mapping);
          log.info("Adding exception mapping {} -> {}", mapping.getExceptionType(), mapping.getStatusCode());
          try
          {

Added: modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ErrorMessageWrapper.java
===================================================================
--- modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ErrorMessageWrapper.java	                        (rev 0)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ErrorMessageWrapper.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -0,0 +1,41 @@
+package org.jboss.seam.resteasy.configuration;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.jboss.resteasy.annotations.providers.jaxb.IgnoreMediaTypes;
+
+ at XmlRootElement(name = "error")
+ at IgnoreMediaTypes("text/*")
+// TODO
+public class ErrorMessageWrapper
+{
+   private String message;
+
+   public ErrorMessageWrapper()
+   {
+      // JAXB requires no-arg constructor
+   }
+
+   public ErrorMessageWrapper(String message)
+   {
+      this.message = message;
+   }
+
+   @XmlElement(name = "message")
+   public String getMessage()
+   {
+      return message;
+   }
+
+   public void setMessage(String message)
+   {
+      this.message = message;
+   }
+
+   @Override
+   public String toString()
+   {
+      return message;
+   }
+}
\ No newline at end of file

Modified: modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/SeamExceptionMapper.java
===================================================================
--- modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/SeamExceptionMapper.java	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/SeamExceptionMapper.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -1,25 +1,63 @@
 package org.jboss.seam.resteasy.configuration;
 
+import javax.inject.Inject;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.ResponseBuilder;
 import javax.ws.rs.ext.ExceptionMapper;
 
+import org.jboss.seam.resteasy.util.Interpolator;
+
+/**
+ * SeamExceptionMapper allows exceptions to be mapped to HTTP status codes
+ * declaratively (at runtime).
+ * 
+ * @author Jozef Hartinger
+ * 
+ */
 public class SeamExceptionMapper implements ExceptionMapper<Throwable>
 {
-   private ResponseBuilder response;
-   
-   public SeamExceptionMapper(ExceptionMapping mapping)
+   private ResponseBuilder responseBuilder;
+   private String message;
+   private boolean interpolateMessageBody = true;
+
+   @Inject
+   private Interpolator interpolator;
+
+   protected void initialize(int status)
    {
-      response = Response.status(mapping.getStatusCode());
-      if (mapping.getMessageBody() != null)
+      responseBuilder = Response.status(status);
+   }
+
+   protected void initialize(ExceptionMapping mapping)
+   {
+      responseBuilder = Response.status(mapping.getStatusCode());
+      message = mapping.getMessage();
+      interpolateMessageBody = mapping.isInterpolateMessageBody();
+
+      if (message != null && !interpolateMessageBody)
       {
-         response.entity(mapping.getMessageBody());
-         response.header("Content-Type", mapping.getMediaType().toString());
+         // since the error message is always the same, we can cache it
+         ErrorMessageWrapper error = new ErrorMessageWrapper(message);
+         responseBuilder.entity(error);
       }
    }
 
    public Response toResponse(Throwable exception)
    {
-      return response.clone().build();
+      if (responseBuilder == null)
+      {
+         throw new IllegalStateException("ExceptionMapper not initialized.");
+      }
+
+      ResponseBuilder response = responseBuilder.clone();
+
+      if (message != null && interpolateMessageBody)
+      {
+         // since the message might be different every time, we have to recreate
+         // it on each request
+         ErrorMessageWrapper error = new ErrorMessageWrapper(interpolator.interpolate(message));
+         response.entity(error);
+      }
+      return response.build();
    }
 }

Added: modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/util/Annotations.java
===================================================================
--- modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/util/Annotations.java	                        (rev 0)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/util/Annotations.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -0,0 +1,51 @@
+package org.jboss.seam.resteasy.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+public class Annotations
+{
+   /**
+    * Looks for annotation on a given class including stereotypes.
+    * TODO only the first level of stereotypes is implemented currently (class -> stereotype -> annotation)
+    * if the annotation is placed deeper in the stereotype hierarchy, it won't be found
+    * 
+    * @param clazz class to be inspected
+    * @param annotationClass annotation to be looked for
+    * @return The annotation instance or null if the annotation is not present
+    */
+   public static <T extends Annotation> T getAnnotation(Class<?> clazz, Class<T> annotationClass)
+   {
+      if (clazz.isAnnotationPresent(annotationClass))
+      {
+         return clazz.getAnnotation(annotationClass);
+      }
+      for (Annotation annotation : clazz.getAnnotations())
+      {
+         if (annotation.annotationType().isAnnotationPresent(annotationClass))
+         {
+            return annotation.annotationType().getAnnotation(annotationClass);
+         }
+      }
+      return null;
+   }
+   
+   /**
+    * Looks for annotation on a given method, declaring class of the method and its stereotypes.
+    * 
+    * @param method method to be inspected
+    * @param annotationClass annotation to be looked for
+    * @return The annotation instance or null if the annotation is not present
+    */
+   public static <T extends Annotation> T getAnnotation(Method method, Class<T> annotationClass)
+   {
+      if (method.isAnnotationPresent(annotationClass))
+      {
+         return method.getAnnotation(annotationClass);
+      }
+      else
+      {
+         return getAnnotation(method.getDeclaringClass(), annotationClass);
+      }
+   }
+}

Added: modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/util/Interpolator.java
===================================================================
--- modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/util/Interpolator.java	                        (rev 0)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/util/Interpolator.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -0,0 +1,31 @@
+package org.jboss.seam.resteasy.util;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+import org.jboss.weld.extensions.el.Expressions;
+
+ at ApplicationScoped
+public class Interpolator
+{
+   public static final Pattern elPattern = Pattern.compile("(#\\{.*?\\})");
+   @Inject
+   private Expressions el;
+
+   public String interpolate(String input)
+   {
+      Matcher matcher = elPattern.matcher(input);
+      StringBuffer buffer = new StringBuffer();
+
+      while (matcher.find())
+      {
+         matcher.appendReplacement(buffer, String.valueOf(el.evaluateValueExpression(matcher.group())));
+      }
+      matcher.appendTail(buffer);
+
+      return buffer.toString();
+   }
+}

Added: modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/InjectionInterceptor.java
===================================================================
--- modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/InjectionInterceptor.java	                        (rev 0)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/InjectionInterceptor.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -0,0 +1,41 @@
+package org.jboss.seam.resteasy.validation;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.jboss.resteasy.core.PropertyInjectorImpl;
+import org.jboss.resteasy.spi.HttpRequest;
+import org.jboss.resteasy.spi.HttpResponse;
+import org.jboss.resteasy.spi.PropertyInjector;
+import org.jboss.resteasy.spi.ResteasyProviderFactory;
+
+/**
+ * This interceptor workarounds https://jira.jboss.org/browse/CDI-6. Enable it if you experience problems with JAX-RS injection into CDI-intercepted beans.
+ */
+ at ValidateRequest
+ at Interceptor
+public class InjectionInterceptor implements Serializable
+{
+   private static final long serialVersionUID = -4805100726530802448L;
+
+   @PostConstruct
+   public void performJaxrsInjection(InvocationContext ctx)
+   {
+      HttpRequest request = ResteasyProviderFactory.getContextData(HttpRequest.class);
+      HttpResponse response = ResteasyProviderFactory.getContextData(HttpResponse.class);
+
+      PropertyInjector propertyInjector = new PropertyInjectorImpl(ctx.getTarget().getClass(), ResteasyProviderFactory.getInstance());
+      
+      if ((request != null) && (response != null))
+      {
+         propertyInjector.inject(request, response, ctx.getTarget());
+      }
+      else
+      {
+         throw new IllegalStateException("Trying to instantiate a resource outside of HTTP request.");
+      }
+   }
+}

Added: modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationErrorMessageWrapper.java
===================================================================
--- modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationErrorMessageWrapper.java	                        (rev 0)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationErrorMessageWrapper.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -0,0 +1,49 @@
+package org.jboss.seam.resteasy.validation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.jboss.resteasy.annotations.providers.jaxb.IgnoreMediaTypes;
+
+ at XmlRootElement(name = "error")
+ at IgnoreMediaTypes("text/plain")
+// TODO
+public class ValidationErrorMessageWrapper
+{
+   private List<String> messages = new ArrayList<String>();
+
+   public ValidationErrorMessageWrapper()
+   {
+   }
+
+   @XmlElement(name = "messages")
+   public List<String> getMessages()
+   {
+      return messages;
+   }
+
+   public void addMessage(String message)
+   {
+      messages.add(message);
+   }
+
+   @Override
+   public String toString()
+   {
+      StringBuilder builder = new StringBuilder();
+      for (int i = 0; i < messages.size(); i++)
+      {
+         if (i > 0)
+         {
+            // get rid of trailing newline
+            builder.append("\n");
+         }
+         builder.append(messages.get(i));
+      }
+      return builder.toString();
+   }
+
+}
\ No newline at end of file

Modified: 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	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationExceptionMapper.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -12,15 +12,12 @@
    public Response toResponse(ValidationException exception)
    {
       ResponseBuilder response = Response.status(BAD_REQUEST);
-      
-      StringBuilder str = new StringBuilder();
+      ValidationErrorMessageWrapper error = new ValidationErrorMessageWrapper();
+
       for (ConstraintViolation<Object> violation : exception.getViolations())
       {
-//         str.append(violation.getPropertyPath().toString());
-//         str.append(" ");
-         str.append(violation.getMessage());
-         str.append("\n");
+         error.addMessage(violation.getMessage());
       }
-      return response.entity(str.toString()).build();
+      return response.entity(error).build();
    }
 }

Modified: 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	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationInterceptor.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -14,6 +14,7 @@
 import javax.validation.groups.Default;
 
 import org.jboss.resteasy.annotations.Form;
+import org.jboss.seam.resteasy.util.Annotations;
 
 @Interceptor
 @ValidateRequest
@@ -69,7 +70,7 @@
 
    private ValidateRequest getInterceptorBinding(InvocationContext ctx)
    {
-      ValidateRequest interceptorBinding = ctx.getMethod().getAnnotation(ValidateRequest.class);
+      ValidateRequest interceptorBinding = Annotations.getAnnotation(ctx.getMethod(), ValidateRequest.class);
       if (interceptorBinding == null)
       {
          // There is no @Validate on the method

Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/Fox.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/Fox.java	                        (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/Fox.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -0,0 +1,17 @@
+package org.jboss.seam.resteasy.test;
+
+import javax.inject.Named;
+
+ at Named
+public class Fox
+{
+   public int getCount()
+   {
+      return 1;
+   }
+   
+   public String getColor()
+   {
+      return "brown";
+   }
+}

Modified: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/SeamResteasyClientTest.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/SeamResteasyClientTest.java	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/SeamResteasyClientTest.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -10,15 +10,20 @@
 import org.jboss.arquillian.testng.Arquillian;
 import org.jboss.seam.resteasy.configuration.SeamResteasyConfiguration;
 import org.jboss.seam.resteasy.test.configuration.CustomSeamResteasyConfiguration;
+import org.jboss.seam.resteasy.test.configuration.EjbResource;
 import org.jboss.seam.resteasy.test.configuration.EntityNotFoundException;
 import org.jboss.seam.resteasy.test.configuration.ExcludedResource;
+import org.jboss.seam.resteasy.test.configuration.TestInterceptor;
+import org.jboss.seam.resteasy.test.configuration.TestInterceptorBinding;
 import org.jboss.seam.resteasy.test.configuration.TestProvider;
 import org.jboss.seam.resteasy.test.configuration.TestResource;
+import org.jboss.seam.resteasy.util.Interpolator;
 import org.jboss.seam.resteasy.validation.ValidateRequest;
 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.jboss.weld.extensions.el.Expressions;
 
 @Run(RunModeType.AS_CLIENT)
 public abstract class SeamResteasyClientTest extends Arquillian
@@ -41,6 +46,8 @@
       jar.addManifestResource("META-INF/beans.xml", ArchivePaths.create("beans.xml"));
       jar.addPackage(SeamResteasyConfiguration.class.getPackage());
       jar.addPackage(ValidateRequest.class.getPackage());
+      jar.addPackage(Interpolator.class.getPackage());
+      jar.addPackage(Expressions.class.getPackage());
       return jar;
    }
    
@@ -51,21 +58,30 @@
       war.addClass(EntityNotFoundException.class);
       war.addClass(TestProvider.class);
       war.addClass(TestResource.class);
+      war.addClass(TestInterceptorBinding.class);
+      war.addClass(TestInterceptor.class);
+      war.addClass(EjbResource.class);
       war.addClass(ExcludedResource.class);
       war.addClass(Student.class);
-      war.addResource("META-INF/beans.xml", ArchivePaths.create("WEB-INF/beans.xml"));
+      war.addClass(Fox.class);
+      war.addResource("org/jboss/seam/resteasy/test/configuration/beans.xml", ArchivePaths.create("WEB-INF/beans.xml"));
       war.setWebXML("org/jboss/seam/resteasy/test/configuration/web.xml");
       return war;
    }
    
-   protected void test(String url, int expectedStatus, String expectedBody) throws Exception
+   protected void test(String url, int expectedStatus, String expectedBody, String accept) throws Exception
    {
       GetMethod get = new GetMethod(url);
-      get.setRequestHeader("Accept", "text/plain");
+      get.setRequestHeader("Accept", accept);
       assertEquals(client.executeMethod(get), expectedStatus);
       if (expectedBody != null)
       {
          assertEquals(get.getResponseBodyAsString(), expectedBody);
       }
    }
+   
+   protected void test(String url, int expectedStatus, String expectedBody) throws Exception
+   {
+      test(url, expectedStatus, expectedBody, "text/plain");
+   }
 }

Modified: 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	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ConfigurationTest.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -39,6 +39,36 @@
    }
    
    @Test
+   public void testEjbExceptionMapping() throws Exception
+   {
+      test("http://localhost:8080/test/ejb/ping", 410, "You should not call methods on a null reference.");
+   }
+   
+   @Test
+   public void testEjbWithWeldInterceptorExceptionMapping() throws Exception
+   {
+      test("http://localhost:8080/test/ejb/pong", 410, "You should not call methods on a null reference.");
+   }
+   
+   @Test
+   public void testExceptionMessageInterpolation() throws Exception
+   {
+      test("http://localhost:8080/test/foo/interpolatedException", 405, "The quick brown fox jumps over the lazy dog");
+   }
+   
+   @Test
+   public void testExceptionMessageInterpolationSwitch() throws Exception
+   {
+      test("http://localhost:8080/test/foo/interpolatedExceptionSwitch", 405, "#{fox.color}");
+   }
+   
+   @Test
+   public void testExceptionMessageInterpolationXml() throws Exception
+   {
+      test("http://localhost:8080/test/foo/interpolatedException", 405, "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><error><message>The quick brown fox jumps over the lazy dog</message></error>", "application/xml");
+   }
+   
+   @Test
    public void testBasicExceptionMapping() throws Exception
    {
       test("http://localhost:8080/test/foo/exception3", 410, null);

Modified: 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	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/CustomSeamResteasyConfiguration.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -1,3 +1,4 @@
+
 package org.jboss.seam.resteasy.test.configuration;
 
 import javax.annotation.PostConstruct;
@@ -13,11 +14,14 @@
    public void setup()
    {
       addResource(TestResource.class);
+      addResource(EjbResource.class);
       addExcludedResource(ExcludedResource.class);
       addProvider(TestProvider.class);
       addBasicExceptionMapping(IllegalArgumentException.class, 410);
       addExceptionMapping(new ExceptionMapping(EntityNotFoundException.class, 410));
-      addExceptionMapping(new ExceptionMapping(NullPointerException.class, 410, "You should not call methods on a null reference.", "text/plain"));
+      addExceptionMapping(new ExceptionMapping(NullPointerException.class, 410, "You should not call methods on a null reference."));
+      addExceptionMapping(new ExceptionMapping(UnsupportedOperationException.class, 405, "The quick #{fox.color} #{fox.count == 1 ? 'fox' : 'foxes'} jumps over the lazy dog"));
+      addExceptionMapping(new ExceptionMapping(NoSuchMethodError.class, 405, "#{fox.color}", false));
       addMediaTypeMapping("xml", "application/xml");
    }
 }

Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/EjbResource.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/EjbResource.java	                        (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/EjbResource.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -0,0 +1,27 @@
+package org.jboss.seam.resteasy.test.configuration;
+
+import javax.ejb.Stateless;
+import javax.enterprise.inject.Default;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+ at Path("ejb")
+ at Stateless
+ at Default
+public class EjbResource
+{
+   @GET
+   @Path("/ping")
+   public void ping()
+   {
+      throw new NullPointerException("ping");
+   }
+
+   @GET
+   @Path("pong")
+   @TestInterceptorBinding
+   public void pong()
+   {
+      throw new NullPointerException("pong");
+   }
+}

Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestInterceptor.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestInterceptor.java	                        (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestInterceptor.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -0,0 +1,16 @@
+package org.jboss.seam.resteasy.test.configuration;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+ at Interceptor
+ at TestInterceptorBinding
+public class TestInterceptor
+{
+   @AroundInvoke
+   public Object intercept(InvocationContext ctx) throws Exception
+   {
+      return ctx.proceed();
+   }
+}

Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestInterceptorBinding.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestInterceptorBinding.java	                        (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestInterceptorBinding.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -0,0 +1,22 @@
+package org.jboss.seam.resteasy.test.configuration;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+ at InterceptorBinding
+ at Inherited
+ at Target({ TYPE, METHOD })
+ at Retention(RUNTIME)
+ at Documented
+public @interface TestInterceptorBinding
+{
+
+}

Modified: 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	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestResource.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -15,14 +15,14 @@
    {
       return "foo";
    }
-   
+
    @GET
    @Produces("application/xml")
    public String xmlFoo()
    {
       return "<foo/>";
    }
-   
+
    @GET
    @Path("student")
    @Produces("foo/bar")
@@ -30,23 +30,40 @@
    {
       return new Student("Jozef");
    }
-   
+
    @GET
    @Path("exception1")
    public void exception1()
    {
       throw new EntityNotFoundException("Entity is gone.");
    }
+
    @GET
    @Path("exception2")
    public void exception2()
    {
       throw new NullPointerException("null");
    }
+
    @GET
    @Path("exception3")
    public void exception3()
    {
       throw new IllegalArgumentException();
    }
+
+   @GET
+   @Path("interpolatedException")
+   @Produces({ "text/plain", "application/xml" })
+   public void interpolatedException()
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @GET
+   @Path("interpolatedExceptionSwitch")
+   public void interpolatedExceptionSwitch()
+   {
+      throw new NoSuchMethodError();
+   }
 }

Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/util/InterpolatorTest.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/util/InterpolatorTest.java	                        (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/util/InterpolatorTest.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -0,0 +1,40 @@
+package org.jboss.seam.resteasy.test.util;
+
+import static org.testng.Assert.assertEquals;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.testng.Arquillian;
+import org.jboss.seam.resteasy.test.Fox;
+import org.jboss.seam.resteasy.util.Interpolator;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.extensions.el.Expressions;
+import org.testng.annotations.Test;
+
+public class InterpolatorTest extends Arquillian
+{
+   @Inject
+   private Interpolator interpolator;
+   
+   @Deployment
+   public static JavaArchive createDeployment()
+   {
+      JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "test.jar");
+      jar.addManifestResource("META-INF/beans.xml", ArchivePaths.create("beans.xml"));
+      jar.addPackage(Interpolator.class.getPackage());
+      jar.addPackage(Expressions.class.getPackage());
+      jar.addClass(Fox.class);
+      return jar;
+   }
+   
+   @Test
+   public void testStringInterpolation()
+   {
+      String template = "The quick #{fox.color} #{fox.count == 1 ? 'fox' : 'foxes'} jumps over the lazy dog";
+      String expected = "The quick brown fox jumps over the lazy dog";
+      assertEquals(interpolator.interpolate(template), expected);
+   }
+}

Modified: 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	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/Resource.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -1,31 +1,20 @@
 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/ResourceChild.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/ResourceChild.java	                        (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/ResourceChild.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -0,0 +1,8 @@
+package org.jboss.seam.resteasy.test.validation;
+
+public class ResourceChild extends ResourceParent
+{
+   public void ping(Person person)
+   {
+   }
+}

Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/ResourceParent.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/ResourceParent.java	                        (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/ResourceParent.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -0,0 +1,9 @@
+package org.jboss.seam.resteasy.test.validation;
+
+import org.jboss.seam.resteasy.validation.ValidateRequest;
+
+ at ValidateRequest
+public class ResourceParent
+{
+
+}

Modified: 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	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/ValidationTest.java	2010-10-06 13:57:10 UTC (rev 13798)
@@ -7,18 +7,23 @@
 
 import org.jboss.arquillian.api.Deployment;
 import org.jboss.arquillian.testng.Arquillian;
+import org.jboss.seam.resteasy.configuration.ErrorMessageWrapper;
+import org.jboss.seam.resteasy.util.Interpolator;
 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.jboss.weld.extensions.el.Expressions;
 import org.testng.annotations.Test;
 
 public class ValidationTest extends Arquillian
 {
    @Inject
    private Resource testResource;
+   @Inject
+   private ResourceChild resourceChild;
    
    @Deployment
    public static JavaArchive createDeployment()
@@ -27,6 +32,9 @@
       jar.addManifestResource("org/jboss/seam/resteasy/test/validation/beans.xml", ArchivePaths.create("beans.xml"));
       jar.addPackage(ValidateRequest.class.getPackage());
       jar.addPackage(ValidationTest.class.getPackage());
+      jar.addPackage(Interpolator.class.getPackage());
+      jar.addPackage(Expressions.class.getPackage());
+      jar.addClass(ErrorMessageWrapper.class);
       return jar;
    }
    
@@ -104,4 +112,18 @@
          // expected
       }
    }
+   
+   @Test
+   public void testResourceHierarchy()
+   {
+      try
+      {
+         resourceChild.ping(new Person());
+         throw new RuntimeException("Expected exception not thrown.");
+      }
+      catch (ValidationException e)
+      {
+         // expected
+      }
+   }
 }

Added: modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/beans.xml
===================================================================
--- modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/beans.xml	                        (rev 0)
+++ modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/beans.xml	2010-10-06 13:57:10 UTC (rev 13798)
@@ -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.test.configuration.TestInterceptor</class>
+	</interceptors>
+</beans>

Modified: 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	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/web.xml	2010-10-06 13:57:10 UTC (rev 13798)
@@ -8,6 +8,12 @@
 	<!-- Disable auto-scanning -->
      <context-param>
         <param-name>resteasy.scan.resources</param-name>
-        <param-value></param-value>
+        <param-value>false</param-value>
     </context-param>
+    
+    <context-param>
+		<param-name>resteasy.unwrapped.exceptions</param-name>
+		<param-value>javax.ejb.EJBException,org.jboss.weld.exceptions.WeldException</param-value>
+	</context-param>
+    
 </web-app>
\ No newline at end of file

Modified: modules/resteasy/trunk/pom.xml
===================================================================
--- modules/resteasy/trunk/pom.xml	2010-10-06 13:57:01 UTC (rev 13797)
+++ modules/resteasy/trunk/pom.xml	2010-10-06 13:57:10 UTC (rev 13798)
@@ -16,10 +16,10 @@
 	<packaging>pom</packaging>
 
 	<properties>
-      <seam.version>3.0.0.b01</seam.version>
-      <arquillian.version>1.0.0.Alpha3</arquillian.version>
-      <jbossas.version>6.0.0.20100721-M4</jbossas.version>
-      <jboss.server.manager.version>1.0.3.GA</jboss.server.manager.version>
+		<seam.version>3.0.0.b01</seam.version>
+		<arquillian.version>1.0.0.Alpha3</arquillian.version>
+		<jbossas.version>6.0.0.20100721-M4</jbossas.version>
+		<jboss.server.manager.version>1.0.3.GA</jboss.server.manager.version>
 	</properties>
 
 	<url>http://www.seamframework.org</url>
@@ -53,15 +53,7 @@
 	</dependencyManagement>
 
 	<dependencies>
-		<!-- 
-		We will need this once we implement ValidationInterceptor check.
-		Will be implemented once packing maven dependencies with ShrinkWrap gets easier
 		<dependency>
-			<groupId>org.jboss.weld</groupId>
-			<artifactId>weld-extensions</artifactId>
-		</dependency> -->
-		<!-- Provided dependencies -->
-		<dependency>
 			<groupId>javax.enterprise</groupId>
 			<artifactId>cdi-api</artifactId>
 			<scope>provided</scope>
@@ -76,189 +68,8 @@
 			<artifactId>jboss-interceptors-api_1.1_spec</artifactId>
 			<scope>provided</scope>
 		</dependency>
-		<dependency>
-			<groupId>org.jboss.resteasy</groupId>
-			<artifactId>resteasy-jaxrs</artifactId>
-			<version>2.0-beta-4</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.jbossas</groupId>
-			<artifactId>jboss-as-client</artifactId>
-<!--			<version>6.0.0-SNAPSHOT</version>-->
-<!--			<version>6.0.0.20100429-M3</version>-->
-			<version>6.0.0.20100721-M4</version>
-			<type>pom</type>
-			<scope>test</scope>
-		</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>
-			<version>5.12.1</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</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>
-	
-	<profiles>
-	   <profile>
-         <id>code-coverage</id>
-         <build>
-            <pluginManagement>
-               <plugins>
-                  <plugin>
-                     <groupId>org.apache.maven.plugins</groupId>
-                     <artifactId>maven-antrun-plugin</artifactId>
-                     <executions>
-                        <execution>
-                           <id>deploy-emma-jar</id>
-                           <phase>process-test-sources</phase>
-                           <goals>
-                              <goal>run</goal>
-                           </goals>
-                           <configuration>
-                              <tasks>
-                                 <echo message="Deploying emma jar to server lib directory" />
-                                 <copy file="${emma.jar.file}"
-                                    todir="${env.JBOSS_HOME}/server/default/lib"
-                                    overwrite="true" />
-                              </tasks>
-                           </configuration>
-                        </execution>
-                        <execution>
-                           <id>retrieve-coverage-file</id>
-                           <phase>test</phase>
-                           <goals>
-                              <goal>run</goal>
-                           </goals>
-                           <configuration>
-                              <tasks>
-                                 <move file="${env.JBOSS_HOME}/bin/coverage.ec"
-                                    todir="${basedir}" failonerror="false" />
-                                 <delete file="${basedir}/transaction.log"
-                                    failonerror="false" />
-                              </tasks>
-                           </configuration>
-                        </execution>
-                     </executions>
-                  </plugin>
-               </plugins>
-            </pluginManagement>
-         </build>
-      </profile>
-      
-      <profile>
-         <id>jbossas-managed-6</id>
-         <properties>
-            <bindAddress>localhost</bindAddress>
-            <httpPort>8080</httpPort>
-         </properties>
-         <dependencies>
-            <dependency>
-               <groupId>org.jboss.arquillian.container</groupId>
-               <artifactId>arquillian-jbossas-managed-6</artifactId>
-               <version>${arquillian.version}</version>
-            </dependency>
-            <dependency>
-               <groupId>org.jboss.jbossas</groupId>
-               <artifactId>jboss-server-manager</artifactId>
-               <version>${jboss.server.manager.version}</version>
-            </dependency>
-            <dependency>
-               <groupId>org.jboss.jbossas</groupId>
-               <artifactId>jboss-as-client</artifactId>
-               <version>${jbossas.version}</version>
-               <type>pom</type>
-            </dependency>
-         </dependencies>
-         <build>
-            <testResources>
-               <testResource>
-                  <directory>src/test/resources</directory>
-               </testResource>
-               <testResource>
-                  <directory>src/test/resources-jbossas</directory>
-               </testResource>
-            </testResources>
-         </build>
-      </profile>
-      
-      <profile>
-         <id>jbossas-remote-6</id>
-         <dependencies>
-            <dependency>
-               <groupId>org.jboss.arquillian.container</groupId>
-               <artifactId>arquillian-jbossas-remote-6</artifactId>
-               <version>${arquillian.version}</version>
-            </dependency>
-            <dependency>
-               <groupId>org.jboss.jbossas</groupId>
-               <artifactId>jboss-as-client</artifactId>
-               <version>${jbossas.version}</version>
-               <type>pom</type>
-            </dependency>
-        </dependencies>
-        <build>
-            <testResources>
-               <testResource>
-                  <directory>src/test/resources</directory>
-               </testResource>
-               <testResource>
-                  <directory>src/test/resources-jbossas</directory>
-               </testResource>
-            </testResources>
-         </build>
-      </profile>
-	</profiles>
-
 	<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>



More information about the seam-commits mailing list