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/21 03:45:55 UTC

svn commit: r796113 [3/5] - in /incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src: main/java/org/apache/wink/jaxrs/test/context/providers/ main/java/org/apache/wink/jaxrs/test/context/providers/otherxml...

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoDetailedMethods.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoDetailedMethods.java?rev=796113&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoDetailedMethods.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoDetailedMethods.java Tue Jul 21 01:45:53 2009
@@ -0,0 +1,342 @@
+/*
+ * 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.context.uriinfo;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.ws.rs.Encoded;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.PathSegment;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+@Path("/context/uriinfo/detailed")
+public class UriInfoDetailedMethods {
+
+    @GET
+    public Response getUriInfo(@Context UriInfo uriInfo, @QueryParam("reqInfo") String requestInfo) {
+        if ("getAbsolutePath".equals(requestInfo)) {
+            return Response.ok(uriInfo.getAbsolutePath().toString()).build();
+        } else if ("getAbsolutePathBuilder".equals(requestInfo)) {
+            return Response.ok(uriInfo.getAbsolutePathBuilder().host("abcd")
+                .build("unusedTemplateValue1").toString()).build();
+        } else if ("getBaseUri".equals(requestInfo)) {
+            return Response.ok(uriInfo.getBaseUri().toString()).build();
+        } else if ("getBaseUriBuilder".equals(requestInfo)) {
+            return Response.ok(uriInfo.getBaseUriBuilder().host("abcd")
+                .build("unusedTemplateValue1").toString()).build();
+        } else if ("getPath".equals(requestInfo)) {
+            return Response.ok(uriInfo.getPath()).build();
+        } else if ("getPathDecodedTrue".equals(requestInfo)) {
+            return Response.ok(uriInfo.getPath(true)).build();
+        } else if ("getPathDecodedFalse".equals(requestInfo)) {
+            return Response.ok(uriInfo.getPath(false)).build();
+        } else if ("getMatchedResources".equals(requestInfo)) {
+            List<Object> matchedResources = uriInfo.getMatchedResources();
+            String resourceClassNames = "";
+            for (Object o : matchedResources) {
+                Class<?> c = (Class<?>)o.getClass();
+                resourceClassNames += c.getName() + ":";
+            }
+            return Response.ok(resourceClassNames).build();
+            /*
+             * check if this should be the actual instances or just the classes
+             */
+        } else if ("getMatchedURIs".equals(requestInfo)) {
+            List<String> matchedURIs = uriInfo.getMatchedURIs();
+            String retStr = "";
+            for (String s : matchedURIs) {
+                retStr += s + ":";
+            }
+            return Response.ok(retStr).build();
+        } else if ("getMatchedURIsDecodedTrue".equals(requestInfo)) {
+            List<String> matchedURIs = uriInfo.getMatchedURIs(true);
+            String retStr = "";
+            for (String s : matchedURIs) {
+                retStr += s + ":";
+            }
+            return Response.ok(retStr).build();
+        } else if ("getMatchedURIsDecodedFalse".equals(requestInfo)) {
+            List<String> matchedURIs = uriInfo.getMatchedURIs(false);
+            String retStr = "";
+            for (String s : matchedURIs) {
+                retStr += s + ":";
+            }
+            return Response.ok(retStr).build();
+        } else if ("getPathParameters".equals(requestInfo)) {
+            MultivaluedMap<String, String> params = uriInfo.getPathParameters();
+            List<String> keys = new ArrayList<String>(params.keySet());
+            Collections.sort(keys);
+            /*
+             * may want to test for {test}/{test}
+             */
+            String retStr = "";
+            for (String k : keys) {
+                retStr += k + "=";
+
+                List<String> values = params.get(k);
+                for (String v : values) {
+                    retStr += v + ":";
+                }
+            }
+            return Response.ok(retStr).build();
+        } else if ("getPathParametersDecodedTrue".equals(requestInfo)) {
+            MultivaluedMap<String, String> params = uriInfo.getPathParameters(true);
+            List<String> keys = new ArrayList<String>(params.keySet());
+            Collections.sort(keys);
+            /*
+             * may want to test for {test}/{test}
+             */
+            String retStr = "";
+            for (String k : keys) {
+                retStr += k + "=";
+
+                List<String> values = params.get(k);
+                for (String v : values) {
+                    retStr += v + ":";
+                }
+            }
+            return Response.ok(retStr).build();
+        } else if ("getPathParametersDecodedFalse".equals(requestInfo)) {
+            MultivaluedMap<String, String> params = uriInfo.getPathParameters(false);
+            List<String> keys = new ArrayList<String>(params.keySet());
+            Collections.sort(keys);
+            /*
+             * may want to test for {test}/{test}
+             */
+            String retStr = "";
+            for (String k : keys) {
+                retStr += k + "=";
+
+                List<String> values = params.get(k);
+                for (String v : values) {
+                    retStr += v + ":";
+                }
+            }
+            return Response.ok(retStr).build();
+        } else if ("getPathSegments".equals(requestInfo)) {
+            List<PathSegment> params = uriInfo.getPathSegments();
+            String retStr = "";
+            for (PathSegment p : params) {
+                retStr += p.getPath() + "#";
+                MultivaluedMap<String, String> matrixParams = p.getMatrixParameters();
+
+                List<String> keys = new ArrayList<String>(matrixParams.keySet());
+                Collections.sort(keys);
+                for (String k : keys) {
+                    retStr += k + "=";
+                    List<String> values = matrixParams.get(k);
+                    for (String v : values) {
+                        retStr += v + ":";
+                    }
+                }
+                retStr += ":";
+            }
+            return Response.ok(retStr).build();
+        } else if ("getPathSegmentsDecodedFalse".equals(requestInfo)) {
+            List<PathSegment> params = uriInfo.getPathSegments(false);
+            String retStr = "";
+            for (PathSegment p : params) {
+                retStr += p.getPath() + "#";
+                MultivaluedMap<String, String> matrixParams = p.getMatrixParameters();
+
+                List<String> keys = new ArrayList<String>(matrixParams.keySet());
+                Collections.sort(keys);
+                for (String k : keys) {
+                    retStr += k + "=";
+                    List<String> values = matrixParams.get(k);
+                    for (String v : values) {
+                        retStr += v + ":";
+                    }
+                }
+                retStr += ":";
+            }
+            return Response.ok(retStr).build();
+        } else if ("getQueryParameters".equals(requestInfo)) {
+            MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
+            String retStr = "";
+            List<String> keys = new ArrayList<String>(params.keySet());
+            Collections.sort(keys);
+            for (String k : keys) {
+                retStr += k + "=";
+
+                List<String> values = params.get(k);
+                for (String v : values) {
+                    retStr += v + ":";
+                }
+            }
+            return Response.ok(retStr).build();
+        } else if ("getRequestUri".equals(requestInfo)) {
+            return Response.ok(uriInfo.getRequestUri().toString()).build();
+        } else if ("getRequestUriBuilder".equals(requestInfo)) {
+            return Response.ok(uriInfo.getRequestUriBuilder().host("abcd")
+                .build("unusedTemplateValue1").toString()).build();
+        }
+
+        return Response.serverError().build();
+    }
+
+    @Path("decoded/{path}")
+    @GET
+    @Encoded
+    public Response getUriInfoPathDecoded(@Context UriInfo uriInfo,
+                                          @QueryParam("decoded") boolean decoded,
+                                          @PathParam("path") String path) {
+        return Response.ok(uriInfo.getPath(decoded)).build();
+    }
+
+    @Path("pathparamsone{p1:.*}")
+    @GET
+    @Encoded
+    public Response getUriInfoPathParametersOne(@Context UriInfo uriInfo,
+                                                @QueryParam("decoded") Boolean decoded,
+                                                @PathParam("p1") String path) {
+        MultivaluedMap<String, String> params = null;
+        if (decoded == null) {
+            params = uriInfo.getPathParameters();
+        } else if (decoded == true) {
+            params = uriInfo.getPathParameters(true);
+        } else if (decoded == false) {
+            params = uriInfo.getPathParameters(false);
+        }
+        List<String> keys = new ArrayList<String>(params.keySet());
+        Collections.sort(keys);
+        /*
+         * may want to test for {test}/{test}
+         */
+        String retStr = "";
+        for (String k : keys) {
+            retStr += k + "=";
+
+            List<String> values = params.get(k);
+            for (String v : values) {
+                retStr += v + ":";
+            }
+        }
+        return Response.ok(retStr).build();
+    }
+
+    @Path("pathparamsmany/{p1}/{p2}{p3:.*}")
+    @GET
+    @Encoded
+    public Response getUriInfoPathParametersMany(@Context UriInfo uriInfo,
+                                                 @QueryParam("decoded") Boolean decoded,
+                                                 @PathParam("p1") String p1,
+                                                 @PathParam("p2") String p2,
+                                                 @PathParam("p3") String p3) {
+        MultivaluedMap<String, String> params = null;
+        if (decoded == null) {
+            params = uriInfo.getPathParameters();
+        } else if (decoded == true) {
+            params = uriInfo.getPathParameters(true);
+        } else if (decoded == false) {
+            params = uriInfo.getPathParameters(false);
+        }
+        List<String> keys = new ArrayList<String>(params.keySet());
+        Collections.sort(keys);
+        /*
+         * may want to test for {test}/{test}
+         */
+        String retStr = "";
+        for (String k : keys) {
+            retStr += k + "=";
+
+            List<String> values = params.get(k);
+            for (String v : values) {
+                retStr += v + ":";
+            }
+        }
+        return Response.ok(retStr).build();
+    }
+
+    @Path("matchedurisdecoded/{path}")
+    @GET
+    @Encoded
+    public Response getMatchedUrisDecoded(@Context UriInfo uriInfo,
+                                          @QueryParam("decoded") Boolean decoded,
+                                          @PathParam("path") String path) {
+        return Response.ok(uriInfo.getPath(decoded)).build();
+    }
+
+    @Path("absolutepathbuilder")
+    @GET
+    public Response getAbsoluteUriBuilder(@Context UriInfo uriInfo,
+                                          @QueryParam("reqInfo") String requestInfo) {
+        if ("getAbsolutePath".equals(requestInfo)) {
+            return Response.ok(uriInfo.getAbsolutePath().toString()).build();
+        }
+        return Response.serverError().build();
+    }
+
+    @Path("matchedresources")
+    public MatchedResourcesSubResource getMatchedResourcesSubresource(@Context UriInfo uriInfo) {
+        List<Object> matchedResources = uriInfo.getMatchedResources();
+        String resourceClassNames = "";
+        for (Object o : matchedResources) {
+            Class<?> c = (Class<?>)o.getClass();
+            resourceClassNames += c.getName() + ":";
+        }
+        return new MatchedResourcesSubResource(resourceClassNames, uriInfo);
+    }
+
+    @Path("matcheduris")
+    public MatchedURIsSubResource getMatchedURIsSubresource(@Context UriInfo uriInfo) {
+        List<String> matchedURIs = uriInfo.getMatchedURIs();
+        String retStr = "";
+        for (String s : matchedURIs) {
+            retStr += s + ":";
+        }
+        return new MatchedURIsSubResource(retStr, uriInfo);
+    }
+
+    @Path("queryparams")
+    @GET
+    @Encoded
+    public Response getUriInfoQueryParameters(@Context UriInfo uriInfo,
+                                              @QueryParam("decoded") Boolean decoded) {
+        MultivaluedMap<String, String> queryParams = null;
+        if (decoded == null) {
+            queryParams = uriInfo.getQueryParameters();
+        } else if (decoded == true) {
+            queryParams = uriInfo.getQueryParameters(true);
+        } else if (decoded == false) {
+            queryParams = uriInfo.getQueryParameters(false);
+        }
+        String retStr = "";
+        List<String> keys = new ArrayList<String>(queryParams.keySet());
+        Collections.sort(keys);
+        for (String k : keys) {
+            retStr += k + "=";
+
+            List<String> values = queryParams.get(k);
+            for (String v : values) {
+                retStr += v + ":";
+            }
+        }
+        return Response.ok(retStr).build();
+    }
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoFieldResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoFieldResource.java?rev=796113&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoFieldResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoFieldResource.java Tue Jul 21 01:45:53 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.jaxrs.test.context.uriinfo;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+@Path("/context/uriinfo/field")
+public class UriInfoFieldResource {
+
+    @Context
+    private UriInfo uriInfo = null;
+
+    @GET
+    public Response requestUriInfo() {
+        if (uriInfo == null) {
+            return Response.serverError().build();
+        }
+        return Response.noContent().build();
+    }
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoNotBeanMethodResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoNotBeanMethodResource.java?rev=796113&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoNotBeanMethodResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoNotBeanMethodResource.java Tue Jul 21 01:45:53 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.jaxrs.test.context.uriinfo;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+@Path("/context/uriinfo/notbeanmethod")
+public class UriInfoNotBeanMethodResource {
+
+    private UriInfo u = null;
+
+    @GET
+    public Response requestSecurityInfo() {
+        if (u == null) {
+            return Response.noContent().build();
+        }
+        return Response.serverError().build();
+    }
+
+    @Context
+    public void injectSecurityContext(UriInfo u) {
+        /*
+         * this method does not start with "set" as its name so it is not
+         * expected to be injected.
+         */
+        this.u = u;
+    }
+
+    public void setSecurityContext(UriInfo u) {
+        /*
+         * this method does not have a @Context annotation so it is not expected
+         * to be injected.
+         */
+        this.u = u;
+    }
+
+    @Context
+    public void setSecurityContext(UriInfo u, UriInfo u2) {
+        /*
+         * this method is not a Java bean method (it has 2 parameters) so it
+         * will not be used for injection
+         */
+        this.u = u;
+    }
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoParamResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoParamResource.java?rev=796113&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoParamResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoParamResource.java Tue Jul 21 01:45:53 2009
@@ -0,0 +1,38 @@
+/*
+ * 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.context.uriinfo;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+@Path("/context/uriinfo/param")
+public class UriInfoParamResource {
+
+    @GET
+    public Response getUriInfo(@Context UriInfo uriInfo) {
+        if (uriInfo == null) {
+            return Response.serverError().build();
+        }
+        return Response.noContent().build();
+    }
+}

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoResource.java?rev=796113&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoResource.java Tue Jul 21 01:45:53 2009
@@ -0,0 +1,64 @@
+/*
+ * 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.context.uriinfo;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.UriInfo;
+
+@Path("uriinfo")
+public class UriInfoResource {
+
+    @Context
+    private UriInfo uriInfo;
+
+    @GET
+    public String getURIInfoPath(@QueryParam("info") String info) {
+        return getInfo(info);
+    }
+
+    @GET
+    @Path("sub")
+    public String getSubURIInfoPath(@QueryParam("info") String info) {
+        return getInfo(info);
+    }
+
+    private String getInfo(String info) {
+        if ("path".equals(info)) {
+            return uriInfo.getPath();
+        }
+        if ("host".equals(info)) {
+            return uriInfo.getBaseUri().getHost();
+        }
+        if ("protocol".equals(info)) {
+            return uriInfo.getBaseUri().getScheme();
+        }
+        if ("query".equals(info)) {
+            return uriInfo.getRequestUri().getQuery();
+        }
+        if ("rawquery".equals(info)) {
+            return uriInfo.getRequestUri().getRawQuery();
+        }
+        return null;
+    }
+
+}

Modified: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/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-context/src/main/webapp/WEB-INF/web.xml?rev=796113&r1=796112&r2=796113&view=diff
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/WEB-INF/web.xml (original)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/WEB-INF/web.xml Tue Jul 21 01:45:53 2009
@@ -25,7 +25,7 @@
 <web-app>
     <display-name>Archetype Created Web Application</display-name>
     <servlet>
-        <servlet-name>HttpHeadersApp</servlet-name>
+        <servlet-name>HTTPHeadersApp</servlet-name>
         <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
         <init-param>
             <param-name>javax.ws.rs.Application</param-name>
@@ -50,12 +50,80 @@
         </init-param>
         <load-on-startup>1</load-on-startup>
     </servlet>
+    <servlet>
+        <servlet-name>ProvidersApp</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.context.providers.Application</param-value>
+        </init-param>
+        <init-param>
+            <param-name>requestProcessorAttribute</param-name>
+            <param-value>requestProcessorAttribute_1</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet>
+        <servlet-name>RequestApp</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.context.request.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>SecurityContextApp</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.context.securitycontext.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>URIInfoApp</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.context.uriinfo.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-mapping>
-        <servlet-name>HttpHeadersApp</servlet-name>
+        <servlet-name>HTTPHeadersApp</servlet-name>
         <url-pattern>/httpheaders/*</url-pattern>
     </servlet-mapping>
     <servlet-mapping>
         <servlet-name>WebContainerTests</servlet-name>
         <url-pattern>/webcontainer/*</url-pattern>
     </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>ProvidersApp</servlet-name>
+        <url-pattern>/providers/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>RequestApp</servlet-name>
+        <url-pattern>/request/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>SecurityContextApp</servlet-name>
+        <url-pattern>/securitycontext/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>URIInfoApp</servlet-name>
+        <url-pattern>/uriinfo/*</url-pattern>
+    </servlet-mapping>
 </web-app>

Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/providers/ProvidersMethodsTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/providers/ProvidersMethodsTest.java?rev=796113&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/providers/ProvidersMethodsTest.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/providers/ProvidersMethodsTest.java Tue Jul 21 01:45:53 2009
@@ -0,0 +1,1134 @@
+/*
+ * 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.context.providers;
+
+import java.io.IOException;
+
+import javax.ws.rs.Produces;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Providers;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.wink.test.integration.ServerEnvironmentInfo;
+
+public class ProvidersMethodsTest extends TestCase {
+
+    public String getBaseURI() {
+        return ServerEnvironmentInfo.getBaseURI() + "/providers";
+    }
+
+    /**
+     * Tests that
+     * {@link Providers#getContextResolver(Class, javax.ws.rs.core.MediaType)}
+     * will return null when a {@link ContextResolver} is not provided that
+     * matches the requested Context type.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testContextResolverNoMatch() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/contextresolver?className=java.lang.Throwable&mediaType=*%2F*");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("nullcontextresolver", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a
+     * {@link Providers#getContextResolver(Class, javax.ws.rs.core.MediaType)}
+     * will return a single context resolver when a single matching
+     * {@link ContextResolver} is provided by the application.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testContextResolverMatchSingle() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/contextresolver?className=java.lang.Exception&mediaType=*%2F*");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.MyExceptionContextResolver",
+                         getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a {@link ContextResolver} with a {@link Produces} annotation
+     * of text/xml will not be returned when given a non-compatible media type
+     * (my/type).
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testContextResolverNoMatchBySpecificMediaType() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/contextresolver?className=java.lang.Exception&mediaType=my%2Ftype");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("nullcontextresolver", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a {@link ContextResolver} with a {@link Produces} annotation
+     * of text/xml will be returned when given the specific text/xml type.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testContextResolverMatchBySpecificMediaType() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/contextresolver?className=java.lang.Exception&mediaType=text%2Fxml");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.MyExceptionContextResolver",
+                         getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a {@link ContextResolver} with a {@link Produces} annotation
+     * of text/xml will be returned when given the wildcard/xml type.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testContextResolverMatchBySpecificMediaTypeTypeWildcard() throws HttpException,
+        IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/contextresolver?className=java.lang.Exception&mediaType=*%2Fxml");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.MyExceptionContextResolver",
+                         getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a {@link ContextResolver} with a {@link Produces} annotation
+     * of text/xml will be returned when given the text/* type.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testContextResolverMatchBySpecificMediaTypeSubtypeWildcard() throws HttpException,
+        IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/contextresolver?className=java.lang.Exception&mediaType=text%2F*");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.MyExceptionContextResolver",
+                         getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+//    /**
+//     * Tests that when finding a {@link ContextResolver} both the application
+//     * provided and runtime provided context resolvers are searched. Invokes
+//     * with a specific JAXB class and verifies that the final context is a
+//     * JAXBContext. In this case, the runtime provided context resolver is used.
+//     * 
+//     * @throws HttpException
+//     * @throws IOException
+//     */
+//    public void testMultipleContextResolverRuntimeAndApplicationMatchByMediaTypeWildcardInvokeWithClassInvokeRuntimeProvided()
+//        throws HttpException, IOException {
+//        HttpClient client = new HttpClient();
+//
+//        GetMethod getMethod =
+//            new GetMethod(
+//                          getBaseURI() + "/context/providers/contextresolver?className=javax.xml.bind.JAXBContext&mediaType=*%2F*&invokeWithClassName=org.apache.wink.jaxrs.test.context.providers.otherxml.OtherRootElement");
+//        try {
+//            client.executeMethod(getMethod);
+//            assertEquals(200, getMethod.getStatusCode());
+//            assertTrue(getMethod.getResponseBodyAsString(), getMethod.getResponseBodyAsString()
+//                .contains("JAXBContext"));
+//        } finally {
+//            getMethod.releaseConnection();
+//        }
+//    }
+
+    /**
+     * Tests that when finding a {@link ContextResolver} both the application
+     * provided and runtime provided context resolvers are searched. Invokes
+     * with a specific JAXB class and verifies that the final context is a
+     * JAXBContext. In this case, the application provided context resolver is
+     * used.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testMultipleContextResolverRuntimeAndApplicationMatchByMediaTypeWildcardInvokeWithClassInvokeApplicationProvided()
+        throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/contextresolver?className=javax.xml.bind.JAXBContext&mediaType=*%2F*&invokeWithClassName=org.apache.wink.jaxrs.test.context.providers.xml.RootElement");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertTrue(getMethod.getResponseBodyAsString(), getMethod.getResponseBodyAsString()
+                .contains("JAXBContext"));
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+//    /**
+//     * Tests that when there are multiple {@link ContextResolver}s that could
+//     * respond to a given type, that a proxy is returned that will call all of
+//     * them.
+//     * 
+//     * @throws HttpException
+//     * @throws IOException
+//     */
+//    public void testMultipleContextResolverRuntimeAndApplicationMatchByMediaTypeSpecificTextXML()
+//        throws HttpException, IOException {
+//        HttpClient client = new HttpClient();
+//
+//        GetMethod getMethod =
+//            new GetMethod(
+//                          getBaseURI() + "/context/providers/contextresolver?className=javax.xml.bind.JAXBContext&mediaType=text%2Fxml");
+//        try {
+//            client.executeMethod(getMethod);
+//            assertEquals(200, getMethod.getStatusCode());
+//            assertTrue(getMethod.getResponseBodyAsString().startsWith("$Proxy"));
+//        } finally {
+//            getMethod.releaseConnection();
+//        }
+//    }
+
+//    /**
+//     * Tests that when the application provided {@link ContextResolver} which
+//     * has a {@link Produces} annotation with text/xml is not the
+//     * ContextResolver returned when searching for application/json media type.
+//     * 
+//     * @throws HttpException
+//     * @throws IOException
+//     */
+//    public void testMultipleContextResolverRuntimeAndApplicationMatchByMediaTypeSpecificApplicationJSON()
+//        throws HttpException, IOException {
+//        HttpClient client = new HttpClient();
+//
+//        GetMethod getMethod =
+//            new GetMethod(
+//                          getBaseURI() + "/context/providers/contextresolver?className=javax.xml.bind.JAXBContext&mediaType=application%2Fjson");
+//        try {
+//            client.executeMethod(getMethod);
+//            assertEquals(200, getMethod.getStatusCode());
+//            assertTrue(getMethod.getResponseBodyAsString().contains("JAXBContext"));
+//        } finally {
+//            getMethod.releaseConnection();
+//        }
+//    }
+
+//    /**
+//     * Tests that when the application provided {@link ContextResolver} which
+//     * has a {@link Produces} annotation with text/xml is not called when an
+//     * application/json is searched. This method should be able to invoke the
+//     * runtime provided JAXBContext ContextResolver but return null.
+//     * 
+//     * @throws HttpException
+//     * @throws IOException
+//     */
+//    public void testMultipleContextResolverRuntimeAndApplicationMatchByMediaTypeSpecificApplicationJSONInvokeNegative()
+//        throws HttpException, IOException {
+//        HttpClient client = new HttpClient();
+//
+//        GetMethod getMethod =
+//            new GetMethod(
+//                          getBaseURI() + "/context/providers/contextresolver?className=javax.xml.bind.JAXBContext&mediaType=application%2Fjson&invokeWithClassName=org.apache.wink.jaxrs.test.context.providers.xml.RootElement");
+//        try {
+//            client.executeMethod(getMethod);
+//            assertEquals(200, getMethod.getStatusCode());
+//            assertEquals("null", getMethod.getResponseBodyAsString());
+//        } finally {
+//            getMethod.releaseConnection();
+//        }
+//    }
+
+    /**
+     * Tests that when the application provided {@link ContextResolver} which
+     * has a {@link Produces} annotation with text/xml is called when an
+     * text/xml is searched. This method should be able to invoke the
+     * application provided JAXBContext ContextResolver and return a
+     * JAXBContext.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testMultipleContextResolverRuntimeAndApplicationMatchByMediaTypeSpecificTextXMLInvoke()
+        throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/contextresolver?className=javax.xml.bind.JAXBContext&mediaType=text%2Fxml&invokeWithClassName=org.apache.wink.jaxrs.test.context.providers.xml.RootElement");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertTrue(getMethod.getResponseBodyAsString(), getMethod.getResponseBodyAsString()
+                .contains("JAXBContext"));
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a {@link ContextResolver} with a wildcard/xml {@link Produces}
+     * annotation will match a (specific)/xml type.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testContextResolverMatchMultipleSortByProducesWildcardType() throws HttpException,
+        IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/contextresolver?className=java.lang.String&mediaType=abcd%2Fxml&invokeWithClassName=java.lang.Short&returnToStringValue=true");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("allwildcardshort", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a {@link ContextResolver} with a text/wildcard
+     * {@link Produces} annotation will match a text/(specific) type.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testContextResolverMatchMultipleSortByProducesWildcardSubtype()
+        throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/contextresolver?className=java.lang.String&mediaType=text%2Fabcd&invokeWithClassName=java.lang.Short&returnToStringValue=true");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("textwildcardonly", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a {@link ContextResolver} with a wildcard/wildcard
+     * {@link Produces} annotation will match a (specific)/(specific) type.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testContextResolverMatchMultipleSortByProducesAllWildcard() throws HttpException,
+        IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/contextresolver?className=java.lang.String&mediaType=abcd%2Fdef&invokeWithClassName=java.lang.Short&returnToStringValue=true");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("allwildcardshort", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a match with multiple {@link ContextResolver}s with the same
+     * media type and generic type will use a proxy that finds the single
+     * resolver that returns a non-null.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testContextResolverMatchMultipleSortByProducesFindOne() throws HttpException,
+        IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/contextresolver?className=java.lang.String&mediaType=text%2Fxml&invokeWithClassName=java.lang.Integer&returnToStringValue=true");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("integerxmlonly", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        client = new HttpClient();
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/contextresolver?className=java.lang.String&mediaType=text%2Fxml&invokeWithClassName=java.lang.Long&returnToStringValue=true");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("longxml2only", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a match with multiple {@link ContextResolver}s will return the
+     * most specific responses before the wildcard responses.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testContextResolverMatchAnyMoreSpecificThanWildcards() throws HttpException,
+        IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/contextresolver?className=java.lang.String&mediaType=text%2Fxml&invokeWithClassName=java.lang.Short&returnToStringValue=true");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String responseBody = getMethod.getResponseBodyAsString();
+            assertTrue(responseBody, "shortxmlandjson".equals(responseBody) || "shortxml2only"
+                .equals(responseBody)
+                || "shortxmlonly".equals(responseBody));
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a {@link ContextResolver} with a wildcard/wildcard
+     * {@link Produces} annotation will match any media type.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testContextResolverNoProducesMatchNotExpectedMediaType() throws HttpException,
+        IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/contextresolver?className=java.lang.String&mediaType=my%2Ftype");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.MyStringContextForAllWildcard",
+                         getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a Provider can return an {@link ExceptionMapper}.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testGetExceptionMapperAppSuppliedProvider() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/exception?className=org.apache.wink.jaxrs.test.context.providers.MyException");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.ExceptionMapperForMyException",
+                         getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a {@link Providers} will return the correct exception mapper
+     * given an exception that is a sub-class of the {@link ExceptionMapper}
+     * class.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testGetExceptionMapperAppSuppliedInheritanceTree() throws HttpException,
+        IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/exception?className=org.apache.wink.jaxrs.test.context.providers.MyException2");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.ExceptionMapperForMyException",
+                         getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a {@link Providers} will return a null value when given a
+     * class that does not have an {@link ExceptionMapper}.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testGetExceptionMapperNoMatching() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/exception?className=java.lang.Throwable");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("null", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that
+     * {@link Providers#getMessageBodyWriter(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
+     * uses the media type to filter out potential message body writers.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testGetMessageBodyWriterSortByProducesMediaType() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodywriter?className=java.lang.Integer&mediaType=text%2Fxml");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.MyMessageBodyWriterXMLAndJSONForNumber",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodywriter?className=java.lang.Integer&mediaType=application%2Fjson");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertTrue(response,
+                       response
+                           .contains("org.apache.wink.jaxrs.test.context.providers.MyMessageBodyWriterXMLAndJSONForNumber") || response
+                           .contains("org.apache.wink.jaxrs.test.context.providers.MyMessageBodyWriterJSONForInteger"));
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that
+     * {@link Providers#getMessageBodyWriter(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
+     * uses the media type to filter out potential message body writers and will
+     * respect more specific types over wildcards.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testGetMessageBodyWriterSortByProducesMediaTypeWithWildcards()
+        throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodywriter?className=java.lang.Short&mediaType=application%2Fjson");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.MyMessageBodyWriterJSONForShort",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodywriter?className=java.lang.Short&mediaType=application%2F*");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertTrue(response,
+                       response
+                           .contains("org.apache.wink.jaxrs.test.context.providers.MyMessageBodyWriterJSONForShort"));
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodywriter?className=java.lang.Short&mediaType=application%2Fmytype");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.MyMessageBodyWriterApplicationWildcardForShort",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodywriter?className=java.lang.Short&mediaType=mytype%2Fmysubtype");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.MyMessageBodyWriterWildcardForShort",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that
+     * {@link Providers#getMessageBodyWriter(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
+     * will find MessageBodyWriters that have inherited the MessageBodyWriter
+     * interface.
+     * 
+     * @throws IOException
+     * @throws HttpException
+     */
+    public void testGetMessageBodyWriterWhichInheritsWriterInterface() throws HttpException,
+        IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodywriter?className=java.util.List&mediaType=abcd%2Fefgh");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.MyMessageBodyWriterInherited",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that
+     * {@link Providers#getMessageBodyWriter(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
+     * will filter out writers that do not match the isWritable method.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testGetMessageBodyWriterSortByIsWritable() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodywriter?className=java.lang.Integer&mediaType=application%2Fjson");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertTrue(response,
+                       "org.apache.wink.jaxrs.test.context.providers.MyMessageBodyWriterJSONForInteger"
+                           .equals(response) || "org.apache.wink.jaxrs.test.context.providers.MyMessageBodyWriterXMLAndJSONForNumber"
+                           .equals(response));
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodywriter?className=java.lang.Long&mediaType=application%2Fjson");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertTrue(response,
+                       "org.apache.wink.jaxrs.test.context.providers.MyMessageBodyWriterJSONForLong"
+                           .equals(response) || "org.apache.wink.jaxrs.test.context.providers.MyMessageBodyWriterXMLAndJSONForNumber"
+                           .equals(response));
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodywriter?className=java.lang.Short&mediaType=application%2Fjson");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals(response,
+                         "org.apache.wink.jaxrs.test.context.providers.MyMessageBodyWriterJSONForShort");
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodywriter?className=java.lang.Long&mediaType=text%2Fxml");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.MyMessageBodyWriterXMLAndJSONForNumber",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodywriter?className=java.lang.Integer&mediaType=text%2Fxml");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.MyMessageBodyWriterXMLAndJSONForNumber",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that
+     * {@link Providers#getMessageBodyWriter(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
+     * will use the application provided MessageBodyWriters before runtime
+     * provided.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testGetMessageBodyWriterUserPrecedenceOverRuntime() throws HttpException,
+        IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodywriter?className=java.lang.String&mediaType=text%2Fplain");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.MyStringWriterForStrings",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+    }
+
+    /**
+     * Tests that a null is returned when calling
+     * {@link Providers#getMessageBodyWriter(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
+     * if there are no suitable MessageBodyWriters.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testGetMessageBodyWriterNoMatching() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodywriter?className=java.lang.Float&mediaType=application%2Fjson");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("nullwriter", response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodywriter?className=java.lang.Exception&mediaType=*%2F*");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.common.internal.providers.entity.FormatedExceptionProvider",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a null is returned when calling
+     * {@link Providers#getMessageBodyReader(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
+     * if there are no suitable MessageBodyReader.
+     * 
+     * @throws IOException
+     * @throws HttpException
+     */
+    public void testGetMessageBodyReaderNoMatching() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodyreader?className=java.lang.Float&mediaType=mynonexistenttype%2Fmysubtype");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("nullreader", response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodyreader?className=java.lang.Exception&mediaType=*%2F*");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("nullreader", response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that
+     * {@link Providers#getMessageBodyReader(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
+     * will filter out writers that do not match the isWritable method.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testGetMessageBodyReaderSortByIsReadable() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodyreader?className=java.lang.Integer&mediaType=application%2Fjson");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertTrue(response,
+                       "org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderJSONForInteger"
+                           .equals(response) || "org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderXMLAndJSONForNumber"
+                           .equals(response));
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodyreader?className=java.lang.Long&mediaType=application%2Fjson");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertTrue(response,
+                       "org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderJSONForLong"
+                           .equals(response) || "org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderXMLAndJSONForNumber"
+                           .equals(response));
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodyreader?className=java.lang.Short&mediaType=application%2Fjson");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderJSONForShort",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodyreader?className=java.lang.Long&mediaType=text%2Fxml");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderXMLAndJSONForNumber",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodyreader?className=java.lang.Integer&mediaType=text%2Fxml");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderXMLAndJSONForNumber",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that
+     * {@link Providers#getMessageBodyReader(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
+     * uses the media type to filter out potential message body readers.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testGetMessageBodyReaderSortByConsumesMediaType() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodyreader?className=java.lang.Integer&mediaType=text%2Fxml");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderXMLAndJSONForNumber",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodyreader?className=java.lang.Integer&mediaType=application%2Fjson");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertTrue(response,
+                       response
+                           .contains("org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderXMLAndJSONForNumber") || response
+                           .contains("org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderJSONForInteger"));
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that
+     * {@link Providers#getMessageBodyReader(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
+     * uses the media type to filter out potential message body readers and will
+     * respect more specific types over wildcards.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testGetMessageBodyReaderSortByConsumesMediaTypeWithWildcards()
+        throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodyreader?className=java.lang.Short&mediaType=application%2Fjson");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderJSONForShort",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodyreader?className=java.lang.Short&mediaType=application%2F*");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderJSONForShort",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodyreader?className=java.lang.Short&mediaType=application%2Fmytype");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderApplicationWildcardForShort",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodyreader?className=java.lang.Short&mediaType=mytype%2Fmysubtype");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderWildcardForShort",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that
+     * {@link Providers#getMessageBodyReader(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
+     * will use the application provided MessageBodyReaders before runtime
+     * provided.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testGetMessageBodyReaderUserPrecedenceOverRuntime() throws HttpException,
+        IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodyreader?className=java.lang.String&mediaType=text%2Fplain");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderForStrings",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+    }
+
+    /**
+     * Tests that
+     * {@link Providers#getMessageBodyReader(Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)}
+     * will find MessageBodyReaders that have inherited the MessageBodyReader
+     * interface.
+     * 
+     * @throws IOException
+     * @throws HttpException
+     */
+    public void testGetMessageBodyReaderWhichInheritsReaderInterface() throws HttpException,
+        IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodyreader?className=java.util.Set&mediaType=tuv%2Fwxyz");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderInherited",
+                         response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod =
+            new GetMethod(
+                          getBaseURI() + "/context/providers/messagebodyreader?className=java.util.List&mediaType=tuv%2Fwxyz");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String response = getMethod.getResponseBodyAsString();
+            assertEquals("nullreader", response);
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+}