You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wink.apache.org by bl...@apache.org on 2009/07/07 06:07:59 UTC

svn commit: r791696 [2/4] - in /incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src: main/java/org/apache/cxf/ main/java/org/apache/cxf/helpers/ main/java/org/apache/wink/jaxrs/test/providers/readers/ m...

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/Application.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/Application.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/Application.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.providers.writers;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class Application extends javax.ws.rs.core.Application {
+
+    @Override
+    public Set<Class<?>> getClasses() {
+        Set<Class<?>> clazzes = new HashSet<Class<?>>();
+        clazzes.add(WriterResource.class);
+        return clazzes;
+    }
+
+    @Override
+    public Set<Object> getSingletons() {
+        Set<Object> objs = new HashSet<Object>();
+        objs.add(new MessageBodyWriterIsWritableClassDeque());
+        objs.add(new MessageBodyWriterIsWritableGenericEntitySetString());
+        objs.add(new MessageBodyWriterIsWritableGenericEntitySetInteger());
+        objs.add(new MessageBodyWriterIsWritableSet());
+        objs.add(new MessageBodyWriterIsWritableGetAnnotated());
+        objs.add(new MessageBodyWriterIsWritablePostAnnotated());
+        objs.add(new MessageBodyWriterIsWritableMediaTypeHashMap());
+        objs.add(new MessageBodyWriterIsWritableThrowsExceptions());
+        objs.add(new MessageBodyWriterContentLength());
+        objs.add(new MessageBodyWriterByteArrayContentLength());
+        return objs;
+    }
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/ArrayDeque.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/ArrayDeque.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/ArrayDeque.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/ArrayDeque.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.wink.jaxrs.test.providers.writers;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * this class is a dummy class to fill in for the ArrayDeque we were originally
+ * using from JDK6.
+ *
+ * @param <T>
+ */
+public class ArrayDeque<T> implements Deque<T> {
+
+    List<T> list = null;
+    
+    public ArrayDeque() {
+        list = new ArrayList<T>();
+    }
+    
+    public ArrayDeque(List<T> asList) {
+        list = asList;
+    }
+
+    public Iterator<T> iterator() {
+        return list.iterator();
+    }
+    
+    public void add(T item) {
+        list.add(item);
+    }
+
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/CustomAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/CustomAnnotation.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/CustomAnnotation.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/CustomAnnotation.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.providers.writers;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.PARAMETER, ElementType.METHOD })
+public @interface CustomAnnotation {
+
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/Deque.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/Deque.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/Deque.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/Deque.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.wink.jaxrs.test.providers.writers;
+
+
+/**
+ * this class is a dummy class to fill in for the Deque we were originally
+ * using from JDK6.
+ *
+ * @param <T>
+ */
+public interface Deque<T> extends Queue<T> {
+
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterByteArrayContentLength.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterByteArrayContentLength.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterByteArrayContentLength.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterByteArrayContentLength.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.providers.writers;
+
+import java.io.IOException;
+import java.io.OutputStream;
+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;
+
+@Provider
+public class MessageBodyWriterByteArrayContentLength implements MessageBodyWriter<byte[]> {
+
+    public long getSize(byte[] t,
+                        Class<?> type,
+                        Type genericType,
+                        Annotation[] annotations,
+                        MediaType mediaType) {
+        if (type.equals(byte[].class)) {
+            byte[] barr = (byte[])t;
+            if (mediaType.equals(new MediaType("length", "shorter"))) {
+                return barr.length - 10;
+            } else if (mediaType.equals(new MediaType("length", "longer"))) {
+                return barr.length + 10;
+            }
+            return -1;
+        }
+        return -1;
+    }
+
+    public boolean isWriteable(Class<?> type,
+                               Type genericType,
+                               Annotation[] annotations,
+                               MediaType mediaType) {
+        if (type.equals(byte[].class)) {
+            return true;
+        }
+        return false;
+    }
+
+    public void writeTo(byte[] t,
+                        Class<?> type,
+                        Type genericType,
+                        Annotation[] annotations,
+                        MediaType mediaType,
+                        MultivaluedMap<String, Object> httpHeaders,
+                        OutputStream entityStream) throws IOException, WebApplicationException {
+        httpHeaders.putSingle("MyHeader", "used");
+        if (type.equals(byte[].class)) {
+            entityStream.write((byte[])t);
+        }
+    }
+
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterContentLength.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterContentLength.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterContentLength.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterContentLength.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.providers.writers;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+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;
+
+@Provider
+public class MessageBodyWriterContentLength implements MessageBodyWriter<Object> {
+
+    public long getSize(Object arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4) {
+
+        if (arg1.equals(Vector.class) && arg2.equals(Vector.class)) {
+            return 17;
+        }
+
+        if (arg1.equals(ArrayList.class)) {
+            if (arg2 instanceof ParameterizedType) {
+                ParameterizedType pt = (ParameterizedType)arg2;
+                if (pt.getRawType().equals(List.class)) {
+                    if (pt.getActualTypeArguments().length == 1 && pt.getActualTypeArguments()[0]
+                        .equals(Integer.class)) {
+                        return 14;
+                        // return true;
+                    }
+                }
+            }
+
+            if (arg1.equals(ArrayList.class)) {
+                // return true;
+            }
+        }
+
+        if (arg1.equals(String.class)) {
+            boolean isGetFound = false;
+            for (Annotation ann : arg3) {
+                if (ann.annotationType().equals(CustomAnnotation.class)) {
+                    isGetFound = true;
+                }
+            }
+
+            if (isGetFound) {
+                return 18;
+            }
+        }
+        return -1;
+    }
+
+    public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        if (arg0.equals(Vector.class)) {
+            return true;
+        }
+
+        if (arg0.equals(ArrayList.class)) {
+            if (arg1 instanceof ParameterizedType) {
+                ParameterizedType pt = (ParameterizedType)arg1;
+                if (pt.getRawType().equals(List.class)) {
+                    if (pt.getActualTypeArguments().length == 1 && pt.getActualTypeArguments()[0]
+                        .equals(Integer.class)) {
+                        return true;
+                    }
+                }
+            }
+
+            if (arg1.equals(ArrayList.class)) {
+                return true;
+            }
+        }
+
+        if (arg1.equals(String.class)) {
+            if (arg2 != null) {
+                for (Annotation ann : arg2) {
+                    if (ann.annotationType().equals(CustomAnnotation.class)) {
+                        return true;
+                    }
+                }
+            }
+        }
+
+        return false;
+    }
+
+    public void writeTo(Object arg0,
+                        Class<?> arg1,
+                        Type arg2,
+                        Annotation[] arg3,
+                        MediaType arg4,
+                        MultivaluedMap<String, Object> arg5,
+                        OutputStream arg6) throws IOException, WebApplicationException {
+        if (arg1.equals(Vector.class)) {
+            Writer writer = new OutputStreamWriter(arg6);
+            writer.write("vector:");
+            Vector vec = (Vector)arg0;
+            for (Object o : vec) {
+                writer.write(o.toString());
+            }
+            writer.flush();
+        } else if (arg1.equals(ArrayList.class)) {
+            if (arg2 instanceof ParameterizedType) {
+                ParameterizedType pt = (ParameterizedType)arg2;
+                if (pt.getRawType().equals(List.class)) {
+                    if (pt.getActualTypeArguments().length == 1 && pt.getActualTypeArguments()[0]
+                        .equals(Integer.class)) {
+                        Writer writer = new OutputStreamWriter(arg6);
+                        writer.write("listinteger:");
+                        List list = (List)arg0;
+                        for (Object o : list) {
+                            writer.write(o.toString());
+                        }
+                        writer.flush();
+                    }
+                }
+            }
+        } else if (arg1.equals(String.class)) {
+            boolean isCustomAnnotationFound = false;
+            for (Annotation ann : arg3) {
+                if (ann.annotationType().equals(CustomAnnotation.class)) {
+                    isCustomAnnotationFound = true;
+                }
+            }
+
+            if (isCustomAnnotationFound) {
+                arg6.write("string:".getBytes());
+                arg6.write(((String)arg0).getBytes());
+            }
+        } else {
+            Writer writer = new OutputStreamWriter(arg6);
+            writer.write("getannotation:");
+            List list = (List)arg0;
+            for (Object o : list) {
+                writer.write(o.toString());
+            }
+            writer.flush();
+        }
+    }
+
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableClassDeque.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableClassDeque.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableClassDeque.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableClassDeque.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.providers.writers;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+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;
+
+@Provider
+public class MessageBodyWriterIsWritableClassDeque implements MessageBodyWriter<Object> {
+
+    public long getSize(Object arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4) {
+        return -1;
+    }
+
+    public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        if (Deque.class.isAssignableFrom(arg0)) {
+            return true;
+        }
+        return false;
+    }
+
+    public void writeTo(Object arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4,
+        MultivaluedMap<String, Object> arg5, OutputStream arg6) throws IOException,
+        WebApplicationException {
+        Writer writer = new OutputStreamWriter(arg6);
+        Deque d = (Deque) arg0;
+        writer.write("deque:");
+        for (Object o : d) {
+            writer.write(o.toString());
+        }
+        writer.flush();
+    }
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableGenericEntitySetInteger.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableGenericEntitySetInteger.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableGenericEntitySetInteger.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableGenericEntitySetInteger.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.providers.writers;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+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;
+
+@Provider
+public class MessageBodyWriterIsWritableGenericEntitySetInteger implements
+    MessageBodyWriter<Object> {
+
+    public long getSize(Object arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4) {
+        return -1;
+    }
+
+    public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        if (arg0.isAssignableFrom(HashSet.class)) {
+            if (arg1 instanceof ParameterizedType) {
+                ParameterizedType pt = (ParameterizedType) arg1;
+                Type[] args = pt.getActualTypeArguments();
+                if (args.length == 1 && args[0].equals(Integer.class)) {
+                    if (pt.getRawType().equals(Set.class)) {
+                        return true;
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    @SuppressWarnings("unchecked")
+    public void writeTo(Object arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4,
+        MultivaluedMap<String, Object> arg5, OutputStream arg6) throws IOException,
+        WebApplicationException {
+        Writer writer = new OutputStreamWriter(arg6);
+        Set<Integer> s = (Set<Integer>) arg0;
+        writer.write("set<integer>:");
+        List<Integer> list = new ArrayList<Integer>(s);
+        Collections.sort(list);
+        for (Object o : list) {
+            writer.write(o.toString());
+        }
+        writer.flush();
+    }
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableGenericEntitySetString.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableGenericEntitySetString.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableGenericEntitySetString.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableGenericEntitySetString.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.providers.writers;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+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;
+
+@Provider
+public class MessageBodyWriterIsWritableGenericEntitySetString implements MessageBodyWriter<Object> {
+
+    public long getSize(Object arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4) {
+        return -1;
+    }
+
+    public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        if (arg0.isAssignableFrom(HashSet.class)) {
+            if (arg1 instanceof ParameterizedType) {
+                ParameterizedType pt = (ParameterizedType) arg1;
+                Type[] args = pt.getActualTypeArguments();
+                if (args.length == 1 && args[0].equals(String.class)) {
+                    if (pt.getRawType().equals(Set.class)) {
+                        return true;
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    @SuppressWarnings("unchecked")
+    public void writeTo(Object arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4,
+        MultivaluedMap<String, Object> arg5, OutputStream arg6) throws IOException,
+        WebApplicationException {
+        Writer writer = new OutputStreamWriter(arg6);
+        Set<String> s = (Set<String>) arg0;
+        writer.write("set<string>:");
+        List<String> list = new ArrayList<String>(s);
+        Collections.sort(list);
+        for (Object o : list) {
+            writer.write(o.toString());
+        }
+        writer.flush();
+    }
+
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableGetAnnotated.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableGetAnnotated.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableGetAnnotated.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableGetAnnotated.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.providers.writers;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.List;
+
+import javax.ws.rs.GET;
+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;
+
+@Provider
+public class MessageBodyWriterIsWritableGetAnnotated implements MessageBodyWriter<Object> {
+
+    public long getSize(Object arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4) {
+        return -1;
+    }
+
+    public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        boolean isGetAnnotated = false;
+        boolean isMyWriterAnnotated = false;
+        if (arg2 != null) {
+            for (Annotation ann : arg2) {
+                if (MyWriterAnnotation.class.equals(ann.annotationType())) {
+                    isMyWriterAnnotated = true;
+                } else if (GET.class.equals(ann.annotationType())) {
+                    isGetAnnotated = true;
+                }
+            }
+            if (isMyWriterAnnotated && isGetAnnotated) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public void writeTo(Object arg0,
+                        Class<?> arg1,
+                        Type arg2,
+                        Annotation[] arg3,
+                        MediaType arg4,
+                        MultivaluedMap<String, Object> arg5,
+                        OutputStream arg6) throws IOException, WebApplicationException {
+        Writer writer = new OutputStreamWriter(arg6);
+        writer.write("getannotation:");
+        List list = (List)arg0;
+        for (Object o : list) {
+            writer.write(o.toString());
+        }
+        writer.flush();
+    }
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableMediaTypeHashMap.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableMediaTypeHashMap.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableMediaTypeHashMap.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableMediaTypeHashMap.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.providers.writers;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Map;
+
+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;
+
+@Provider
+public class MessageBodyWriterIsWritableMediaTypeHashMap implements MessageBodyWriter<Object> {
+
+    public long getSize(Object arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4) {
+        return -1;
+    }
+
+    public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        if (arg3.equals(new MediaType("custom", "correct"))) {
+            return true;
+        }
+        return false;
+    }
+
+    public void writeTo(Object arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4,
+        MultivaluedMap<String, Object> arg5, OutputStream arg6) throws IOException,
+        WebApplicationException {
+        Writer writer = new OutputStreamWriter(arg6);
+        writer.write("mediatype:");
+        Map map = (Map) arg0;
+        for (Object k : map.keySet()) {
+            writer.write(k.toString() + "=" + map.get(k));
+        }
+        writer.flush();
+    }
+
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritablePostAnnotated.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritablePostAnnotated.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritablePostAnnotated.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritablePostAnnotated.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.providers.writers;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.List;
+
+import javax.ws.rs.POST;
+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;
+
+@Provider
+public class MessageBodyWriterIsWritablePostAnnotated  implements MessageBodyWriter<List> {
+
+    public long getSize(List arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4) {
+        return -1;
+    }
+
+    public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        boolean isPostAnnotated = false;
+        boolean isMyWriterAnnotated = false;
+        for (Annotation ann : arg2) {
+            if (MyWriterAnnotation.class.equals(ann.annotationType())) {
+                isMyWriterAnnotated = true;
+            } else if (POST.class.equals(ann.annotationType())) {
+                isPostAnnotated = true;
+            }
+        }
+        if(isMyWriterAnnotated && isPostAnnotated) {
+            return true;
+        }
+        return false;
+    }
+
+    public void writeTo(List arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4,
+        MultivaluedMap<String, Object> arg5, OutputStream arg6) throws IOException,
+        WebApplicationException {
+        Writer writer = new OutputStreamWriter(arg6);
+        writer.write("postannotation:");
+        for (Object o : arg0) {
+            writer.write(o.toString());
+        }
+        writer.flush();
+    }
+}
\ No newline at end of file

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableSet.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableSet.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableSet.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableSet.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.providers.writers;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+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;
+
+@Provider
+public class MessageBodyWriterIsWritableSet implements MessageBodyWriter<Set> {
+
+    public long getSize(Set arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4) {
+        return -1;
+    }
+
+    public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        if (arg0.isAssignableFrom(HashSet.class)) {
+            if (arg1 instanceof Class) {
+                return arg1.equals(HashSet.class);
+            }
+        }
+        return false;
+    }
+
+    @SuppressWarnings({ "unchecked", "cast" })
+    public void writeTo(Set arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4,
+        MultivaluedMap<String, Object> arg5, OutputStream arg6) throws IOException,
+        WebApplicationException {
+        Writer writer = new OutputStreamWriter(arg6);
+        Set<?> s = (Set<?>) arg0;
+        writer.write("set:");
+        List list = new ArrayList(s);
+        Collections.sort(list);
+        for (Object o : list) {
+            writer.write(o.toString());
+        }
+        writer.flush();
+
+    }
+
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableThrowsExceptions.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableThrowsExceptions.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableThrowsExceptions.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MessageBodyWriterIsWritableThrowsExceptions.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.providers.writers;
+
+import java.io.IOException;
+import java.io.OutputStream;
+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.core.Response;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class MessageBodyWriterIsWritableThrowsExceptions implements MessageBodyWriter<Object> {
+
+    public long getSize(Object arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4) {
+        return -1;
+    }
+
+    public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        if (arg3.equals(new MediaType("throw", "runtime"))) {
+            throw new RuntimeException();
+        } else if (arg3.equals(new MediaType("throw", "nullpointer"))) {
+            throw new NullPointerException();
+        } else if (arg3.equals(new MediaType("throw", "webapplicationexception"))) {
+            throw new WebApplicationException(Response.status(461).entity(
+                "throwiswritableexception").build());
+        }
+        return false;
+    }
+
+    public void writeTo(Object arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4,
+        MultivaluedMap<String, Object> arg5, OutputStream arg6) throws IOException,
+        WebApplicationException {
+        /* do nothing */
+    }
+
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MyWriterAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MyWriterAnnotation.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MyWriterAnnotation.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/MyWriterAnnotation.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.providers.writers;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.PARAMETER,
+    ElementType.METHOD })
+public @interface MyWriterAnnotation {
+
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/Queue.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/Queue.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/Queue.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/Queue.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.wink.jaxrs.test.providers.writers;
+
+/**
+ * this class is a dummy class to fill in for the Queue we were originally
+ * using from JDK6.
+ *
+ * @param <T>
+ */
+public interface Queue<T> extends Iterable<T> {
+
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/WriterResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/WriterResource.java?rev=791696&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/WriterResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/java/org/apache/wink/jaxrs/test/providers/writers/WriterResource.java Tue Jul  7 04:07:57 2009
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.providers.writers;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.GenericEntity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.xml.transform.dom.DOMSource;
+
+@Path("jaxrs/tests/providers/messagebodywriter")
+public class WriterResource {
+
+    private static int counter = 0;
+
+    @GET
+    @Path("concretetype")
+    public String getConcretTypeBack() {
+        return "Hello there";
+    }
+
+    @GET
+    @Path("contentlength")
+    @CustomAnnotation
+    public Response getContentLength(@QueryParam("mt") String mt, @QueryParam("class") String clazz) {
+        if (clazz == null) {
+            byte[] barr = new byte[100000];
+            for (int c = 0; c < barr.length; ++c) {
+                barr[c] = (byte) c;
+            }
+            return Response.ok(barr).type(mt).build();
+        } else if ("Vector".equals(clazz)) {
+            Vector v = new Vector(2);
+            v.add("Hello");
+            v.add("There");
+            return Response.ok(v).type(mt).build();
+        } else if ("ListInteger".equals(clazz)) {
+            List<Integer> v = new ArrayList<Integer>(2);
+            v.add(1);
+            v.add(2);
+            return Response.ok(new GenericEntity<List<Integer>>(v) {
+            }).build();
+        } else if ("String".equals(clazz)) {
+            return Response.ok("hello there").build();
+        }
+        return null;
+    }
+
+    @Path("classtype")
+    @GET
+    public Object getWriterClassType(@QueryParam("type") String type) {
+        if ("deque".equals(type)) {
+            ArrayDeque<String> d = new ArrayDeque<String>();
+            d.add("str:foo");
+            d.add("str:bar");
+            return d;
+        } else if ("hashmap".equals(type)) {
+            return new HashMap<String, String>();
+        } else if ("string".equals(type)) {
+            return "str:foobar";
+        } else if ("stringcontenttype".equals(type)) {
+            return Response.ok("str:foobarcontenttype").type(MediaType.APPLICATION_XML_TYPE)
+                .build();
+        } else if ("sourcecontenttype".equals(type)) {
+            return Response.ok(new DOMSource()).type(MediaType.APPLICATION_JSON).build();
+        } else if ("source".equals(type)) {
+            return Response.ok(new DOMSource()).type(MediaType.TEXT_XML).build();
+        }
+        return null;
+    }
+
+    @Path("notannotated")
+    @GET
+    public Object getWriterNotAnnotatedMethod() {
+        List<String> l = new ArrayList<String>();
+        l.add("foo");
+        l.add("bar");
+        return l;
+    }
+
+    @Path("annotated")
+    @GET
+    @MyWriterAnnotation
+    public Object getWriterAnnotatedMethod() {
+        List<String> l = new ArrayList<String>();
+        l.add("foo");
+        l.add("bar");
+        return l;
+    }
+
+    @Path("annotated")
+    @POST
+    @MyWriterAnnotation
+    public Object postWriterAnnotatedMethod() {
+        List<String> l = new ArrayList<String>();
+        l.add("foo");
+        l.add("bar");
+        return l;
+    }
+
+    @Path("genericentity")
+    @POST
+    public Response getWriterResponse(@QueryParam("query") String q) {
+        if ("setstring".equals(q)) {
+            HashSet<String> s = new HashSet<String>();
+            s.add("hello");
+            s.add("world");
+            return Response.ok(new GenericEntity<Set<String>>(s) {
+            }).build();
+        } else if ("setinteger".equals(q)) {
+            HashSet<Integer> s = new HashSet<Integer>();
+            s.add(Integer.valueOf(1));
+            s.add(Integer.valueOf(2));
+            return Response.ok(new GenericEntity<Set<Integer>>(s) {
+            }).build();
+        } else if ("setshort".equals(q)) {
+            HashSet<Short> s = new HashSet<Short>();
+            s.add(Short.valueOf((short) 1));
+            s.add(Short.valueOf((short) 2));
+            return Response.ok(new GenericEntity<Set<Short>>(s) {
+            }).build();
+        }
+        return null;
+    }
+
+    @Path("nogenericentity")
+    @POST
+    public Response getNoWriterResponse(@QueryParam("query") String q) {
+        if ("setstring".equals(q)) {
+            HashSet<String> s = new HashSet<String>();
+            s.add("hello");
+            s.add("world");
+            return Response.ok(s).build();
+        } else if ("setinteger".equals(q)) {
+            HashSet<Integer> s = new HashSet<Integer>();
+            s.add(Integer.valueOf(1));
+            s.add(Integer.valueOf(2));
+            return Response.ok(s).build();
+        } else if ("setshort".equals(q)) {
+            HashSet<Short> s = new HashSet<Short>();
+            s.add(Short.valueOf((short) 1));
+            s.add(Short.valueOf((short) 2));
+            return Response.ok(s).build();
+        }
+        return null;
+    }
+
+    @Path("mediatype")
+    @POST
+    public Response getMediaType(@QueryParam("mt") String mt) {
+        HashMap<String, String> hm = new HashMap<String, String>();
+        hm.put("foo", "bar");
+        return Response.ok(hm).type(mt).build();
+    }
+
+    @Path("throwsexception")
+    @POST
+    public Response throwsException(@QueryParam("mt") String mt) {
+        return Response.ok("something").type(mt).build();
+    }
+}

Modified: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/WEB-INF/web.xml?rev=791696&r1=791695&r2=791696&view=diff
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/WEB-INF/web.xml (original)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/WEB-INF/web.xml Tue Jul  7 04:07:57 2009
@@ -1,22 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-    
-     http://www.apache.org/licenses/LICENSE-2.0
-    
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
--->
+    <!--
+        Licensed to the Apache Software Foundation (ASF) under one or
+        more contributor license agreements. See the NOTICE file
+        distributed with this work for additional information regarding
+        copyright ownership. The ASF licenses this file to you under the
+        Apache License, Version 2.0 (the "License"); you may not use
+        this file except in compliance with the License. You may obtain
+        a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+        applicable law or agreed to in writing, software distributed
+        under the License is distributed on an "AS IS" BASIS, WITHOUT
+        WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        See the License for the specific language governing permissions
+        and limitations under the License.
+    -->
 
 <!DOCTYPE web-app PUBLIC
  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
@@ -25,16 +23,67 @@
 <web-app>
     <display-name>Archetype Created Web Application</display-name>
     <servlet>
+        <servlet-name>MessageBodyReaders</servlet-name>
+        <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+        <init-param>
+            <param-name>javax.ws.rs.Application</param-name>
+            <param-value>org.apache.wink.jaxrs.test.providers.readers.Application</param-value>
+        </init-param>
+        <init-param>
+            <param-name>requestProcessorAttribute</param-name>
+            <param-value>requestProcessorAttribute_3</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet>
         <servlet-name>MessageBodyReaderExceptions</servlet-name>
         <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
         <init-param>
             <param-name>javax.ws.rs.Application</param-name>
             <param-value>org.apache.wink.jaxrs.test.providers.readerexceptions.Application</param-value>
         </init-param>
+        <init-param>
+            <param-name>requestProcessorAttribute</param-name>
+            <param-value>requestProcessorAttribute_2</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet>
+        <servlet-name>MessageBodyWriters</servlet-name>
+        <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+        <init-param>
+            <param-name>javax.ws.rs.Application</param-name>
+            <param-value>org.apache.wink.jaxrs.test.providers.writers.Application</param-value>
+        </init-param>
+        <init-param>
+            <param-name>requestProcessorAttribute</param-name>
+            <param-value>requestProcessorAttribute_4</param-value>
+        </init-param>
         <load-on-startup>1</load-on-startup>
     </servlet>
+    <servlet>
+        <servlet-name>MessageBodyWriterExceptions</servlet-name>
+        <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+        <init-param>
+            <param-name>javax.ws.rs.Application</param-name>
+            <param-value>org.apache.wink.jaxrs.test.providers.writerexceptions.Application</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>MessageBodyReaders</servlet-name>
+        <url-pattern>/readers/*</url-pattern>
+    </servlet-mapping>
     <servlet-mapping>
         <servlet-name>MessageBodyReaderExceptions</servlet-name>
         <url-pattern>/readerexceptions/*</url-pattern>
     </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>MessageBodyWriters</servlet-name>
+        <url-pattern>/writers/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>MessageBodyWriterExceptions</servlet-name>
+        <url-pattern>/writerexceptions/*</url-pattern>
+    </servlet-mapping>
 </web-app>

Modified: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/test/java/org/apache/wink/jaxrs/test/providers/readerexceptions/JAXRSMessageBodyReaderExceptionsTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/test/java/org/apache/wink/jaxrs/test/providers/readerexceptions/JAXRSMessageBodyReaderExceptionsTest.java?rev=791696&r1=791695&r2=791696&view=diff
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/test/java/org/apache/wink/jaxrs/test/providers/readerexceptions/JAXRSMessageBodyReaderExceptionsTest.java (original)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/test/java/org/apache/wink/jaxrs/test/providers/readerexceptions/JAXRSMessageBodyReaderExceptionsTest.java Tue Jul  7 04:07:57 2009
@@ -39,186 +39,203 @@
     public String getBaseURI() {
         return ServerEnvironmentInfo.getBaseURI() + "/readerexceptions";
     }
-    
-    public void testNothing() {
-        /*
-         * dummy test method
-         */
-    }
-//
-//    /**
-//     * Tests that an exception thrown from the
-//     * {@link MessageBodyReader#isReadable(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
-//     * method which is not mapped to an {@link ExceptionMapper} is still thrown.
-//     * 
-//     * @throws HttpException
-//     * @throws IOException
-//     */
-//    public void testIsReadableExceptionThrownWhichIsNotMappedIsThrownOut() throws HttpException, IOException {
-//        HttpClient client = new HttpClient();
-//
-//        PostMethod postMethod =
-//            new PostMethod(getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/messagebodyreaderexceptions");
-//        postMethod.setRequestEntity(new StringRequestEntity("ignored input", "readable/throwruntime", "UTF-8"));
-//        try {
-//            client.executeMethod(postMethod);
-//            assertEquals(500, postMethod.getStatusCode());
-//            // assertLogContainsException("javax.servlet.ServletException");
-//        } finally {
-//            postMethod.releaseConnection();
-//        }
-//    }
-//
-//    /**
-//     * Tests that an exception thrown from the
-//     * {@link MessageBodyReader#isReadable(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
-//     * method which is mapped to an {@link ExceptionMapper} uses the mapper.
-//     * 
-//     * @throws HttpException
-//     * @throws IOException
-//     */
-//    public void testIsReadableExceptionThrownWhichIsMappedUsesExceptionMapper() throws HttpException, IOException {
-//        HttpClient client = new HttpClient();
-//
-//        PostMethod postMethod =
-//            new PostMethod(getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/messagebodyreaderexceptions");
-//        postMethod.setRequestEntity(new StringRequestEntity("ignored input", "readable/thrownull", "UTF-8"));
-//        try {
-//            client.executeMethod(postMethod);
-//            assertEquals(495, postMethod.getStatusCode());
-//            assertEquals("Invoked" + NullPointerExceptionMapper.class.getName(), postMethod.getResponseBodyAsString());
-//            assertEquals("text/plain", postMethod.getResponseHeader("Content-Type").getValue());
-//            // assertLogContainsException("NullPointerException");
-//        } finally {
-//            postMethod.releaseConnection();
-//        }
-//    }
-//
-//    /**
-//     * Tests that a {@link WebApplicationException} thrown from the
-//     * {@link MessageBodyReader#isReadable(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
-//     * method is correctly processed.
-//     * 
-//     * @throws HttpException
-//     * @throws IOException
-//     */
-//    public void testIsReadableWebApplicationExceptionThrown() throws HttpException, IOException {
-//        HttpClient client = new HttpClient();
-//
-//        PostMethod postMethod =
-//            new PostMethod(getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/messagebodyreaderexceptions");
-//        postMethod.setRequestEntity(new StringRequestEntity("ignored input", "readable/throwwebapplicationexception",
-//                                                            "UTF-8"));
-//        try {
-//            client.executeMethod(postMethod);
-//            assertEquals(499, postMethod.getStatusCode());
-//            assertEquals("can not read type", postMethod.getResponseBodyAsString());
-//            // assertEquals("application/octet-stream",
-//            // postMethod.getResponseHeader("Content-Type").getValue());
-//            // assertLogContainsException("WebApplicationException");
-//        } finally {
-//            postMethod.releaseConnection();
-//        }
-//    }
-//
-//    /**
-//     * Tests that an exception thrown from the
-//     * {@link MessageBodyReader#readFrom(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.InputStream)}
-//     * method which is not mapped to an {@link ExceptionMapper} is still thrown.
-//     * 
-//     * @throws HttpException
-//     * @throws IOException
-//     */
-//    public void testReadFromExceptionThrownWhichIsNotMappedIsThrownOut() throws HttpException, IOException {
-//        HttpClient client = new HttpClient();
-//
-//        PostMethod postMethod =
-//            new PostMethod(getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/messagebodyreaderexceptions");
-//        postMethod.setRequestEntity(new StringRequestEntity("ignored input", "readfrom/throwruntime", "UTF-8"));
-//        try {
-//            client.executeMethod(postMethod);
-//            assertEquals(500, postMethod.getStatusCode());
-//            // assertLogContainsException("javax.servlet.ServletException");
-//        } finally {
-//            postMethod.releaseConnection();
-//        }
-//    }
-//
-//    /**
-//     * Tests that an exception thrown from the
-//     * {@link MessageBodyReader#readFrom(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.InputStream)}
-//     * method which is mapped to an {@link ExceptionMapper} uses the mapper.
-//     * 
-//     * @throws HttpException
-//     * @throws IOException
-//     */
-//    public void testReadFromExceptionThrownWhichIsMappedUsesExceptionMapper() throws HttpException, IOException {
-//        HttpClient client = new HttpClient();
-//
-//        PostMethod postMethod =
-//            new PostMethod(getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/messagebodyreaderexceptions");
-//        postMethod.setRequestEntity(new StringRequestEntity("ignored input", "readfrom/thrownull", "UTF-8"));
-//        try {
-//            client.executeMethod(postMethod);
-//            assertEquals(495, postMethod.getStatusCode());
-//            assertEquals("Invoked" + NullPointerExceptionMapper.class.getName(), postMethod.getResponseBodyAsString());
-//            assertEquals("text/plain", postMethod.getResponseHeader("Content-Type").getValue());
-//            // assertLogContainsException("NullPointerException");
-//        } finally {
-//            postMethod.releaseConnection();
-//        }
-//    }
-//
-//    /**
-//     * Tests that a {@link WebApplicationException} thrown from the
-//     * {@link MessageBodyReader#readFrom(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.InputStream)}
-//     * method is correctly processed.
-//     * 
-//     * @throws HttpException
-//     * @throws IOException
-//     */
-//    public void testReadFromWebApplicationExceptionThrown() throws HttpException, IOException {
-//        HttpClient client = new HttpClient();
-//
-//        PostMethod postMethod =
-//            new PostMethod(getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/messagebodyreaderexceptions");
-//        postMethod.setRequestEntity(new StringRequestEntity("ignored input", "readfrom/throwwebapplicationexception",
-//                                                            "UTF-8"));
-//        try {
-//            client.executeMethod(postMethod);
-//            assertEquals(498, postMethod.getStatusCode());
-//            assertEquals("can not read type in readfrom", postMethod.getResponseBodyAsString());
-//            // assertEquals("application/octet-stream",
-//            // postMethod.getResponseHeader("Content-Type").getValue());
-//            // assertLogContainsException("WebApplicationException");
-//        } finally {
-//            postMethod.releaseConnection();
-//        }
-//    }
-//
-//    /**
-//     * Tests that a {@link IOException} thrown from the
-//     * {@link MessageBodyReader#readFrom(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.InputStream)}
-//     * method can be mapped correctly.
-//     * 
-//     * @throws HttpException
-//     * @throws IOException
-//     */
-//    public void testReadFromIOExceptionThrown() throws HttpException, IOException {
-//        HttpClient client = new HttpClient();
-//
-//        PostMethod postMethod =
-//            new PostMethod(getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/messagebodyreaderexceptions");
-//        postMethod.setRequestEntity(new StringRequestEntity("ignored input", "readfrom/throwioexception", "UTF-8"));
-//        try {
-//            client.executeMethod(postMethod);
-//            assertEquals(455, postMethod.getStatusCode());
-//            assertEquals("Invoked" + IOExceptionMapper.class.getName(), postMethod.getResponseBodyAsString());
-//            // assertEquals("application/octet-stream",
-//            // postMethod.getResponseHeader("Content-Type").getValue());
-//            // assertLogContainsException("IOException");
-//        } finally {
-//            postMethod.releaseConnection();
-//        }
-//    }
+
+    /**
+     * Tests that an exception thrown from the
+     * {@link MessageBodyReader#isReadable(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
+     * method which is not mapped to an {@link ExceptionMapper} is still thrown.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testIsReadableExceptionThrownWhichIsNotMappedIsThrownOut() throws HttpException,
+        IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod =
+            new PostMethod(
+                           getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/messagebodyreaderexceptions");
+        postMethod.setRequestEntity(new StringRequestEntity("ignored input",
+                                                            "readable/throwruntime", "UTF-8"));
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(500, postMethod.getStatusCode());
+            // assertLogContainsException("javax.servlet.ServletException");
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that an exception thrown from the
+     * {@link MessageBodyReader#isReadable(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
+     * method which is mapped to an {@link ExceptionMapper} uses the mapper.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testIsReadableExceptionThrownWhichIsMappedUsesExceptionMapper()
+        throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod =
+            new PostMethod(
+                           getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/messagebodyreaderexceptions");
+        postMethod.setRequestEntity(new StringRequestEntity("ignored input", "readable/thrownull",
+                                                            "UTF-8"));
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(495, postMethod.getStatusCode());
+            assertEquals("Invoked" + NullPointerExceptionMapper.class.getName(), postMethod
+                .getResponseBodyAsString());
+            assertEquals("text/plain", postMethod.getResponseHeader("Content-Type").getValue());
+            // assertLogContainsException("NullPointerException");
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a {@link WebApplicationException} thrown from the
+     * {@link MessageBodyReader#isReadable(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
+     * method is correctly processed.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testIsReadableWebApplicationExceptionThrown() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod =
+            new PostMethod(
+                           getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/messagebodyreaderexceptions");
+        postMethod
+            .setRequestEntity(new StringRequestEntity("ignored input",
+                                                      "readable/throwwebapplicationexception",
+                                                      "UTF-8"));
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(499, postMethod.getStatusCode());
+            assertEquals("can not read type", postMethod.getResponseBodyAsString());
+            // assertEquals("application/octet-stream",
+            // postMethod.getResponseHeader("Content-Type").getValue());
+            // assertLogContainsException("WebApplicationException");
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that an exception thrown from the
+     * {@link MessageBodyReader#readFrom(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.InputStream)}
+     * method which is not mapped to an {@link ExceptionMapper} is still thrown.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testReadFromExceptionThrownWhichIsNotMappedIsThrownOut() throws HttpException,
+        IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod =
+            new PostMethod(
+                           getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/messagebodyreaderexceptions");
+        postMethod.setRequestEntity(new StringRequestEntity("ignored input",
+                                                            "readfrom/throwruntime", "UTF-8"));
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(500, postMethod.getStatusCode());
+            // assertLogContainsException("javax.servlet.ServletException");
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that an exception thrown from the
+     * {@link MessageBodyReader#readFrom(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.InputStream)}
+     * method which is mapped to an {@link ExceptionMapper} uses the mapper.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testReadFromExceptionThrownWhichIsMappedUsesExceptionMapper() throws HttpException,
+        IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod =
+            new PostMethod(
+                           getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/messagebodyreaderexceptions");
+        postMethod.setRequestEntity(new StringRequestEntity("ignored input", "readfrom/thrownull",
+                                                            "UTF-8"));
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(495, postMethod.getStatusCode());
+            assertEquals("Invoked" + NullPointerExceptionMapper.class.getName(), postMethod
+                .getResponseBodyAsString());
+            assertEquals("text/plain", postMethod.getResponseHeader("Content-Type").getValue());
+            // assertLogContainsException("NullPointerException");
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a {@link WebApplicationException} thrown from the
+     * {@link MessageBodyReader#readFrom(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.InputStream)}
+     * method is correctly processed.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testReadFromWebApplicationExceptionThrown() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod =
+            new PostMethod(
+                           getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/messagebodyreaderexceptions");
+        postMethod
+            .setRequestEntity(new StringRequestEntity("ignored input",
+                                                      "readfrom/throwwebapplicationexception",
+                                                      "UTF-8"));
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(498, postMethod.getStatusCode());
+            assertEquals("can not read type in readfrom", postMethod.getResponseBodyAsString());
+            // assertEquals("application/octet-stream",
+            // postMethod.getResponseHeader("Content-Type").getValue());
+            // assertLogContainsException("WebApplicationException");
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a {@link IOException} thrown from the
+     * {@link MessageBodyReader#readFrom(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.InputStream)}
+     * method can be mapped correctly.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testReadFromIOExceptionThrown() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod =
+            new PostMethod(
+                           getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/messagebodyreaderexceptions");
+        postMethod.setRequestEntity(new StringRequestEntity("ignored input",
+                                                            "readfrom/throwioexception", "UTF-8"));
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(455, postMethod.getStatusCode());
+            assertEquals("Invoked" + IOExceptionMapper.class.getName(), postMethod
+                .getResponseBodyAsString());
+            // assertEquals("application/octet-stream",
+            // postMethod.getResponseHeader("Content-Type").getValue());
+            // assertLogContainsException("IOException");
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
 }