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/08/07 05:10:46 UTC

svn commit: r801869 [11/21] - in /incubator/wink/trunk: wink-integration-test/ wink-integration-test/wink-server-integration-test-support/ wink-integration-test/wink-server-integration-test-support/src/main/java/org/apache/wink/test/integration/ wink-i...

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookNullException.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookNullException.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookNullException.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookNullException.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,41 @@
+/*
+ * 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.itest.exceptionmappers.nullconditions;
+
+public class GuestbookNullException extends RuntimeException {
+
+    private static final long serialVersionUID = 1L;
+
+    public GuestbookNullException() {
+        super();
+    }
+
+    public GuestbookNullException(String message) {
+        super(message);
+    }
+
+    public GuestbookNullException(Throwable cause) {
+        super(cause);
+    }
+
+    public GuestbookNullException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookNullExceptionMapper.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookNullExceptionMapper.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookNullExceptionMapper.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookNullExceptionMapper.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,34 @@
+/*
+ * 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.itest.exceptionmappers.nullconditions;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class GuestbookNullExceptionMapper implements ExceptionMapper<GuestbookNullException> {
+
+    public Response toResponse(GuestbookNullException arg0) {
+        /* intentionally return null */
+        return null;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookResource.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,100 @@
+/*
+ * 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.itest.exceptionmappers.nullconditions;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
+@Path("guestbooknullconditions")
+public class GuestbookResource {
+
+    @GET
+    @Path("emptywebappexception")
+    public String exception() {
+        throw new WebApplicationException();
+    }
+
+    @GET
+    @Path("webappexceptionwithcause")
+    public String exceptionWithCause() {
+        throw new WebApplicationException(new GuestbookException("Threw checked exception"));
+    }
+
+    @POST
+    @Path("webappexceptionwithcauseandstatus")
+    public String exceptionWithCauseAndStatus() {
+        throw new WebApplicationException(new GuestbookException("Threw checked exception"), 499);
+    }
+
+    @PUT
+    @Path("webappexceptionwithcauseandresponse")
+    public String exceptionWithCauseAndResponse() {
+        Response resp =
+            Response.status(Status.NOT_ACCEPTABLE).entity("Entity inside response").build();
+        throw new WebApplicationException(new GuestbookException("Threw checked exception"), resp);
+    }
+
+    @DELETE
+    @Path("webappexceptionwithcauseandresponsestatus")
+    public String exceptionWithCauseAndResponseStatus() {
+        throw new WebApplicationException(new GuestbookException("Threw checked exception"),
+                                          Response.Status.BAD_REQUEST);
+    }
+
+    @GET
+    @Path("exceptionmappernull")
+    public String exceptionMapperReturnNull() {
+        throw new GuestbookNullException("Should not see me");
+    }
+
+    @POST
+    @Path("exceptionmapperthrowsexception")
+    public String exceptionMapperThrowsException() throws GuestbookThrowException {
+        throw new GuestbookThrowException("Re-throw an exception");
+    }
+
+    @POST
+    @Path("exceptionmapperthrowserror")
+    public String exceptionMapperThrowsError() throws GuestbookThrowException {
+        throw new GuestbookThrowException("Re-throw an error");
+    }
+
+    @PUT
+    @Path("throwableexceptionmapper")
+    public String throwableExceptionMapper() throws GuestbookThrowable {
+        throw new GuestbookThrowable();
+    }
+
+    @DELETE
+    @Path("throwsthrowable")
+    public String throwThrowable() throws Throwable {
+        throw new Throwable("Throwable was thrown") {
+
+            private static final long serialVersionUID = 1L;
+
+        };
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookRuntimeExceptionMapper.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookRuntimeExceptionMapper.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookRuntimeExceptionMapper.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookRuntimeExceptionMapper.java Fri Aug  7 03:10:22 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.itest.exceptionmappers.nullconditions;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+
+public class GuestbookRuntimeExceptionMapper implements ExceptionMapper<RuntimeException> {
+
+    public Response toResponse(RuntimeException arg0) {
+        return Response.serverError().entity("RuntimeExceptionMapper was used").build();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookThrowException.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookThrowException.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookThrowException.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookThrowException.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,41 @@
+/*
+ * 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.itest.exceptionmappers.nullconditions;
+
+public class GuestbookThrowException extends Exception {
+
+    private static final long serialVersionUID = 1L;
+
+    public GuestbookThrowException() {
+        super();
+    }
+
+    public GuestbookThrowException(String message) {
+        super(message);
+    }
+
+    public GuestbookThrowException(Throwable cause) {
+        super(cause);
+    }
+
+    public GuestbookThrowException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookThrowExceptionMapper.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookThrowExceptionMapper.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookThrowExceptionMapper.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookThrowExceptionMapper.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,44 @@
+/*
+ * 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.itest.exceptionmappers.nullconditions;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class GuestbookThrowExceptionMapper implements ExceptionMapper<GuestbookThrowException> {
+
+    public Response toResponse(GuestbookThrowException arg0) {
+        /*
+         * throwing exception/error in here should cause a HTTP 500 status to
+         * occur
+         */
+
+        if (arg0.getMessage().contains("exception")) {
+            throw new GuestbookNullException();
+        } else {
+            throw new Error("error");
+        }
+
+        // TODO: throw this inside a subresource locator
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookThrowable.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookThrowable.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookThrowable.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookThrowable.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,26 @@
+/*
+ * 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.itest.exceptionmappers.nullconditions;
+
+public class GuestbookThrowable extends Throwable {
+
+    private static final long serialVersionUID = 1L;
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookThrowableMapper.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookThrowableMapper.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookThrowableMapper.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookThrowableMapper.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,33 @@
+/*
+ * 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.itest.exceptionmappers.nullconditions;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class GuestbookThrowableMapper implements ExceptionMapper<GuestbookThrowable> {
+
+    public Response toResponse(GuestbookThrowable arg0) {
+        return Response.serverError().entity("Throwable mapper used").build();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/Application.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/Application.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/Application.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,46 @@
+/*
+ * 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.itest.readerexceptions;
+
+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(ExceptionResource.class);
+        // clazzes.add(IOExceptionMapper.class);
+        // clazzes.add(MyMessageBodyReader.class);
+        // clazzes.add(NullPointerExceptionMapper.class);
+        return clazzes;
+    }
+
+    @Override
+    public Set<Object> getSingletons() {
+        Set<Object> singletons = new HashSet<Object>();
+        singletons.add(new IOExceptionMapper());
+        singletons.add(new MyMessageBodyReader());
+        singletons.add(new NullPointerExceptionMapper());
+        return singletons;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/ExceptionResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/ExceptionResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/ExceptionResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/ExceptionResource.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,33 @@
+/*
+ * 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.itest.readerexceptions;
+
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+@Path("jaxrs/tests/providers/messagebodyreader/reader/messagebodyreaderexceptions")
+public class ExceptionResource {
+
+    @POST
+    public String echo(String input) {
+        return "echo:" + input;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/IOExceptionMapper.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/IOExceptionMapper.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/IOExceptionMapper.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/IOExceptionMapper.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,35 @@
+/*
+ * 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.itest.readerexceptions;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class IOExceptionMapper implements ExceptionMapper<IOException> {
+
+    public Response toResponse(IOException arg0) {
+        return Response.status(455).entity("Invoked" + this.getClass().getName()).build();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/MyMessageBodyReader.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/MyMessageBodyReader.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/MyMessageBodyReader.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/MyMessageBodyReader.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,69 @@
+/*
+ * 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.itest.readerexceptions;
+
+import java.io.IOException;
+import java.io.InputStream;
+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.MessageBodyReader;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class MyMessageBodyReader implements MessageBodyReader<Object> {
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        if (arg3.isCompatible(new MediaType("readable", "throwruntime"))) {
+            throw new RuntimeException();
+        } else if (arg3.isCompatible(new MediaType("readable", "thrownull"))) {
+            throw new NullPointerException();
+        } else if (arg3.isCompatible(new MediaType("readable", "throwwebapplicationexception"))) {
+            throw new WebApplicationException(Response.status(499).entity("can not read type")
+                .build());
+        }
+
+        return arg0.equals(String.class);
+    }
+
+    public Object readFrom(Class<Object> arg0,
+                           Type arg1,
+                           Annotation[] arg2,
+                           MediaType arg3,
+                           MultivaluedMap<String, String> arg4,
+                           InputStream arg5) throws IOException, WebApplicationException {
+        if (arg3.isCompatible(new MediaType("readfrom", "thrownull"))) {
+            throw new NullPointerException();
+        } else if (arg3.isCompatible(new MediaType("readfrom", "throwwebapplicationexception"))) {
+            throw new WebApplicationException(Response.status(498)
+                .entity("can not read type in readfrom").build());
+        } else if (arg3.isCompatible(new MediaType("readfrom", "throwioexception"))) {
+            throw new IOException();
+        } else if (arg3.isCompatible(new MediaType("readfrom", "throwruntime"))) {
+            throw new RuntimeException();
+        }
+        return "read";
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/NullPointerExceptionMapper.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/NullPointerExceptionMapper.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/NullPointerExceptionMapper.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readerexceptions/NullPointerExceptionMapper.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,35 @@
+/*
+ * 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.itest.readerexceptions;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class NullPointerExceptionMapper implements ExceptionMapper<NullPointerException> {
+
+    public Response toResponse(NullPointerException arg0) {
+        return Response.status(495).entity("Invoked" + this.getClass().getName())
+            .type(MediaType.TEXT_PLAIN).build();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/Application.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/Application.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/Application.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,58 @@
+/*
+ * 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.itest.readers;
+
+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(ReaderResource.class);
+        // clazzes.add(MessageBodyReaderAnnotationList.class);
+        // clazzes.add(MessageBodyReaderMediaTypeSet.class);
+        // clazzes.add(MessageBodyReaderGenericEntityTypeQueue.class);
+        // clazzes.add(MessageBodyReaderClassDeque.class);
+        // clazzes.add(MessageBodyReaderThrowsExceptions.class);
+        // clazzes.add(MessageBodyReaderIsReadableThrowsRuntimeException.class);
+        // clazzes.add(MessageBodyReaderIsReadableThrowsWebAppException.class);
+        // clazzes.add(MessageBodyReaderReadFromDifferent.class);
+        // clazzes.add(MessageBodyReaderGenericType.class);
+        return clazzes;
+    }
+
+    @Override
+    public Set<Object> getSingletons() {
+        Set<Object> objs = new HashSet<Object>();
+        objs.add(new MessageBodyReaderAnnotationList());
+        objs.add(new MessageBodyReaderMediaTypeSet());
+        objs.add(new MessageBodyReaderGenericEntityTypeQueue());
+        objs.add(new MessageBodyReaderClassDeque());
+        objs.add(new MessageBodyReaderThrowsExceptions());
+        objs.add(new MessageBodyReaderIsReadableThrowsRuntimeException());
+        objs.add(new MessageBodyReaderIsReadableThrowsWebAppException());
+        objs.add(new MessageBodyReaderReadFromDifferent());
+        objs.add(new MessageBodyReaderGenericType());
+        return objs;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/ArrayDeque.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/ArrayDeque.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/ArrayDeque.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/ArrayDeque.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,43 @@
+/*
+ * 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.itest.readers;
+
+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<T> asList) {
+        list = asList;
+    }
+
+    public Iterator<T> iterator() {
+        return list.iterator();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/CustomAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/CustomAnnotation.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/CustomAnnotation.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/CustomAnnotation.java Fri Aug  7 03:10:22 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.itest.readers;
+
+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})
+public @interface CustomAnnotation {
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/Deque.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/Deque.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/Deque.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/Deque.java Fri Aug  7 03:10:22 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.itest.readers;
+
+/**
+ * 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-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderAnnotationList.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderAnnotationList.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderAnnotationList.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderAnnotationList.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,73 @@
+/*
+ * 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.itest.readers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.Provider;
+import javax.ws.rs.ext.Providers;
+
+@Provider
+@Consumes("text/plain")
+public class MessageBodyReaderAnnotationList implements MessageBodyReader<List> {
+
+    @Context
+    Providers providers;
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        for (Annotation ann : arg2) {
+            if (MyReaderAnnotation.class.equals(ann.annotationType())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public List readFrom(Class<List> arg0,
+                         Type arg1,
+                         Annotation[] arg2,
+                         MediaType arg3,
+                         MultivaluedMap<String, String> arg4,
+                         InputStream arg5) throws IOException, WebApplicationException {
+        String str = null;
+        try {
+            MessageBodyReader<String> strReader =
+                providers.getMessageBodyReader(String.class,
+                                               String.class,
+                                               arg2,
+                                               MediaType.TEXT_PLAIN_TYPE);
+            str = strReader.readFrom(String.class, String.class, arg2, arg3, arg4, arg5);
+        } catch (IOException e) {
+            throw new WebApplicationException(e);
+        }
+        return Arrays.asList(str.split("\r\n"));
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderClassDeque.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderClassDeque.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderClassDeque.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderClassDeque.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,66 @@
+/*
+ * 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.itest.readers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.Provider;
+import javax.ws.rs.ext.Providers;
+
+@Provider
+public class MessageBodyReaderClassDeque implements MessageBodyReader<Object> {
+
+    @Context
+    private Providers providers;
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        if (arg0.equals(Deque.class)) {
+            return true;
+        }
+        return false;
+    }
+
+    public Object readFrom(Class<Object> arg0,
+                           Type arg1,
+                           Annotation[] arg2,
+                           MediaType arg3,
+                           MultivaluedMap<String, String> arg4,
+                           InputStream arg5) throws IOException, WebApplicationException {
+        String str = null;
+        try {
+            MessageBodyReader<String> strReader =
+                providers.getMessageBodyReader(String.class, String.class, arg2, arg3);
+            str = strReader.readFrom(String.class, String.class, arg2, arg3, arg4, arg5);
+        } catch (IOException e) {
+            throw new WebApplicationException(e);
+        }
+        return new ArrayDeque<String>(Arrays.asList(str.split("\r\n")));
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderGenericEntityTypeQueue.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderGenericEntityTypeQueue.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderGenericEntityTypeQueue.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderGenericEntityTypeQueue.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,73 @@
+/*
+ * 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.itest.readers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.Provider;
+import javax.ws.rs.ext.Providers;
+
+@Provider
+public class MessageBodyReaderGenericEntityTypeQueue implements MessageBodyReader<Queue> {
+
+    @Context
+    private Providers providers;
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        if (arg1 instanceof ParameterizedType) {
+            ParameterizedType pt = (ParameterizedType)arg1;
+            Type[] actualArgumentTypes = pt.getActualTypeArguments();
+            return actualArgumentTypes != null && actualArgumentTypes.length == 1
+                && String.class.equals(actualArgumentTypes[0]);
+        }
+        return false;
+    }
+
+    public Queue readFrom(Class<Queue> arg0,
+                          Type arg1,
+                          Annotation[] arg2,
+                          MediaType arg3,
+                          MultivaluedMap<String, String> arg4,
+                          InputStream arg5) throws IOException, WebApplicationException {
+        String str = null;
+        try {
+            MessageBodyReader<String> strReader =
+                providers.getMessageBodyReader(String.class,
+                                               String.class,
+                                               arg2,
+                                               MediaType.TEXT_PLAIN_TYPE);
+            str = strReader.readFrom(String.class, String.class, arg2, arg3, arg4, arg5);
+        } catch (IOException e) {
+            throw new WebApplicationException(e);
+        }
+        return new ArrayDeque<String>(Arrays.asList(str.split("\r\n")));
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderGenericType.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderGenericType.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderGenericType.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderGenericType.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,164 @@
+/*
+ * 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.itest.readers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.Provider;
+import javax.ws.rs.ext.Providers;
+
+@Provider
+@Consumes("custom/generic")
+public class MessageBodyReaderGenericType implements MessageBodyReader<Object> {
+
+    @Context
+    Providers providers;
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        if (List.class.isAssignableFrom(arg0)) {
+            if (arg1 instanceof ParameterizedType) {
+                ParameterizedType pt = (ParameterizedType)arg1;
+                Type rawType = pt.getRawType();
+                if ((rawType instanceof Class) && (List.class.isAssignableFrom((Class)rawType))) {
+                    Type[] genericTypeArguments = pt.getActualTypeArguments();
+                    if (genericTypeArguments.length == 1) {
+                        Class argType = (Class)genericTypeArguments[0];
+                        if (Integer.class.isAssignableFrom(argType) || String.class
+                            .isAssignableFrom(argType)) {
+                            return true;
+                        }
+                    }
+                }
+            } else if (arg1 instanceof Class) {
+                return true;
+            }
+        }
+
+        if (arg1 instanceof Class) {
+            if (Integer.class.isAssignableFrom((Class)arg1)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public Object readFrom(Class<Object> arg0,
+                           Type arg1,
+                           Annotation[] arg2,
+                           MediaType arg3,
+                           MultivaluedMap<String, String> arg4,
+                           InputStream arg5) throws IOException, WebApplicationException {
+        if (List.class.isAssignableFrom(arg0)) {
+            if (arg1 instanceof ParameterizedType) {
+                ParameterizedType pt = (ParameterizedType)arg1;
+                Type rawType = pt.getRawType();
+                if ((rawType instanceof Class) && (List.class.isAssignableFrom((Class)rawType))) {
+                    Type[] genericTypeArguments = pt.getActualTypeArguments();
+                    if (genericTypeArguments.length == 1) {
+                        Class argType = (Class)genericTypeArguments[0];
+                        if (Integer.class.isAssignableFrom(argType)) {
+                            MessageBodyReader<String> strReader =
+                                providers.getMessageBodyReader(String.class,
+                                                               String.class,
+                                                               arg2,
+                                                               MediaType.TEXT_PLAIN_TYPE);
+                            String str =
+                                strReader.readFrom(String.class,
+                                                   String.class,
+                                                   arg2,
+                                                   arg3,
+                                                   arg4,
+                                                   arg5);
+                            String[] splitlines = str.split("\r\n");
+                            List<Integer> ret = new ArrayList<Integer>();
+                            for (String s : splitlines) {
+                                ret.add(Integer.valueOf(s));
+                            }
+                            return ret;
+                        } else if (String.class.isAssignableFrom(argType)) {
+                            MessageBodyReader<String> strReader =
+                                providers.getMessageBodyReader(String.class,
+                                                               String.class,
+                                                               arg2,
+                                                               MediaType.TEXT_PLAIN_TYPE);
+                            String str =
+                                strReader.readFrom(String.class,
+                                                   String.class,
+                                                   arg2,
+                                                   arg3,
+                                                   arg4,
+                                                   arg5);
+                            String[] splitlines = str.split("\r\n");
+                            List<String> ret = new ArrayList<String>();
+                            for (String s : splitlines) {
+                                ret.add("str:" + s);
+                            }
+                            return ret;
+                        }
+                    }
+                }
+            } else if (arg1 instanceof Class) {
+                MessageBodyReader<String> strReader =
+                    providers.getMessageBodyReader(String.class,
+                                                   String.class,
+                                                   arg2,
+                                                   MediaType.TEXT_PLAIN_TYPE);
+                String str = strReader.readFrom(String.class, String.class, arg2, arg3, arg4, arg5);
+                String[] splitlines = str.split("\r\n");
+                List<Object> ret = new ArrayList<Object>();
+                for (String s : splitlines) {
+                    ret.add("obj:" + s);
+                }
+                return ret;
+            }
+        }
+
+        if (arg1 instanceof Class) {
+            if (Integer.class.isAssignableFrom((Class)arg1)) {
+                MessageBodyReader<String> strReader =
+                    providers.getMessageBodyReader(String.class,
+                                                   String.class,
+                                                   arg2,
+                                                   MediaType.TEXT_PLAIN_TYPE);
+                String str = strReader.readFrom(String.class, String.class, arg2, arg3, arg4, arg5);
+                String[] splitlines = str.split("\r\n");
+                int sum = 0;
+                for (String s : splitlines) {
+                    sum += Integer.valueOf(s).intValue();
+                }
+                return Integer.valueOf(sum);
+            }
+        }
+        return null;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderIsReadableThrowsRuntimeException.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderIsReadableThrowsRuntimeException.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderIsReadableThrowsRuntimeException.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderIsReadableThrowsRuntimeException.java Fri Aug  7 03:10:22 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.itest.readers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+@Consumes("custom/runtimeexception")
+public class MessageBodyReaderIsReadableThrowsRuntimeException implements MessageBodyReader<Object> {
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        throw new NullPointerException();
+    }
+
+    public Object readFrom(Class<Object> arg0,
+                           Type arg1,
+                           Annotation[] arg2,
+                           MediaType arg3,
+                           MultivaluedMap<String, String> arg4,
+                           InputStream arg5) throws IOException, WebApplicationException {
+        return null;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderIsReadableThrowsWebAppException.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderIsReadableThrowsWebAppException.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderIsReadableThrowsWebAppException.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderIsReadableThrowsWebAppException.java Fri Aug  7 03:10:22 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.itest.readers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+@Consumes("custom/webapplicationexception")
+public class MessageBodyReaderIsReadableThrowsWebAppException implements MessageBodyReader<Object> {
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        throw new WebApplicationException(478);
+    }
+
+    public Object readFrom(Class<Object> arg0,
+                           Type arg1,
+                           Annotation[] arg2,
+                           MediaType arg3,
+                           MultivaluedMap<String, String> arg4,
+                           InputStream arg5) throws IOException, WebApplicationException {
+        return null;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderMediaTypeSet.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderMediaTypeSet.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderMediaTypeSet.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderMediaTypeSet.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,73 @@
+/*
+ * 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.itest.readers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.Provider;
+import javax.ws.rs.ext.Providers;
+
+@Provider
+@Consumes("custom/type")
+public class MessageBodyReaderMediaTypeSet implements MessageBodyReader<Set> {
+
+    @Context
+    private Providers providers;
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        if (MediaType.valueOf("custom/type").isCompatible(arg3)) {
+            return true;
+        }
+        return false;
+    }
+
+    public Set readFrom(Class<Set> arg0,
+                        Type arg1,
+                        Annotation[] arg2,
+                        MediaType arg3,
+                        MultivaluedMap<String, String> arg4,
+                        InputStream arg5) throws IOException, WebApplicationException {
+        String str = null;
+        try {
+            MessageBodyReader<String> strReader =
+                providers.getMessageBodyReader(String.class,
+                                               String.class,
+                                               arg2,
+                                               MediaType.TEXT_PLAIN_TYPE);
+            str = strReader.readFrom(String.class, String.class, arg2, arg3, arg4, arg5);
+        } catch (IOException e) {
+            throw new WebApplicationException(e);
+        }
+        return new HashSet<String>(Arrays.asList(str.split("\r\n")));
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderReadFromDifferent.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderReadFromDifferent.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderReadFromDifferent.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderReadFromDifferent.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,73 @@
+/*
+ * 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.itest.readers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+@Consumes( {"custom/long", "custom/int", "custom/byte", "custom/short"})
+public class MessageBodyReaderReadFromDifferent implements MessageBodyReader<Number> {
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        if (Integer.class.isAssignableFrom(arg0) || Long.class.isAssignableFrom(arg0)
+            || Byte.class.isAssignableFrom(arg0)
+            || Short.class.isAssignableFrom(arg0)) {
+            return true;
+        }
+        return false;
+    }
+
+    public Number readFrom(Class<Number> arg0,
+                           Type arg1,
+                           Annotation[] arg2,
+                           MediaType arg3,
+                           MultivaluedMap<String, String> arg4,
+                           InputStream arg5) throws IOException, WebApplicationException {
+        if (arg0.isAssignableFrom(Long.class)) {
+            return Long.valueOf(Long.MAX_VALUE);
+        }
+        if (arg0.isAssignableFrom(Integer.class)) {
+            return Integer.valueOf(Integer.MAX_VALUE);
+        }
+
+        for (Annotation ann : arg2) {
+            if (CustomAnnotation.class.equals(ann.annotationType())) {
+                return Short.valueOf(Short.MAX_VALUE);
+            }
+        }
+
+        if (arg3.isCompatible(MediaType.valueOf("custom/byte"))) {
+            return Byte.valueOf(Byte.MAX_VALUE);
+        }
+
+        return null;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderThrowsExceptions.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderThrowsExceptions.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderThrowsExceptions.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MessageBodyReaderThrowsExceptions.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,89 @@
+/*
+ * 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.itest.readers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.List;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.Provider;
+import javax.ws.rs.ext.Providers;
+
+@Provider
+@Consumes("custom/exception")
+public class MessageBodyReaderThrowsExceptions implements MessageBodyReader<Object> {
+
+    @Context
+    private Providers providers;
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        return true;
+    }
+
+    public Object readFrom(Class<Object> arg0,
+                           Type arg1,
+                           Annotation[] arg2,
+                           MediaType arg3,
+                           MultivaluedMap<String, String> arg4,
+                           InputStream arg5) throws IOException, WebApplicationException {
+        String str = null;
+        try {
+            MessageBodyReader<String> strReader =
+                providers.getMessageBodyReader(String.class,
+                                               String.class,
+                                               arg2,
+                                               MediaType.TEXT_PLAIN_TYPE);
+            str = strReader.readFrom(String.class, String.class, arg2, arg3, arg4, arg5);
+        } catch (IOException e) {
+            throw new WebApplicationException(e);
+        }
+
+        if ("ioexception".equals(str)) {
+            throw new IOException("Error");
+        } else if ("webapplicationexception".equals(str)) {
+            throw new WebApplicationException(477);
+        } else if (str.startsWith("closeinput")) {
+            arg5.close();
+        } else if ("thrownull".equals(str)) {
+            throw new NullPointerException();
+        }
+        StringBuilder sb = new StringBuilder(str);
+        /*
+         * leave this with weird capitalization. header keys should not be case
+         * sensitive.
+         */
+        List<String> headerValues = arg4.get("myCuStomHeaderToAppend");
+        if (headerValues != null) {
+            for (String value : headerValues) {
+                sb.append(value);
+            }
+        }
+        return sb.toString();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MyReaderAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MyReaderAnnotation.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MyReaderAnnotation.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/MyReaderAnnotation.java Fri Aug  7 03:10:22 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.itest.readers;
+
+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})
+public @interface MyReaderAnnotation {
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/Queue.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/Queue.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/Queue.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/Queue.java Fri Aug  7 03:10:22 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.itest.readers;
+
+/**
+ * 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-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/ReaderResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/ReaderResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/ReaderResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/readers/ReaderResource.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,220 @@
+/*
+ * 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.itest.readers;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.MediaType;
+
+@Path("jaxrs/tests/providers/messagebodyreader/reader")
+public class ReaderResource {
+
+    private static int counter = 0;
+
+    @Path("requestcontenttype")
+    @POST
+    @Consumes(MediaType.WILDCARD)
+    public String postReaderNoGenericEntityWildcard(byte[] barr) {
+        return "hello world";
+    }
+
+    @Path("requestcontenttype")
+    @POST
+    @Consumes(MediaType.APPLICATION_OCTET_STREAM)
+    public String postReaderNoGenericEntityOctetStream(byte[] barr) {
+        return "invoked octet-stream method";
+    }
+
+    @Path("unexpectedclasstype")
+    @POST
+    public String postReaderNoGenericEntity(HashMap<String, String> entity) {
+        return "hello";
+    }
+
+    @Path("classtype")
+    @POST
+    public String postReaderNoGenericEntity(Deque<String> entity) {
+        StringBuilder sb = new StringBuilder();
+        for (String s : entity) {
+            sb.append("echo:" + s);
+        }
+        return sb.toString();
+    }
+
+    @Path("nogenericentity")
+    @POST
+    public String postReaderNoGenericEntity(String str) {
+        return "echo:" + str;
+    }
+
+    @Path("genericentityempty")
+    @POST
+    public String postReaderGenericEntityEmpty(Queue entity) {
+        StringBuilder sb = new StringBuilder();
+        for (Object s : entity) {
+            sb.append(s.toString() + " there");
+        }
+        return sb.toString();
+    }
+
+    @Path("genericentityqueuestring")
+    @POST
+    public String postReaderGenericEntityListString(Queue<String> entity) {
+        StringBuilder sb = new StringBuilder();
+        for (String s : entity) {
+            sb.append(s + " there");
+        }
+        return sb.toString();
+    }
+
+    @Path("genericentityqueueobject")
+    @POST
+    public String postReaderGenericEntityListObject(Queue<Object> entity) {
+        StringBuilder sb = new StringBuilder();
+        for (Object o : entity) {
+            sb.append(o + " there");
+        }
+        return sb.toString();
+    }
+
+    @Path("notannotatedentity")
+    @POST
+    public String postResponseReaderNotAnnotated(List<String> entity) {
+        StringBuilder sb = new StringBuilder();
+        for (String s : entity) {
+            sb.append(s + " there");
+        }
+        return sb.toString();
+    }
+
+    @Path("annotatedentity")
+    @POST
+    public String postResponseReaderAnnotated(@MyReaderAnnotation List<String> entity) {
+        StringBuilder sb = new StringBuilder();
+        for (String s : entity) {
+            sb.append(s + " there");
+        }
+        return sb.toString();
+    }
+
+    @Path("multipleannotatedentity")
+    @POST
+    public String postResponseReaderAnnotatedMultipleTimes(@CustomAnnotation @MyReaderAnnotation List<String> entity) {
+        StringBuilder sb = new StringBuilder();
+        for (String s : entity) {
+            sb.append(s + " there");
+        }
+        return sb.toString();
+    }
+
+    @Path("mediatype")
+    @POST
+    public String postReaderMediaType(Set<String> entity) {
+        StringBuilder sb = new StringBuilder();
+        for (String s : entity) {
+            sb.append(s + " there");
+        }
+        return sb.toString();
+    }
+
+    @Path("readfrom")
+    @POST
+    public String postReaderReadFrom(String str) {
+        if ("clear".equals(str)) {
+            counter = -1;
+        }
+        ++counter;
+        return counter + "postReaderReadFrom:" + str;
+    }
+
+    @Path("readdifferentlyinteger")
+    @POST
+    public String postReaderReadFromClass(Integer value) {
+        return "" + value;
+    }
+
+    @Path("readdifferentlylong")
+    @POST
+    public String postReaderReadFromClass(Long value) {
+        return "" + value;
+    }
+
+    @Path("readdifferentlyshort")
+    @POST
+    public String postReaderReadFromAnnotation(@CustomAnnotation Short value) {
+        return "" + value;
+    }
+
+    @Path("readdifferentlyshortnoannotation")
+    @POST
+    public String postReaderReadFromNoAnnotation(Short value) {
+        return "" + value;
+    }
+
+    @Path("readdifferentlybytemediatype")
+    @POST
+    public String postReaderReadFromMediaType(Byte value) {
+        return "" + value;
+    }
+
+    @Path("readdifferentlygenericlist")
+    @POST
+    public String postReaderReadFromGenericType(List value) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("listnonspecified:");
+        for (Object o : value) {
+            sb.append(o.toString());
+        }
+        return sb.toString();
+    }
+
+    @Path("readdifferentlygenericliststring")
+    @POST
+    public String postReaderReadFromGenericTypeListString(List<String> value) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("liststring:");
+        for (String s : value) {
+            sb.append(s);
+        }
+        return sb.toString();
+    }
+
+    @Path("readdifferentlygenericlistinteger")
+    @POST
+    public String postReaderReadFromGenericTypeListInteger(List<Integer> value) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("listinteger:");
+        for (Integer i : value) {
+            sb.append(i.toString());
+        }
+        return sb.toString();
+    }
+
+    @Path("readdifferentlygenericinteger")
+    @POST
+    public String postReaderReadFromGenericTypeInteger(Integer value) {
+        return "integer:" + value;
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/Application.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/Application.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/Application.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,48 @@
+/*
+ * 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.itest.standard;
+
+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(FileResource.class);
+        return clazzes;
+    }
+
+    @Override
+    public Set<Object> getSingletons() {
+        Set<Object> objs = new HashSet<Object>();
+        objs.add(new BytesArrayResource());
+        objs.add(new InputStreamResource());
+        objs.add(new ReaderResource());
+        objs.add(new StreamingOutputResource());
+        objs.add(new MultiValuedMapResource());
+        objs.add(new SourceResource());
+        objs.add(new DataSourceResource());
+        objs.add(new DSResource());
+        return objs;
+    }
+
+}