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 [3/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-in...

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyResource.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,132 @@
+/*
+ * 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.providers;
+
+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.MediaType;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Providers;
+
+@Path("context/providers")
+public class MyResource {
+
+    @Context
+    Providers provider;
+
+    @GET
+    @Path("messagebodyreader")
+    public String getMessageBodyReader(@QueryParam("className") String className,
+                                       @QueryParam("mediaType") String mediaType) {
+        Class<?> c = null;
+        try {
+            c = (className == null) ? null : Class.forName(className);
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        MediaType mt = (mediaType == null) ? null : MediaType.valueOf(mediaType);
+
+        MessageBodyReader<?> reader = provider.getMessageBodyReader(c, null, null, mt);
+        if (reader == null) {
+            return "nullreader";
+        }
+        return reader.getClass().getName();
+    }
+
+    @GET
+    @Path("messagebodywriter")
+    public String getMessageBodyWriter(@QueryParam("className") String className,
+                                       @QueryParam("mediaType") String mediaType) {
+        Class<?> c = null;
+        try {
+            c = (className == null) ? null : Class.forName(className);
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        MediaType mt = (mediaType == null) ? null : MediaType.valueOf(mediaType);
+
+        MessageBodyWriter<?> writer = provider.getMessageBodyWriter(c, null, null, mt);
+        if (writer == null) {
+            return "nullwriter";
+        }
+        return writer.getClass().getName();
+    }
+
+    @GET
+    @Path("contextresolver")
+    public String getContextResolver(@QueryParam("className") String className,
+                                     @QueryParam("mediaType") String mediaType,
+                                     @QueryParam("invokeWithClassName") String classNameToInvokeWith,
+                                     @QueryParam("returnToStringValue") boolean shouldReturnToStringValue) {
+
+        Class<?> c = null;
+        try {
+            c = (className == null) ? null : Class.forName(className);
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        MediaType mt = (mediaType == null) ? new MediaType("*", "*") : MediaType.valueOf(mediaType);
+        ContextResolver<?> contextResolver = provider.getContextResolver(c, mt);
+        if (contextResolver == null) {
+            return "nullcontextresolver";
+        }
+        if (classNameToInvokeWith == null) {
+            return contextResolver.getClass().getName();
+        }
+        c = null;
+        try {
+            c = (className == null) ? null : Class.forName(classNameToInvokeWith);
+        } catch (ClassNotFoundException e) {
+            // TODO: also throw? Return some nonsense string to make testcase
+            // failure more obvious?
+            e.printStackTrace();
+        }
+        Object o = contextResolver.getContext(c);
+        if (o == null) {
+            return "null";
+        }
+        if (shouldReturnToStringValue) {
+            return (String)o;
+        }
+        return o.getClass().getName();
+    }
+
+    @SuppressWarnings("unchecked")
+    @GET
+    @Path("exception")
+    public String getException(@QueryParam("className") String className) {
+        Class<? extends Throwable> c = null;
+        try {
+            c = (className == null) ? null : (Class<? extends Throwable>)Class.forName(className);
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        ExceptionMapper<?> em = provider.getExceptionMapper(c);
+        if (em == null) {
+            return "null";
+        }
+        return em.getClass().getName();
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextForAllWildcard.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextForAllWildcard.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextForAllWildcard.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextForAllWildcard.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,36 @@
+/*
+ * 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.providers;
+
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class MyStringContextForAllWildcard implements ContextResolver<String> {
+
+    public String getContext(Class<?> arg0) {
+        if (Short.class.isAssignableFrom(arg0)) {
+            return "allwildcardshort";
+        }
+
+        return null;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextForTextWildcard.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextForTextWildcard.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextForTextWildcard.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextForTextWildcard.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,37 @@
+/*
+ * 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.providers;
+
+import javax.ws.rs.Produces;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+@Produces("text/*")
+public class MyStringContextForTextWildcard implements ContextResolver<String> {
+
+    public String getContext(Class<?> arg0) {
+        if (Short.class.isAssignableFrom(arg0)) {
+            return "textwildcardonly";
+        }
+        return null;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextResolverForXML.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextResolverForXML.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextResolverForXML.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextResolverForXML.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.providers;
+
+import javax.ws.rs.Produces;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+@Produces(value = {"text/xml"})
+public class MyStringContextResolverForXML implements ContextResolver<String> {
+
+    public String getContext(Class<?> arg0) {
+        if (Short.class.isAssignableFrom(arg0)) {
+            return "shortxmlonly";
+        }
+
+        if (Integer.class.isAssignableFrom(arg0)) {
+            return "integerxmlonly";
+        }
+
+        return null;
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextResolverForXML2.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextResolverForXML2.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextResolverForXML2.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextResolverForXML2.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.providers;
+
+import javax.ws.rs.Produces;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+@Produces("text/xml")
+public class MyStringContextResolverForXML2 implements ContextResolver<String> {
+
+    public String getContext(Class<?> arg0) {
+        if (Short.class.isAssignableFrom(arg0)) {
+            return "shortxml2only";
+        }
+
+        if (Long.class.isAssignableFrom(arg0)) {
+            return "longxml2only";
+        }
+
+        return null;
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextResolverForXMLAndJSON.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextResolverForXMLAndJSON.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextResolverForXMLAndJSON.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringContextResolverForXMLAndJSON.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,37 @@
+/*
+ * 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.providers;
+
+import javax.ws.rs.Produces;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+@Produces(value = {"application/json", "text/xml"})
+public class MyStringContextResolverForXMLAndJSON implements ContextResolver<String> {
+
+    public String getContext(Class<?> arg0) {
+        if (Short.class.isAssignableFrom(arg0)) {
+            return "shortxmlandjson";
+        }
+        return null;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringWriterForStrings.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringWriterForStrings.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringWriterForStrings.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/MyStringWriterForStrings.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,57 @@
+/*
+ * 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.providers;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+@Produces("text/plain")
+public class MyStringWriterForStrings implements MessageBodyWriter<Object> {
+
+    public long getSize(Object arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4) {
+        return -1;
+    }
+
+    public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        return arg0 == String.class;
+    }
+
+    public void writeTo(Object arg0,
+                        Class<?> arg1,
+                        Type arg2,
+                        Annotation[] arg3,
+                        MediaType arg4,
+                        MultivaluedMap<String, Object> arg5,
+                        OutputStream arg6) throws IOException, WebApplicationException {
+        String str = (String)arg0;
+        arg6.write(str.getBytes());
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/ObjectFactory.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/ObjectFactory.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/ObjectFactory.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.providers;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+import org.apache.wink.itest.providers.xml.RootElement;
+
+@XmlRegistry
+public class ObjectFactory {
+
+    public RootElement createRootElement() {
+        return new RootElement();
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/otherxml/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/otherxml/ObjectFactory.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/otherxml/ObjectFactory.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/otherxml/ObjectFactory.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.providers.otherxml;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+@XmlRegistry
+public class ObjectFactory {
+
+    public OtherRootElement createOtherRootElement() {
+        return new OtherRootElement();
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/otherxml/OtherRootElement.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/otherxml/OtherRootElement.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/otherxml/OtherRootElement.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/otherxml/OtherRootElement.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,36 @@
+/*
+ * 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.providers.otherxml;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class OtherRootElement {
+
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderApplicationWildcardForShort.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderApplicationWildcardForShort.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderApplicationWildcardForShort.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderApplicationWildcardForShort.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,52 @@
+/*
+ * 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.providers.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("application/*")
+public class MyMessageBodyReaderApplicationWildcardForShort implements MessageBodyReader<Short> {
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        return true;
+    }
+
+    public Short readFrom(Class<Short> arg0,
+                          Type arg1,
+                          Annotation[] arg2,
+                          MediaType arg3,
+                          MultivaluedMap<String, String> arg4,
+                          InputStream arg5) throws IOException, WebApplicationException {
+        /* do nothing */
+        return null;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderForStrings.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderForStrings.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderForStrings.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderForStrings.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,57 @@
+/*
+ * 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.providers.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("text/plain")
+public class MyMessageBodyReaderForStrings implements MessageBodyReader<String> {
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        return true;
+    }
+
+    public String readFrom(Class<String> arg0,
+                           Type arg1,
+                           Annotation[] arg2,
+                           MediaType arg3,
+                           MultivaluedMap<String, String> arg4,
+                           InputStream arg5) throws IOException, WebApplicationException {
+        StringBuilder sb = new StringBuilder(1024);
+
+        for (int i = arg5.read(); i != -1; i = arg5.read()) {
+            sb.append((char)i);
+        }
+
+        return sb.toString();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderInherited.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderInherited.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderInherited.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderInherited.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.providers.readers;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+@Consumes("tuv/wxyz")
+public class MyMessageBodyReaderInherited extends MyMessageBodyReaderSuperclass {
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderInterface.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderInterface.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderInterface.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderInterface.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,28 @@
+/*
+ * 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.providers.readers;
+
+import java.util.Set;
+
+import javax.ws.rs.ext.MessageBodyReader;
+
+public interface MyMessageBodyReaderInterface extends MessageBodyReader<Set> {
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderJSONForInteger.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderJSONForInteger.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderJSONForInteger.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderJSONForInteger.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.providers.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("application/json")
+public class MyMessageBodyReaderJSONForInteger implements MessageBodyReader<Object> {
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        return arg0 == Integer.class;
+    }
+
+    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-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderJSONForLong.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderJSONForLong.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderJSONForLong.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderJSONForLong.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,52 @@
+/*
+ * 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.providers.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("application/json")
+public class MyMessageBodyReaderJSONForLong implements MessageBodyReader<Object> {
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        return Long.class == arg0;
+    }
+
+    public Object readFrom(Class<Object> arg0,
+                           Type arg1,
+                           Annotation[] arg2,
+                           MediaType arg3,
+                           MultivaluedMap<String, String> arg4,
+                           InputStream arg5) throws IOException, WebApplicationException {
+        /* do nothing */
+        return null;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderJSONForShort.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderJSONForShort.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderJSONForShort.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderJSONForShort.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,52 @@
+/*
+ * 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.providers.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(value = {"application/json"})
+public class MyMessageBodyReaderJSONForShort implements MessageBodyReader<Short> {
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        return true;
+    }
+
+    public Short readFrom(Class<Short> arg0,
+                          Type arg1,
+                          Annotation[] arg2,
+                          MediaType arg3,
+                          MultivaluedMap<String, String> arg4,
+                          InputStream arg5) throws IOException, WebApplicationException {
+        /* do nothing */
+        return null;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderSuperclass.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderSuperclass.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderSuperclass.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderSuperclass.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,74 @@
+/*
+ * 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.providers.readers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Set;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+
+import org.apache.wink.itest.providers.MyMessageBodyWriterInterface;
+
+public class MyMessageBodyReaderSuperclass implements MyMessageBodyWriterInterface,
+    MyMessageBodyReaderInterface {
+
+    public long getSize(List arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4) {
+        return -1;
+    }
+
+    public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        if (arg3.isCompatible(MediaType.valueOf("tuv/wxyz"))) {
+            return true;
+        }
+        return false;
+    }
+
+    public void writeTo(List arg0,
+                        Class<?> arg1,
+                        Type arg2,
+                        Annotation[] arg3,
+                        MediaType arg4,
+                        MultivaluedMap<String, Object> arg5,
+                        OutputStream arg6) throws IOException, WebApplicationException {
+        /* do nothing */
+    }
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        return true;
+    }
+
+    public Set readFrom(Class<Set> arg0,
+                        Type arg1,
+                        Annotation[] arg2,
+                        MediaType arg3,
+                        MultivaluedMap<String, String> arg4,
+                        InputStream arg5) throws IOException, WebApplicationException {
+        /* do nothing */
+        return null;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderWildcardForShort.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderWildcardForShort.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderWildcardForShort.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderWildcardForShort.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,50 @@
+/*
+ * 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.providers.readers;
+
+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.ext.MessageBodyReader;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class MyMessageBodyReaderWildcardForShort implements MessageBodyReader<Object> {
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        return arg0 == Short.class;
+    }
+
+    public Object readFrom(Class<Object> arg0,
+                           Type arg1,
+                           Annotation[] arg2,
+                           MediaType arg3,
+                           MultivaluedMap<String, String> arg4,
+                           InputStream arg5) throws IOException, WebApplicationException {
+        /* do nothing */
+        return null;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderXMLAndJSONForNumber.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderXMLAndJSONForNumber.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderXMLAndJSONForNumber.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/readers/MyMessageBodyReaderXMLAndJSONForNumber.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,52 @@
+/*
+ * 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.providers.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(value = {"application/json", "text/xml"})
+public class MyMessageBodyReaderXMLAndJSONForNumber implements MessageBodyReader<Object> {
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        return (Integer.class.equals(arg0) || Long.class.equals(arg0));
+    }
+
+    public Object readFrom(Class<Object> arg0,
+                           Type arg1,
+                           Annotation[] arg2,
+                           MediaType arg3,
+                           MultivaluedMap<String, String> arg4,
+                           InputStream arg5) throws IOException, WebApplicationException {
+        /* do nothing */
+        return null;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/xml/RootElement.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/xml/RootElement.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/xml/RootElement.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/providers/xml/RootElement.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,37 @@
+/*
+ * 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.providers.xml;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class RootElement {
+
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/request/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/request/Application.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/request/Application.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/request/Application.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,39 @@
+/*
+ * 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.request;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class Application extends javax.ws.rs.core.Application {
+
+    @Override
+    public Set<Class<?>> getClasses() {
+        return null;
+    }
+
+    @Override
+    public Set<Object> getSingletons() {
+        Set<Object> objs = new HashSet<Object>();
+        objs.add(new RequestResource());
+        return objs;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/request/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/request/ObjectFactory.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/request/ObjectFactory.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/request/ObjectFactory.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.request;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+@XmlRegistry
+public class ObjectFactory {
+
+    public Variant createVariant() {
+        return new Variant();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/request/RequestResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/request/RequestResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/request/RequestResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/request/RequestResource.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,276 @@
+/*
+ * 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.request;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.EntityTag;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Variant;
+import javax.ws.rs.core.Response.ResponseBuilder;
+
+/**
+ * A resource for testing the {@link Request} interface. This is treated like a
+ * singleton in the application.
+ */
+@Path("context/request")
+public class RequestResource {
+
+    private Date                          date;
+
+    private EntityTag                     etag;
+
+    final private static SimpleDateFormat rfc1123Format =
+                                                            new SimpleDateFormat(
+                                                                                 "EEE, dd MMM yyyy HH:mm:ss zzz",
+                                                                                 Locale.ENGLISH);
+
+    @GET
+    @Path("date")
+    public Response evalDate(@Context Request req) {
+        if (!"GET".equals(req.getMethod())) {
+            throw new WebApplicationException();
+        }
+        if (date == null) {
+            return Response.serverError().build();
+        }
+        ResponseBuilder respBuilder = req.evaluatePreconditions(date);
+        if (respBuilder != null) {
+            return respBuilder.build();
+        }
+        return Response.ok("the date: " + rfc1123Format.format(date)).lastModified(date).build();
+    }
+
+    @PUT
+    @Path("date")
+    public Response putDate(String dateSource, @Context Request req) {
+        if (!"PUT".equals(req.getMethod())) {
+            throw new WebApplicationException();
+        }
+        try {
+            date = DateFormat.getDateTimeInstance().parse(dateSource);
+        } catch (ParseException e) {
+            throw new WebApplicationException(e);
+        }
+        return Response.noContent().build();
+    }
+
+    @GET
+    @Path("etag")
+    public Response evalEtag(@Context Request req) {
+        if (!"GET".equals(req.getMethod())) {
+            throw new WebApplicationException();
+        }
+        if (etag == null) {
+            return Response.serverError().build();
+        }
+        ResponseBuilder respBuilder = req.evaluatePreconditions(etag);
+        if (respBuilder != null) {
+            return respBuilder.build();
+        }
+        return Response.ok("the etag: \"" + etag.getValue() + "\"" + etag.isWeak()).tag(etag)
+            .build();
+    }
+
+    @POST
+    @Path("etag")
+    public Response evalPostEtag(@Context Request req) {
+        if (!"POST".equals(req.getMethod())) {
+            throw new WebApplicationException();
+        }
+        if (etag == null) {
+            return Response.serverError().build();
+        }
+        ResponseBuilder respBuilder = req.evaluatePreconditions(etag);
+        if (respBuilder != null) {
+            return respBuilder.build();
+        }
+        return Response.ok("the etag: \"" + etag.getValue() + "\"" + etag.isWeak()).tag(etag)
+            .build();
+    }
+
+    @PUT
+    @Path("etag")
+    public Response putEtag(@Context Request req, String etag) {
+        if (!"PUT".equals(req.getMethod())) {
+            throw new WebApplicationException();
+        }
+        this.etag = EntityTag.valueOf(etag);
+        return Response.noContent().build();
+    }
+
+    @GET
+    @Path("variant/acceptonly")
+    public Response evalAcceptVariant(@Context Request req) {
+        if (!"GET".equals(req.getMethod())) {
+            throw new WebApplicationException();
+        }
+        List<Variant> variants =
+            Variant.mediaTypes(MediaType.APPLICATION_JSON_TYPE,
+                               MediaType.valueOf("text/*"),
+                               MediaType.TEXT_XML_TYPE,
+                               MediaType.TEXT_HTML_TYPE).add().build();
+        Variant targettedVariant = req.selectVariant(variants);
+        if (targettedVariant == null) {
+            return Response.status(466).build();
+        }
+
+        if ("xml".equals(targettedVariant.getMediaType().getSubtype())) {
+            org.apache.wink.itest.request.Variant v =
+                new org.apache.wink.itest.request.Variant();
+            v.setMediatype(targettedVariant.getMediaType().getType() + "/"
+                + targettedVariant.getMediaType().getSubtype());
+            v.setEncoding(targettedVariant.getEncoding());
+            v.setLanguage((targettedVariant.getLanguage() != null) ? targettedVariant.getLanguage()
+                .getLanguage() : null);
+            return Response.ok(v).build();
+        }
+
+        return Response.ok(targettedVariant.getMediaType().getType() + "/"
+            + targettedVariant.getMediaType().getSubtype()).build();
+    }
+
+    @GET
+    @Path("variant/acceptlanguageonly")
+    public Response evalAcceptLanguageVariant(@Context Request req) {
+        if (!"GET".equals(req.getMethod())) {
+            throw new WebApplicationException();
+        }
+        List<Variant> variants =
+            Variant.languages(Locale.ENGLISH, Locale.JAPANESE, Locale.CHINESE, Locale.GERMAN).add()
+                .build();
+        Variant targettedVariant = req.selectVariant(variants);
+        if (targettedVariant == null) {
+            return Response.status(466).build();
+        }
+
+        return Response.ok(targettedVariant.getLanguage().getLanguage()).build();
+    }
+
+    @GET
+    @Path("variant/acceptencodingonly")
+    public Response evalAcceptEncodingVariant(@Context Request req) {
+        if (!"GET".equals(req.getMethod())) {
+            throw new WebApplicationException();
+        }
+        List<Variant> variants = Variant.encodings("compress", "gzip", "identity").add().build();
+        Variant targettedVariant = req.selectVariant(variants);
+        if (targettedVariant == null) {
+            return Response.status(466).build();
+        }
+
+        return Response.ok(targettedVariant.getEncoding()).build();
+    }
+
+    @GET
+    @Path("variant/responsebuilder")
+    public Response evalResponseBuilderVary(@Context Request req, @QueryParam("type") String type) {
+        if (!"GET".equals(req.getMethod())) {
+            throw new WebApplicationException();
+        }
+        List<Variant> variants =
+            Variant.languages(Locale.ENGLISH, Locale.JAPANESE, Locale.CHINESE, Locale.GERMAN)
+                .mediaTypes(MediaType.APPLICATION_JSON_TYPE,
+                            MediaType.valueOf("text/*"),
+                            MediaType.TEXT_XML_TYPE,
+                            MediaType.TEXT_HTML_TYPE).encodings("compress", "gzip", "identity")
+                .add().build();
+        Variant targettedVariant = req.selectVariant(variants);
+        if ("notacceptable".equals(type)) {
+            List<Variant> notAcceptableVariants =
+                Variant.mediaTypes(MediaType.APPLICATION_JSON_TYPE,
+                                   MediaType.valueOf("text/*"),
+                                   MediaType.TEXT_XML_TYPE,
+                                   MediaType.TEXT_HTML_TYPE).encodings("compress",
+                                                                       "gzip",
+                                                                       "identity").add().build();
+            return Response.notAcceptable(notAcceptableVariants).build();
+        } else if ("variants".equals(type)) {
+            List<Variant> okVariants =
+                Variant.languages(Locale.ENGLISH, Locale.JAPANESE, Locale.CHINESE, Locale.GERMAN)
+                    .encodings("compress", "gzip", "identity").add().build();
+            return Response.ok().variants(okVariants).build();
+        }
+        if (targettedVariant == null) {
+            return Response.status(466).build();
+        }
+        return Response.ok(targettedVariant.getMediaType().getType() + "/"
+                               + targettedVariant.getMediaType().getSubtype()
+                               + "-"
+                               + ((targettedVariant.getLanguage() != null) ? targettedVariant
+                                   .getLanguage().getLanguage() : "")
+                               + "-"
+                               + targettedVariant.getEncoding(),
+                           new Variant(new MediaType("text", "plain"), Locale.ENGLISH, "identity"))
+            .build();
+    }
+
+    @GET
+    @Path("variant/acceptmultiple")
+    public Response evalAcceptMultipleVariant(@Context Request req) {
+        if (!"GET".equals(req.getMethod())) {
+            throw new WebApplicationException();
+        }
+        List<Variant> variants =
+            Variant.languages(Locale.ENGLISH, Locale.JAPANESE, Locale.CHINESE, Locale.GERMAN)
+                .mediaTypes(MediaType.APPLICATION_JSON_TYPE,
+                            MediaType.valueOf("text/*"),
+                            MediaType.TEXT_XML_TYPE,
+                            MediaType.TEXT_HTML_TYPE).encodings("compress", "gzip", "identity")
+                .add().build();
+        Variant targettedVariant = req.selectVariant(variants);
+        if (targettedVariant == null) {
+            return Response.status(466).build();
+        }
+
+        if ("xml".equals(targettedVariant.getMediaType().getSubtype())) {
+            org.apache.wink.itest.request.Variant v =
+                new org.apache.wink.itest.request.Variant();
+            v.setMediatype(targettedVariant.getMediaType().getType() + "/"
+                + targettedVariant.getMediaType().getSubtype());
+            v.setEncoding(targettedVariant.getEncoding());
+            v.setLanguage((targettedVariant.getLanguage() != null) ? targettedVariant.getLanguage()
+                .getLanguage() : null);
+            return Response.ok(v).build();
+        }
+
+        return Response.ok(targettedVariant.getMediaType().getType() + "/"
+            + targettedVariant.getMediaType().getSubtype()
+            + "-"
+            + ((targettedVariant.getLanguage() != null) ? targettedVariant.getLanguage()
+                .getLanguage() : "")
+            + "-"
+            + targettedVariant.getEncoding()).build();
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/request/Variant.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/request/Variant.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/request/Variant.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/request/Variant.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,56 @@
+/*
+ * 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.request;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class Variant {
+
+    private String mediatype;
+
+    private String encoding;
+
+    private String language;
+
+    public String getMediatype() {
+        return mediatype;
+    }
+
+    public void setMediatype(String mediatype) {
+        this.mediatype = mediatype;
+    }
+
+    public String getEncoding() {
+        return encoding;
+    }
+
+    public void setEncoding(String encoding) {
+        this.encoding = encoding;
+    }
+
+    public String getLanguage() {
+        return language;
+    }
+
+    public void setLanguage(String language) {
+        this.language = language;
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/Application.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/Application.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/Application.java Fri Aug  7 03:10:22 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.itest.securitycontext;
+
+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(SecurityContextBeanResource.class);
+        clazzes.add(SecurityContextConstructorResource.class);
+        clazzes.add(SecurityContextFieldResource.class);
+        clazzes.add(SecurityContextNotBeanMethodResource.class);
+        clazzes.add(SecurityContextParamResource.class);
+        return clazzes;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextBeanResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextBeanResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextBeanResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextBeanResource.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.securitycontext;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.SecurityContext;
+
+import org.apache.wink.itest.securitycontext.xml.SecurityContextInfo;
+
+@Path("/context/securitycontext/bean")
+public class SecurityContextBeanResource {
+
+    private SecurityContext s = null;
+
+    @GET
+    public SecurityContextInfo requestSecurityInfo() {
+        return SecurityContextUtils.securityContextToJSON(s);
+    }
+
+    @Context
+    public void setSecurityInfo(SecurityContext secContext) {
+        this.s = secContext;
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextConstructorResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextConstructorResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextConstructorResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextConstructorResource.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.securitycontext;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.SecurityContext;
+
+import org.apache.wink.itest.securitycontext.xml.SecurityContextInfo;
+
+@Path("/context/securitycontext/constructor")
+public class SecurityContextConstructorResource {
+
+    final private SecurityContext secContext;
+
+    public SecurityContextConstructorResource(@Context SecurityContext secContext) {
+        this.secContext = secContext;
+    }
+
+    @GET
+    public SecurityContextInfo requestSecurityInfo() {
+        return SecurityContextUtils.securityContextToJSON(secContext);
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextFieldResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextFieldResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextFieldResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextFieldResource.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,40 @@
+/*
+ * 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.securitycontext;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.SecurityContext;
+
+import org.apache.wink.itest.securitycontext.xml.SecurityContextInfo;
+
+@Path("/context/securitycontext/field")
+public class SecurityContextFieldResource {
+
+    @Context
+    private SecurityContext s = null;
+
+    @GET
+    public SecurityContextInfo requestSecurityInfo() {
+        return SecurityContextUtils.securityContextToJSON(s);
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextNotBeanMethodResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextNotBeanMethodResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextNotBeanMethodResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextNotBeanMethodResource.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.securitycontext;
+
+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.SecurityContext;
+
+@Path("/context/securitycontext/notbeanmethod")
+public class SecurityContextNotBeanMethodResource {
+
+    private SecurityContext s = null;
+
+    @GET
+    public Response requestSecurityInfo() {
+        if (s == null) {
+            return Response.ok("false").build();
+        }
+        return Response.ok(SecurityContextUtils.securityContextToJSON(s)).build();
+    }
+
+    @Context
+    public void injectSecurityContext(SecurityContext secContext) {
+        /*
+         * this method does not start with "set" as its name so it is not
+         * expected to be injected.
+         */
+        this.s = secContext;
+    }
+
+    public void setSecurityContext(SecurityContext secContext) {
+        /*
+         * this method does not have a @Context annotation so it is not expected
+         * to be injected.
+         */
+        this.s = secContext;
+    }
+
+    @Context
+    public void setSecurityContext(SecurityContext secContext, SecurityContext secContext2) {
+        /*
+         * this method is not a Java bean method (it has 2 parameters) so it
+         * will not be used for injection
+         */
+        this.s = secContext;
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextParamResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextParamResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextParamResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextParamResource.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,40 @@
+/*
+ * 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.securitycontext;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.SecurityContext;
+
+import org.apache.wink.itest.securitycontext.xml.SecurityContextInfo;
+
+@Path("/context/securitycontext/param")
+public class SecurityContextParamResource {
+
+    public SecurityContextParamResource() {
+        /* do nothing */
+    }
+
+    @GET
+    public SecurityContextInfo fetchSecurityInfo(@Context SecurityContext secContext) {
+        return SecurityContextUtils.securityContextToJSON(secContext);
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextUtils.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextUtils.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextUtils.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/SecurityContextUtils.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,42 @@
+/*
+ * 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.securitycontext;
+
+import javax.ws.rs.core.SecurityContext;
+
+import org.apache.wink.itest.securitycontext.xml.SecurityContextInfo;
+
+final public class SecurityContextUtils {
+
+    public static SecurityContextInfo securityContextToJSON(SecurityContext secContext) {
+        if (secContext == null) {
+            return null;
+        }
+        SecurityContextInfo secInfo = new SecurityContextInfo();
+        secInfo.setAuthScheme(secContext.getAuthenticationScheme());
+        secInfo.setUserPrincipal(secContext.getUserPrincipal() == null ? "null" : secContext
+            .getUserPrincipal().getName());
+        secInfo.setSecure(secContext.isSecure());
+        secInfo.setUserInRoleAdmin(secContext.isUserInRole("admin"));
+        secInfo.setUserInRoleNull(secContext.isUserInRole(null));
+        secInfo.setUserInRoleUser(secContext.isUserInRole("user"));
+        return secInfo;
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/xml/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/xml/ObjectFactory.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/xml/ObjectFactory.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/main/java/org/apache/wink/itest/securitycontext/xml/ObjectFactory.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.securitycontext.xml;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+/**
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+    public SecurityContextInfo createSecurityContextInfo() {
+        return new SecurityContextInfo();
+    }
+}