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 [1/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...
Author: bluk
Date: Tue Jul 21 01:45:53 2009
New Revision: 796113
URL: http://svn.apache.org/viewvc?rev=796113&view=rev
Log:
Context integration tests
See [WINK-97]
Disabled four failing tests due to WINK 68
and will attach a patch to WINK 97 to
enable.
Thanks Mike.
Added:
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/Application.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/ExceptionMapperForMyException.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyException.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyException2.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyExceptionContextResolver.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyJAXBContextResolverForXML.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterApplicationWildcardForShort.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterInherited.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterInheritedSuperclass.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterInterface.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterJSONForInteger.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterJSONForLong.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterJSONForShort.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterWildcardForShort.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterXMLAndJSONForNumber.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyNonMappedException.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyStringContextForAllWildcard.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyStringContextForTextWildcard.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyStringContextResolverForXML.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyStringContextResolverForXML2.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyStringContextResolverForXMLAndJSON.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyStringWriterForStrings.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/ObjectFactory.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/otherxml/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/otherxml/ObjectFactory.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/otherxml/OtherRootElement.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/readers/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/readers/MyMessageBodyReaderApplicationWildcardForShort.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/readers/MyMessageBodyReaderForStrings.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/readers/MyMessageBodyReaderInherited.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/readers/MyMessageBodyReaderInterface.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/readers/MyMessageBodyReaderJSONForInteger.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/readers/MyMessageBodyReaderJSONForLong.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/readers/MyMessageBodyReaderJSONForShort.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/readers/MyMessageBodyReaderSuperclass.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/readers/MyMessageBodyReaderWildcardForShort.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/readers/MyMessageBodyReaderXMLAndJSONForNumber.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/xml/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/xml/RootElement.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/request/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/request/Application.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/request/ObjectFactory.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/request/RequestResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/request/Variant.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/securitycontext/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/securitycontext/Application.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/securitycontext/SecurityContextBeanResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/securitycontext/SecurityContextConstructorResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/securitycontext/SecurityContextFieldResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/securitycontext/SecurityContextNotBeanMethodResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/securitycontext/SecurityContextParamResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/securitycontext/SecurityContextUtils.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/securitycontext/xml/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/securitycontext/xml/ObjectFactory.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/securitycontext/xml/SecurityContextInfo.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/Application.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/MatchedResourcesSubResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/MatchedURIsSubResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoBeanResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/uriinfo/UriInfoConstructorResource.java
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
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
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
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
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
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/providers/
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
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/request/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/request/RequestMethodsTest.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/securitycontext/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/securitycontext/SecurityContextTest.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/uriinfo/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/uriinfo/URIInfoDetailedMethodTest.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/uriinfo/URIInfoInjectionTest.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/uriinfo/URIInfoNormalizationTest.java
Modified:
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/WEB-INF/web.xml
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/Application.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/providers/Application.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/providers/Application.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/providers/Application.java Tue Jul 21 01:45:53 2009
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.context.providers;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderApplicationWildcardForShort;
+import org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderForStrings;
+import org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderInherited;
+import org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderJSONForInteger;
+import org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderJSONForLong;
+import org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderJSONForShort;
+import org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderWildcardForShort;
+import org.apache.wink.jaxrs.test.context.providers.readers.MyMessageBodyReaderXMLAndJSONForNumber;
+
+public class Application extends javax.ws.rs.core.Application {
+
+ @Override
+ public Set<Class<?>> getClasses() {
+ Set<Class<?>> clazzes = new HashSet<Class<?>>();
+ clazzes.add(MyResource.class);
+ return clazzes;
+ }
+
+ @Override
+ public Set<Object> getSingletons() {
+ Set<Object> objs = new HashSet<Object>();
+ objs.add(new ExceptionMapperForMyException());
+
+ objs.add(new MyJAXBContextResolverForXML());
+ objs.add(new MyExceptionContextResolver());
+ objs.add(new MyStringContextForAllWildcard());
+ objs.add(new MyStringContextForTextWildcard());
+ objs.add(new MyStringContextResolverForXML());
+ objs.add(new MyStringContextResolverForXML2());
+ objs.add(new MyStringContextResolverForXMLAndJSON());
+
+ objs.add(new MyMessageBodyWriterJSONForInteger());
+ objs.add(new MyMessageBodyWriterJSONForLong());
+ objs.add(new MyMessageBodyWriterXMLAndJSONForNumber());
+ objs.add(new MyMessageBodyWriterJSONForShort());
+ objs.add(new MyMessageBodyWriterApplicationWildcardForShort());
+ objs.add(new MyMessageBodyWriterWildcardForShort());
+ objs.add(new MyStringWriterForStrings());
+ objs.add(new MyMessageBodyWriterInherited());
+
+ objs.add(new MyMessageBodyReaderJSONForInteger());
+ objs.add(new MyMessageBodyReaderJSONForLong());
+ objs.add(new MyMessageBodyReaderXMLAndJSONForNumber());
+ objs.add(new MyMessageBodyReaderApplicationWildcardForShort());
+ objs.add(new MyMessageBodyReaderJSONForShort());
+ objs.add(new MyMessageBodyReaderWildcardForShort());
+ objs.add(new MyMessageBodyReaderForStrings());
+ objs.add(new MyMessageBodyReaderInherited());
+
+ return objs;
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/ExceptionMapperForMyException.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/providers/ExceptionMapperForMyException.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/providers/ExceptionMapperForMyException.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/providers/ExceptionMapperForMyException.java Tue Jul 21 01:45:53 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.jaxrs.test.context.providers;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class ExceptionMapperForMyException implements ExceptionMapper<MyException> {
+
+ public Response toResponse(MyException arg0) {
+ return Response.serverError().entity(arg0).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/providers/MyException.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/providers/MyException.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/providers/MyException.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/providers/MyException.java Tue Jul 21 01:45:53 2009
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.context.providers;
+
+public class MyException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyException2.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/providers/MyException2.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/providers/MyException2.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/providers/MyException2.java Tue Jul 21 01:45:53 2009
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.context.providers;
+
+public class MyException2 extends MyException {
+
+ private static final long serialVersionUID = 1L;
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyExceptionContextResolver.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/providers/MyExceptionContextResolver.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/providers/MyExceptionContextResolver.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/providers/MyExceptionContextResolver.java Tue Jul 21 01:45:53 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.jaxrs.test.context.providers;
+
+import javax.ws.rs.Produces;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+@Produces("text/xml")
+public class MyExceptionContextResolver implements ContextResolver<Exception> {
+
+ public Exception getContext(Class<?> arg0) {
+ if (ExceptionMapperForMyException.class.isAssignableFrom(arg0)) {
+ return new MyException();
+ } else if (MyResource.class.isAssignableFrom(arg0)) {
+ return new MyException2();
+ }
+ return null;
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyJAXBContextResolverForXML.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/providers/MyJAXBContextResolverForXML.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/providers/MyJAXBContextResolverForXML.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/providers/MyJAXBContextResolverForXML.java Tue Jul 21 01:45:53 2009
@@ -0,0 +1,45 @@
+/*
+ * 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 javax.ws.rs.Produces;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+
+import org.apache.wink.jaxrs.test.context.providers.xml.RootElement;
+
+@Provider
+@Produces("text/xml")
+public class MyJAXBContextResolverForXML implements ContextResolver<JAXBContext> {
+
+ public JAXBContext getContext(Class<?> arg0) {
+ if (RootElement.class.isAssignableFrom(arg0)) {
+ try {
+ return JAXBContext.newInstance(ObjectFactory.class.getPackage().getName());
+ } catch (JAXBException e) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterApplicationWildcardForShort.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/providers/MyMessageBodyWriterApplicationWildcardForShort.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/providers/MyMessageBodyWriterApplicationWildcardForShort.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/providers/MyMessageBodyWriterApplicationWildcardForShort.java Tue Jul 21 01:45:53 2009
@@ -0,0 +1,55 @@
+/*
+ * 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 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("application/*")
+public class MyMessageBodyWriterApplicationWildcardForShort implements MessageBodyWriter<Short> {
+
+ public long getSize(Short arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4) {
+ return -1;
+ }
+
+ public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+ return true;
+ }
+
+ public void writeTo(Short arg0,
+ Class<?> arg1,
+ Type arg2,
+ Annotation[] arg3,
+ MediaType arg4,
+ MultivaluedMap<String, Object> arg5,
+ OutputStream arg6) throws IOException, WebApplicationException {
+ /* do nothing */
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterInherited.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/providers/MyMessageBodyWriterInherited.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/providers/MyMessageBodyWriterInherited.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/providers/MyMessageBodyWriterInherited.java Tue Jul 21 01:45:53 2009
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.context.providers;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.List;
+
+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.Provider;
+
+@Provider
+@Produces("abcd/efgh")
+public class MyMessageBodyWriterInherited extends MyMessageBodyWriterInheritedSuperclass {
+
+ @Override
+ public long getSize(List arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4) {
+ return -1;
+ }
+
+ @Override
+ public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+ return arg0 == List.class;
+ }
+
+ @Override
+ public void writeTo(List arg0,
+ Class<?> arg1,
+ Type arg2,
+ Annotation[] arg3,
+ MediaType arg4,
+ MultivaluedMap<String, Object> arg5,
+ OutputStream arg6) throws IOException, WebApplicationException {
+ /* do nothing */
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterInheritedSuperclass.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/providers/MyMessageBodyWriterInheritedSuperclass.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/providers/MyMessageBodyWriterInheritedSuperclass.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/providers/MyMessageBodyWriterInheritedSuperclass.java Tue Jul 21 01:45:53 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.jaxrs.test.context.providers;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.List;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+
+public abstract class MyMessageBodyWriterInheritedSuperclass implements
+ MyMessageBodyWriterInterface {
+
+ public abstract long getSize(List arg0,
+ Class<?> arg1,
+ Type arg2,
+ Annotation[] arg3,
+ MediaType arg4);
+
+ public abstract boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3);
+
+ public abstract void writeTo(List arg0,
+ Class<?> arg1,
+ Type arg2,
+ Annotation[] arg3,
+ MediaType arg4,
+ MultivaluedMap<String, Object> arg5,
+ OutputStream arg6) throws IOException, WebApplicationException;
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterInterface.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/providers/MyMessageBodyWriterInterface.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/providers/MyMessageBodyWriterInterface.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/providers/MyMessageBodyWriterInterface.java Tue Jul 21 01:45:53 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.jaxrs.test.context.providers;
+
+import java.util.List;
+
+import javax.ws.rs.ext.MessageBodyWriter;
+
+public interface MyMessageBodyWriterInterface extends MessageBodyWriter<List> {
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterJSONForInteger.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/providers/MyMessageBodyWriterJSONForInteger.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/providers/MyMessageBodyWriterJSONForInteger.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/providers/MyMessageBodyWriterJSONForInteger.java Tue Jul 21 01:45:53 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.jaxrs.test.context.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("application/json")
+public class MyMessageBodyWriterJSONForInteger 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.equals(Integer.class);
+ }
+
+ public void writeTo(Object arg0,
+ Class<?> arg1,
+ Type arg2,
+ Annotation[] arg3,
+ MediaType arg4,
+ MultivaluedMap<String, Object> arg5,
+ OutputStream arg6) throws IOException, WebApplicationException {
+ /* do nothing */
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterJSONForLong.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/providers/MyMessageBodyWriterJSONForLong.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/providers/MyMessageBodyWriterJSONForLong.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/providers/MyMessageBodyWriterJSONForLong.java Tue Jul 21 01:45:53 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.jaxrs.test.context.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("application/json")
+public class MyMessageBodyWriterJSONForLong 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.equals(Long.class);
+ }
+
+ public void writeTo(Object arg0,
+ Class<?> arg1,
+ Type arg2,
+ Annotation[] arg3,
+ MediaType arg4,
+ MultivaluedMap<String, Object> arg5,
+ OutputStream arg6) throws IOException, WebApplicationException {
+ /* do nothing */
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterJSONForShort.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/providers/MyMessageBodyWriterJSONForShort.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/providers/MyMessageBodyWriterJSONForShort.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/providers/MyMessageBodyWriterJSONForShort.java Tue Jul 21 01:45:53 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.jaxrs.test.context.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("application/json")
+public class MyMessageBodyWriterJSONForShort 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 Short.class.equals(arg0);
+ }
+
+ public void writeTo(Object arg0,
+ Class<?> arg1,
+ Type arg2,
+ Annotation[] arg3,
+ MediaType arg4,
+ MultivaluedMap<String, Object> arg5,
+ OutputStream arg6) throws IOException, WebApplicationException {
+ /* do nothing */
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterWildcardForShort.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/providers/MyMessageBodyWriterWildcardForShort.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/providers/MyMessageBodyWriterWildcardForShort.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/providers/MyMessageBodyWriterWildcardForShort.java Tue Jul 21 01:45:53 2009
@@ -0,0 +1,53 @@
+/*
+ * 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 java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class MyMessageBodyWriterWildcardForShort 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 Short.class.equals(arg0);
+ }
+
+ public void writeTo(Object arg0,
+ Class<?> arg1,
+ Type arg2,
+ Annotation[] arg3,
+ MediaType arg4,
+ MultivaluedMap<String, Object> arg5,
+ OutputStream arg6) throws IOException, WebApplicationException {
+ /* do nothing */
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyMessageBodyWriterXMLAndJSONForNumber.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/providers/MyMessageBodyWriterXMLAndJSONForNumber.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/providers/MyMessageBodyWriterXMLAndJSONForNumber.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/providers/MyMessageBodyWriterXMLAndJSONForNumber.java Tue Jul 21 01:45:53 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.jaxrs.test.context.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(value = {"text/xml", "application/json"})
+public class MyMessageBodyWriterXMLAndJSONForNumber 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 (Integer.class.equals(arg0) || Long.class.equals(arg0));
+ }
+
+ public void writeTo(Object arg0,
+ Class<?> arg1,
+ Type arg2,
+ Annotation[] arg3,
+ MediaType arg4,
+ MultivaluedMap<String, Object> arg5,
+ OutputStream arg6) throws IOException, WebApplicationException {
+ /* do nothing */
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyNonMappedException.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/providers/MyNonMappedException.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/providers/MyNonMappedException.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/providers/MyNonMappedException.java Tue Jul 21 01:45:53 2009
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.context.providers;
+
+public class MyNonMappedException extends MyException {
+
+ private static final long serialVersionUID = 1L;
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyResource.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/providers/MyResource.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/providers/MyResource.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/providers/MyResource.java Tue Jul 21 01:45:53 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.jaxrs.test.context.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-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyStringContextForAllWildcard.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/providers/MyStringContextForAllWildcard.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/providers/MyStringContextForAllWildcard.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/providers/MyStringContextForAllWildcard.java Tue Jul 21 01:45:53 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.jaxrs.test.context.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-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyStringContextForTextWildcard.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/providers/MyStringContextForTextWildcard.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/providers/MyStringContextForTextWildcard.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/providers/MyStringContextForTextWildcard.java Tue Jul 21 01:45:53 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.jaxrs.test.context.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-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyStringContextResolverForXML.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/providers/MyStringContextResolverForXML.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/providers/MyStringContextResolverForXML.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/providers/MyStringContextResolverForXML.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.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-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyStringContextResolverForXML2.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/providers/MyStringContextResolverForXML2.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/providers/MyStringContextResolverForXML2.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/providers/MyStringContextResolverForXML2.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.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-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyStringContextResolverForXMLAndJSON.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/providers/MyStringContextResolverForXMLAndJSON.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/providers/MyStringContextResolverForXMLAndJSON.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/providers/MyStringContextResolverForXMLAndJSON.java Tue Jul 21 01:45:53 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.jaxrs.test.context.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-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/MyStringWriterForStrings.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/providers/MyStringWriterForStrings.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/providers/MyStringWriterForStrings.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/providers/MyStringWriterForStrings.java Tue Jul 21 01:45:53 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.jaxrs.test.context.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-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/ObjectFactory.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/providers/ObjectFactory.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/providers/ObjectFactory.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/providers/ObjectFactory.java Tue Jul 21 01:45:53 2009
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.context.providers;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+import org.apache.wink.jaxrs.test.context.providers.xml.RootElement;
+
+@XmlRegistry
+public class ObjectFactory {
+
+ public RootElement createRootElement() {
+ return new RootElement();
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/otherxml/ObjectFactory.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/providers/otherxml/ObjectFactory.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/providers/otherxml/ObjectFactory.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/providers/otherxml/ObjectFactory.java Tue Jul 21 01:45:53 2009
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.context.providers.otherxml;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+@XmlRegistry
+public class ObjectFactory {
+
+ public OtherRootElement createOtherRootElement() {
+ return new OtherRootElement();
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/otherxml/OtherRootElement.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/providers/otherxml/OtherRootElement.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/providers/otherxml/OtherRootElement.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/providers/otherxml/OtherRootElement.java Tue Jul 21 01:45:53 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.jaxrs.test.context.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-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/providers/readers/MyMessageBodyReaderApplicationWildcardForShort.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/providers/readers/MyMessageBodyReaderApplicationWildcardForShort.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/providers/readers/MyMessageBodyReaderApplicationWildcardForShort.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/providers/readers/MyMessageBodyReaderApplicationWildcardForShort.java Tue Jul 21 01:45:53 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.jaxrs.test.context.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;
+ }
+
+}