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/16 22:02:01 UTC
svn commit: r794815 [2/4] - in
/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting:
./ src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/wink/ src/main/ja...
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/headers/HeadersAllowResource2.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/headers/HeadersAllowResource2.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/headers/HeadersAllowResource2.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/headers/HeadersAllowResource2.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.headers;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+
+@Path("headersallow2")
+public class HeadersAllowResource2 {
+
+ @GET
+ public Response getAllow2() {
+ return Response.ok().build();
+ }
+
+ @POST
+ public Response postAllow2() {
+ return Response.ok().build();
+ }
+
+ @PUT
+ public Response putAllow2() {
+ return Response.ok().build();
+ }
+
+ @DELETE
+ public Response deleteAllow3() {
+ return Response.ok().build();
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/headers/HeadersResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/headers/HeadersResource.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/headers/HeadersResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/headers/HeadersResource.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,121 @@
+/*
+ * 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.headers;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+
+@Path(value = "/headers")
+public class HeadersResource {
+
+ @Context
+ HttpHeaders headers;
+
+ @GET
+ @Path(value = "/cookie")
+ public Response get() {
+ Response resp = Response.ok().build();
+ resp.getMetadata().putSingle("login",
+ headers.getCookies().get("login").getValue());
+ return resp;
+ }
+
+ @GET
+ @Path(value = "/language")
+ public Response getLanguage() {
+ Response resp = Response.ok().build();
+ resp.getMetadata().putSingle("language",
+ headers.getLanguage().getLanguage() + ":" + headers.getLanguage().getCountry());
+ return resp;
+ }
+
+ @GET
+ @Path(value = "/content")
+ public Response getContent() {
+ Response resp = Response.ok().build();
+ resp.getMetadata().putSingle("content",
+ headers.getMediaType().toString());
+ return resp;
+ }
+
+ @GET
+ @Path(value = "/accept")
+ public Response getAccept() {
+ Response resp = Response.ok().build();
+ StringBuffer sb = new StringBuffer();
+ for (MediaType mediaType : headers.getAcceptableMediaTypes()) {
+ sb.append(mediaType.toString() + " ");
+ }
+ resp.getMetadata().putSingle("test-accept", sb.toString().trim());
+ return resp;
+ }
+
+ @GET
+ @Path(value = "/acceptlang")
+ public Response getAcceptLanguage() {
+ Response resp = Response.ok().build();
+ resp.getMetadata().putSingle("acceptlang",
+ headers.getAcceptableLanguages().get(0).toString());
+ return resp;
+ }
+
+ @GET
+ @Path(value = "/headercase")
+ public Response getHeaderCase(@HeaderParam(value = "custom-header") String param) {
+ Response resp = Response.ok().build();
+ resp.getMetadata().putSingle("Custom-Header", param);
+ return resp;
+ }
+
+ @GET
+ @Path(value = "/headeraccept")
+ public Response getHeaderAccept(@HeaderParam(value = "Accept") String param) {
+ Response resp = Response.ok().build();
+ resp.getMetadata().putSingle("test-accept", param);
+ return resp;
+ }
+
+ @GET
+ @Path(value = "/headersasarg")
+ public Response getHeadersAsArg() {
+ Response resp = Response.ok().build();
+ StringBuffer sb = new StringBuffer();
+ MultivaluedMap<String, String> hdrMap = headers.getRequestHeaders();
+ for (String accept : hdrMap.get("ACCEPT")) {
+ sb.append(accept + " ");
+ }
+ String hdr = sb.toString().trim();
+ resp.getMetadata().putSingle("test-accept", hdr);
+ sb = new StringBuffer();
+ for (String ct : hdrMap.get("CONTENT-TYPE")) {
+ sb.append(ct + " ");
+ }
+ hdr = sb.toString().trim();
+ resp.getMetadata().putSingle("test-content-type", hdr);
+ return resp;
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/largeentity/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/largeentity/Application.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/largeentity/Application.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/largeentity/Application.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.largeentity;
+
+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(LargeResource.class);
+ clazzes.add(JARInputStreamProvider.class);
+ return clazzes;
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/largeentity/JARInputStreamProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/largeentity/JARInputStreamProvider.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/largeentity/JARInputStreamProvider.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/largeentity/JARInputStreamProvider.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.largeentity;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.jar.JarInputStream;
+
+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/jar")
+public class JARInputStreamProvider implements MessageBodyReader<JarInputStream> {
+
+ public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+ return JarInputStream.class.isAssignableFrom(arg0);
+ }
+
+ public JarInputStream readFrom(Class<JarInputStream> arg0, Type arg1, Annotation[] arg2, MediaType arg3, MultivaluedMap<String, String> arg4, InputStream arg5)
+ throws IOException, WebApplicationException {
+ return new JarInputStream(arg5);
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/largeentity/LargeResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/largeentity/LargeResource.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/largeentity/LargeResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/largeentity/LargeResource.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,68 @@
+/*
+ * 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.largeentity;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
+@Path("/large")
+public class LargeResource {
+
+ @POST
+ public Response appendStrings(String input) {
+ StringBuffer sb = new StringBuffer(input);
+ /*
+ * use only 2048 characters in header because of Jetty configuration
+ * which has a buffer limit of only 4096. give some room for other
+ * possible headers
+ */
+ return Response.status(277).entity(input + "entity").header(
+ "appendStringsHeader", sb.subSequence(0, 2042) + "header")
+ .build();
+ }
+
+ @POST
+ @Path("zip")
+ public Response findFirstEntry(JarInputStream jarInputStream)
+ throws IOException {
+ if (jarInputStream == null) {
+ return Response.status(Status.BAD_REQUEST).entity("no jar").build();
+ }
+ JarEntry je = null;
+ List<String> l = new ArrayList<String>();
+ while ((je = jarInputStream.getNextJarEntry()) != null) {
+ l.add(je.getName());
+ }
+ Collections.sort(l);
+ if (l.size() > 0) {
+ return Response.status(290).entity(l.get(0)).build();
+ }
+ return Response.status(Status.NO_CONTENT).build();
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/lifecycles/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/lifecycles/Application.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/lifecycles/Application.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/lifecycles/Application.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.lifecycles;
+
+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(MyResource.class);
+ clazzes.add(MyMessageBodyReaderAndWriter.class);
+ return clazzes;
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/lifecycles/MyMessageBodyReaderAndWriter.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/lifecycles/MyMessageBodyReaderAndWriter.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/lifecycles/MyMessageBodyReaderAndWriter.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/lifecycles/MyMessageBodyReaderAndWriter.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,98 @@
+/*
+ * 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.lifecycles;
+
+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.concurrent.atomic.AtomicInteger;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+import javax.ws.rs.ext.Providers;
+
+@Provider
+@Produces("text/plain")
+@Consumes("text/plain")
+public class MyMessageBodyReaderAndWriter implements MessageBodyWriter<Object>, MessageBodyReader<Object> {
+
+ public static AtomicInteger readFromCounter = new AtomicInteger(0);
+
+ public static AtomicInteger writeToCounter = new AtomicInteger(0);
+
+ public static AtomicInteger constructorCounter = new AtomicInteger(0);
+
+ @Context
+ Providers providers;
+
+ public MyMessageBodyReaderAndWriter() {
+ constructorCounter.incrementAndGet();
+ }
+
+ public long getSize(Object arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4) {
+ return ((String)arg0).getBytes().length;
+ }
+
+ public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+
+ return String.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 {
+ writeToCounter.incrementAndGet();
+ arg6.write(((String)arg0).getBytes());
+ }
+
+ public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+ return String.class.equals(arg0);
+ }
+
+ public Object readFrom(Class<Object> arg0,
+ Type arg1,
+ Annotation[] arg2,
+ MediaType arg3,
+ MultivaluedMap<String, String> arg4,
+ InputStream arg5) throws IOException, WebApplicationException {
+ readFromCounter.incrementAndGet();
+
+ MessageBodyReader<String> strReader =
+ providers.getMessageBodyReader(String.class,
+ String.class,
+ arg2,
+ MediaType.APPLICATION_OCTET_STREAM_TYPE);
+ return strReader.readFrom(String.class, String.class, arg2, arg3, arg4, arg5);
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/lifecycles/MyResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/lifecycles/MyResource.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/lifecycles/MyResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/lifecycles/MyResource.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,63 @@
+/*
+ * 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.lifecycles;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+@Path("jaxrs/tests/lifecycles")
+public class MyResource {
+
+ public static AtomicInteger constructorCounter = new AtomicInteger(0);
+ public static AtomicInteger invokedMethod = new AtomicInteger(0);
+ public static AtomicInteger invokedCounterMethod = new AtomicInteger(0);
+
+ public MyResource() {
+ constructorCounter.incrementAndGet();
+ }
+
+ @POST
+ @Produces("text/plain")
+ public String getString(String echo) {
+ invokedMethod.getAndIncrement();
+ return echo;
+ }
+
+ @GET
+ @Produces("text/plain")
+ public String getCounters() {
+ invokedCounterMethod.getAndIncrement();
+ return MyMessageBodyReaderAndWriter.constructorCounter.get() + ":"
+ + MyMessageBodyReaderAndWriter.readFromCounter.get()
+ + ":"
+ + MyMessageBodyReaderAndWriter.writeToCounter.get()
+ + ":"
+ + constructorCounter.get()
+ + ":"
+ + invokedMethod.get()
+ + ":"
+ + invokedCounterMethod.get();
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/Application.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/Application.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/Application.java Thu Jul 16 20:01:58 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.methodannotations;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * <code>HTTPMethod</code> annotation test application.
+ */
+public class Application extends javax.ws.rs.core.Application {
+
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+
+ public Application() {
+ classes = new HashSet<Class<?>>();
+ classes.add(HttpMethodWarningResource.class);
+ classes.add(HttpMethodResource.class);
+ classes.add(CustomHttpMethodResource.class);
+ classes = Collections.unmodifiableSet(classes);
+ }
+
+ @Override
+ public Set<Class<?>> getClasses() {
+ return classes;
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/CustomHttpMethodResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/CustomHttpMethodResource.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/CustomHttpMethodResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/CustomHttpMethodResource.java Thu Jul 16 20:01:58 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.methodannotations;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+
+@Path(value = "/customhttpmethod")
+public class CustomHttpMethodResource {
+
+ @GET
+ public Response get() {
+ Response resp = Response.ok().build();
+ resp.getMetadata().putSingle("GET", "TRUE");
+ return resp;
+ }
+
+ @MyHttpOPTIONSAnnotation
+ public Response options() {
+ Response resp = Response.ok().build();
+ List<Object> allowList = new ArrayList<Object>();
+ allowList.add("HEAD");
+ allowList.add("OPTIONS");
+ allowList.add("GET");
+ resp.getMetadata().put("Allow", allowList);
+ return resp;
+ }
+
+ @MyHttpHEADAnnotation
+ public Response head() {
+ Response resp = Response.ok().build();
+ resp.getMetadata().putSingle("HEAD", "TRUE");
+ return resp;
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/HttpMethodResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/HttpMethodResource.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/HttpMethodResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/HttpMethodResource.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.methodannotations;
+
+import javax.ws.rs.Path;
+
+@Path("httpmethod")
+public class HttpMethodResource {
+
+ @MyHttpGETAnnotation
+ public String myGetMethod() {
+ return "You found my GET method!";
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/HttpMethodWarningResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/HttpMethodWarningResource.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/HttpMethodWarningResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/HttpMethodWarningResource.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,63 @@
+/*
+ * 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.methodannotations;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+
+/**
+ * Resource with several different type of warnings.
+ */
+@Path("httpmethodwarning")
+public class HttpMethodWarningResource {
+
+ public HttpMethodWarningResource() {
+
+ }
+
+
+ @PUT
+ @POST
+ public String multiHttpMethodBadBehavior() {
+ /*
+ * This should not be allowed and violates RESTful principles even if
+ * some browsers can't do a PUT.
+ */
+ return "Should not see me";
+ }
+
+ @SuppressWarnings("unused")
+ @GET
+ @Path("/{id}")
+ private String nonPublicGETMethod(@PathParam("id") String id, @QueryParam("detailed") String isDetailed) {
+ return "Should not be able to GET me.";
+ }
+
+ @DELETE
+ protected String nonPublicDeleteMethod() {
+ return "Should not be able to DELETE me.";
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/MyHttpGETAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/MyHttpGETAnnotation.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/MyHttpGETAnnotation.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/MyHttpGETAnnotation.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.methodannotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.ws.rs.HttpMethod;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@HttpMethod("GET")
+public @interface MyHttpGETAnnotation {
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/MyHttpHEADAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/MyHttpHEADAnnotation.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/MyHttpHEADAnnotation.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/MyHttpHEADAnnotation.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.methodannotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.ws.rs.HttpMethod;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@HttpMethod("HEAD")
+public @interface MyHttpHEADAnnotation {
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/MyHttpOPTIONSAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/MyHttpOPTIONSAnnotation.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/MyHttpOPTIONSAnnotation.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/methodannotations/MyHttpOPTIONSAnnotation.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.methodannotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.ws.rs.HttpMethod;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@HttpMethod("OPTIONS")
+public @interface MyHttpOPTIONSAnnotation {
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/Application.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/Application.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/Application.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.wink.jaxrs.test.nofindmethods;
+
+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(ResourceWithHTTPVerbMethodNames.class);
+ clazzes.add(ResourceWithSublocatorHTTPVerbMethodNames.class);
+ clazzes.add(CounterResource.class);
+ return clazzes;
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/CounterResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/CounterResource.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/CounterResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/CounterResource.java Thu Jul 16 20:01:58 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.jaxrs.test.nofindmethods;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+@Path("nousemethodnamesforhttpverbs/counter")
+public class CounterResource {
+
+ @Path("root")
+ @GET
+ public String rootCounter() {
+ return Integer.valueOf(ResourceWithHTTPVerbMethodNames.counter)
+ .toString();
+ }
+
+ @Path("sublocator")
+ @GET
+ public String sublocatorCounter() {
+ return Integer.valueOf(SomeClassWithHTTPMethodVerbNames.counter)
+ .toString();
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/ResourceWithHTTPVerbMethodNames.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/ResourceWithHTTPVerbMethodNames.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/ResourceWithHTTPVerbMethodNames.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/ResourceWithHTTPVerbMethodNames.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.wink.jaxrs.test.nofindmethods;
+
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+@Path("nousemethodnamesforhttpverbs/someresource")
+public class ResourceWithHTTPVerbMethodNames {
+
+ static int counter = 0;
+
+ public String getSomething() {
+ ++counter;
+ return "hello world";
+ }
+
+ @Produces("text/plain")
+ public String postSomething() {
+ ++counter;
+ return "hello world";
+ }
+
+ public String deleteSomething() {
+ ++counter;
+ return "hello world";
+ }
+
+ public String putSomething() {
+ ++counter;
+ return "hello world";
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/ResourceWithSublocatorHTTPVerbMethodNames.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/ResourceWithSublocatorHTTPVerbMethodNames.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/ResourceWithSublocatorHTTPVerbMethodNames.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/ResourceWithSublocatorHTTPVerbMethodNames.java Thu Jul 16 20:01:58 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.nofindmethods;
+
+import javax.ws.rs.Path;
+
+@Path("nousemethodnamesforhttpverbs/sublocatorresource")
+public class ResourceWithSublocatorHTTPVerbMethodNames {
+
+ @Path("sub")
+ public SomeClassWithHTTPMethodVerbNames getSublocator() {
+ return new SomeClassWithHTTPMethodVerbNames();
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/SomeClassWithHTTPMethodVerbNames.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/SomeClassWithHTTPMethodVerbNames.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/SomeClassWithHTTPMethodVerbNames.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/nofindmethods/SomeClassWithHTTPMethodVerbNames.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.wink.jaxrs.test.nofindmethods;
+
+public class SomeClassWithHTTPMethodVerbNames {
+
+ static int counter = 0;
+
+ public String getSomething() {
+ ++counter;
+ return "hello world";
+ }
+
+ public String putSomething() {
+ ++counter;
+ return "hello world";
+ }
+
+ public String deleteSomething() {
+ ++counter;
+ return "hello world";
+ }
+
+ public String postSomething() {
+ ++counter;
+ return "hello world";
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/returntype/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/returntype/Application.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/returntype/Application.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/returntype/Application.java Thu Jul 16 20:01:58 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.jaxrs.test.returntype;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Return types test application.
+ */
+public class Application extends javax.ws.rs.core.Application {
+
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+
+ public Application() {
+ classes = new HashSet<Class<?>>();
+ classes.add(ReturnTypeStatusResource.class);
+ classes = Collections.unmodifiableSet(classes);
+ }
+
+ @Override
+ public Set<Class<?>> getClasses() {
+ return classes;
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/returntype/ReturnTypeStatusResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/returntype/ReturnTypeStatusResource.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/returntype/ReturnTypeStatusResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/returntype/ReturnTypeStatusResource.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,110 @@
+/*
+ * 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.returntype;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+import javax.ws.rs.core.Response.Status;
+
+@Path("returntypestatus")
+public class ReturnTypeStatusResource {
+
+ @Path("/void")
+ @GET
+ public void getVoidResponse() {
+ System.out.println("In void response method");
+ }
+
+ @Path("/null")
+ @GET
+ public Object getNull() {
+ System.out.println("In null response method");
+ return null;
+ }
+
+ @Path("/nullresponse")
+ @GET
+ public Response getNullResponse() {
+ System.out.println("In null response method");
+ return null;
+ }
+
+ @Path("/responsestatus")
+ @GET
+ public Response getResponseStatus(@QueryParam("code") String code) {
+ Status s = Status.valueOf(code);
+ ResponseBuilder respBuilder = Response.status(s);
+ respBuilder.entity("Requested status: " + s.getStatusCode() + " "
+ + s.name());
+ return respBuilder.build();
+ }
+
+ @Path("/CustomResponseStatusNotSet")
+ @GET
+ public Response getCustomResponseStatusNotSet() {
+ final MultivaluedMap<String, Object> map = Response.ok().build()
+ .getMetadata();
+ map.clear();
+ return new Response() {
+ @Override
+ public Object getEntity() {
+ return "CustomApplicationResponse";
+ }
+
+ @Override
+ public MultivaluedMap<String, Object> getMetadata() {
+ return map;
+ }
+
+ @Override
+ public int getStatus() {
+ return -1;
+ }
+ };
+ }
+
+ @Path("/CustomNullResponseStatusNotSet")
+ @GET
+ public Response getCustomNullResponseStatusNotSet() {
+ final MultivaluedMap<String, Object> map = Response.ok().build()
+ .getMetadata();
+ map.clear();
+ return new Response() {
+ @Override
+ public Object getEntity() {
+ return null;
+ }
+
+ @Override
+ public MultivaluedMap<String, Object> getMetadata() {
+ return map;
+ }
+
+ @Override
+ public int getStatus() {
+ return -1;
+ }
+ };
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/sequence/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/sequence/Application.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/sequence/Application.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/sequence/Application.java Thu Jul 16 20:01:58 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.sequence;
+
+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(SequenceResource.class);
+ return clazzes;
+ }
+
+ @Override
+ public Set<Object> getSingletons() {
+ Set<Object> objs = new HashSet<Object>();
+ objs.add(new SequenceSingletonResource());
+ return objs;
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/sequence/SequenceResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/sequence/SequenceResource.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/sequence/SequenceResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/sequence/SequenceResource.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,80 @@
+/*
+ * 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.sequence;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+/**
+ * A resource which keeps track of a constructor, method, and overall static
+ * count for testing resources called multiple times.
+ */
+@Path("/sequence")
+public class SequenceResource {
+
+ private int hits = 0;
+
+ private static int staticHitCount = 0;
+
+ private static int constructorHitCount = 0;
+
+ public SequenceResource() {
+ hits = 0;
+ constructorHitCount += 1;
+ }
+
+ @GET
+ public String countHits() {
+ return "" + hits;
+ }
+
+ @POST
+ public String addHit() {
+ ++hits;
+ ++staticHitCount;
+ return "" + hits;
+ }
+
+ @DELETE
+ @Path("/static")
+ public void clearStaticHitCount() {
+ staticHitCount = 0;
+ }
+
+ @GET
+ @Path("/static")
+ public String countStaticHits() {
+ return "" + staticHitCount;
+ }
+
+ @DELETE
+ @Path("/constructor")
+ public void clearConstructorHitCount() {
+ constructorHitCount = 0;
+ }
+
+ @GET
+ @Path("/constructor")
+ public String countConstructorHits() {
+ return "" + constructorHitCount;
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/sequence/SequenceSingletonResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/sequence/SequenceSingletonResource.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/sequence/SequenceSingletonResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/sequence/SequenceSingletonResource.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,80 @@
+/*
+ * 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.sequence;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+/**
+ * A singleton resource which keeps track of a constructor, method, and overall
+ * static count for testing resources called multiple times.
+ */
+@Path("/singletonsequence")
+public class SequenceSingletonResource {
+
+ private int hits = 0;
+
+ private static int staticHitCount = 0;
+
+ private static int constructorHitCount = 0;
+
+ public SequenceSingletonResource() {
+ hits = 0;
+ ++constructorHitCount;
+ }
+
+ @GET
+ public String countHits() {
+ return "" + hits;
+ }
+
+ @POST
+ public String addHit() {
+ ++hits;
+ ++staticHitCount;
+ return "" + hits;
+ }
+
+ @DELETE
+ @Path("/static")
+ public void clearStaticHitCount() {
+ staticHitCount = 0;
+ }
+
+ @GET
+ @Path("/static")
+ public String countStaticHits() {
+ return "" + staticHitCount;
+ }
+
+ @DELETE
+ @Path("/constructor")
+ public void clearConstructorHitCount() {
+ constructorHitCount = 0;
+ }
+
+ @GET
+ @Path("/constructor")
+ public String countConstructorHits() {
+ return "" + constructorHitCount;
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/version/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/version/Application.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/version/Application.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/version/Application.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.version;
+
+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(TaxForm.class);
+ return clazzes;
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/version/TaxForm.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/version/TaxForm.java?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/version/TaxForm.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/java/org/apache/wink/jaxrs/test/version/TaxForm.java Thu Jul 16 20:01:58 2009
@@ -0,0 +1,97 @@
+/*
+ * 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.version;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.List;
+
+import javax.servlet.ServletContext;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+
+@Path(value = "/taxform")
+public class TaxForm {
+
+ @Context
+ private HttpHeaders httpHeaders;
+
+ @Context
+ private ServletContext context;
+
+ @GET
+ public InputStream getWithAcceptHeader(@QueryParam(value = "form") String form)
+ throws FileNotFoundException {
+ List<MediaType> mediaTypes = httpHeaders.getAcceptableMediaTypes();
+ if (mediaTypes == null || mediaTypes.isEmpty()) {
+ throw new IllegalArgumentException("Accept values not found");
+ }
+ MediaType mediaType = mediaTypes.get(0);
+ String subtype = mediaType.getSubtype();
+ String version = subtype.substring(subtype.indexOf("+") + 1);
+ String formPath = form + "_" + version;
+ String path = "tests" + java.io.File.separator + "test-resources"
+ + java.io.File.separator + formPath + ".xml";
+ InputStream stream = context.getResourceAsStream("/WEB-INF/classes/"
+ + path);
+ if (stream != null) {
+ return stream;
+ }
+ return new FileInputStream(new File(path));
+ }
+
+ @GET
+ @Path(value = "/{form}")
+ public InputStream getWithQueryString(@PathParam(value = "form") String form, @QueryParam(value = "version") String version)
+ throws FileNotFoundException {
+ String formPath = form + "_" + version;
+ String path = "tests" + java.io.File.separator + "test-resources"
+ + java.io.File.separator + formPath + ".xml";
+ InputStream stream = context.getResourceAsStream("/WEB-INF/classes/"
+ + path);
+ if (stream != null) {
+ return stream;
+ }
+ return new FileInputStream(new File(path));
+ }
+
+ @GET
+ @Path(value = "/{form}/{version}")
+ public InputStream getWithPathInfo(@PathParam(value = "form") String form, @PathParam(value = "version") String version)
+ throws FileNotFoundException {
+ String formPath = form + "_" + version;
+ String path = "tests" + java.io.File.separator + "test-resources"
+ + java.io.File.separator + formPath + ".xml";
+ InputStream stream = context.getResourceAsStream("/WEB-INF/classes/"
+ + path);
+ if (stream != null) {
+ return stream;
+ }
+ return new FileInputStream(new File(path));
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/webapp/WEB-INF/geronimo-web.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/webapp/WEB-INF/geronimo-web.xml?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/webapp/WEB-INF/geronimo-web.xml (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/webapp/WEB-INF/geronimo-web.xml Thu Jul 16 20:01:58 2009
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1"
+ xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
+ xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
+
+ <sys:environment>
+ <sys:moduleId>
+ <sys:groupId>${groupId}</sys:groupId>
+ <sys:artifactId>${artifactId}</sys:artifactId>
+ <sys:version>${version}</sys:version>
+ <sys:type>war</sys:type>
+ </sys:moduleId>
+ </sys:environment>
+
+ <context-root>${artifactId}</context-root>
+</web-app>
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/webapp/WEB-INF/web.xml?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/webapp/WEB-INF/web.xml (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/webapp/WEB-INF/web.xml Thu Jul 16 20:01:58 2009
@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one or
+ more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information regarding
+ copyright ownership. The ASF licenses this file to you under the
+ Apache License, Version 2.0 (the "License"); you may not use
+ this file except in compliance with the License. You may obtain
+ a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed
+ under the License is distributed on an "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+ -->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd" >
+
+<web-app>
+ <display-name>Archetype Created Web Application</display-name>
+ <servlet>
+ <servlet-name>CustomHTTPMethodAnnotations</servlet-name>
+ <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.apache.wink.jaxrs.test.methodannotations.Application</param-value>
+ </init-param>
+ <init-param>
+ <param-name>requestProcessorAttribute</param-name>
+ <param-value>requestProcessorAttribute_customannotations</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>Lifecycles</servlet-name>
+ <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.apache.wink.jaxrs.test.lifecycles.Application</param-value>
+ </init-param>
+ <init-param>
+ <param-name>requestProcessorAttribute</param-name>
+ <param-value>requestProcessorAttribute_lifecycles</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>ReturnTypes</servlet-name>
+ <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.apache.wink.jaxrs.test.returntype.Application</param-value>
+ </init-param>
+ <init-param>
+ <param-name>requestProcessorAttribute</param-name>
+ <param-value>requestProcessorAttribute_returntypes</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>Exceptional</servlet-name>
+ <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.apache.wink.jaxrs.test.exceptions.Application</param-value>
+ </init-param>
+ <init-param>
+ <param-name>requestProcessorAttribute</param-name>
+ <param-value>requestProcessorAttribute_exceptions</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>Sequence</servlet-name>
+ <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.apache.wink.jaxrs.test.sequence.Application</param-value>
+ </init-param>
+ <init-param>
+ <param-name>requestProcessorAttribute</param-name>
+ <param-value>requestProcessorAttribute_sequence</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>LargeEntity</servlet-name>
+ <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.apache.wink.jaxrs.test.largeentity.Application</param-value>
+ </init-param>
+ <init-param>
+ <param-name>requestProcessorAttribute</param-name>
+ <param-value>requestProcessorAttribute_largeentity</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>Headers</servlet-name>
+ <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.apache.wink.jaxrs.test.headers.Application</param-value>
+ </init-param>
+ <init-param>
+ <param-name>requestProcessorAttribute</param-name>
+ <param-value>requestProcessorAttribute_headers</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>NoFindMethods</servlet-name>
+ <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.apache.wink.jaxrs.test.nofindmethods.Application</param-value>
+ </init-param>
+ <init-param>
+ <param-name>requestProcessorAttribute</param-name>
+ <param-value>requestProcessorAttribute_nofindmethods</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>Cache</servlet-name>
+ <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.apache.wink.jaxrs.test.cache.Application</param-value>
+ </init-param>
+ <init-param>
+ <param-name>requestProcessorAttribute</param-name>
+ <param-value>requestProcessorAttribute_cache</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>ContentNegotiation</servlet-name>
+ <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.apache.wink.jaxrs.test.contentnegotiation.Application</param-value>
+ </init-param>
+ <init-param>
+ <param-name>requestProcessorAttribute</param-name>
+ <param-value>requestProcessorAttribute_negotiation</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>AddressBook</servlet-name>
+ <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.apache.wink.jaxrs.test.addressbook.AddressApplication</param-value>
+ </init-param>
+ <init-param>
+ <param-name>requestProcessorAttribute</param-name>
+ <param-value>requestProcessorAttribute_addressbook</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>VersionTests</servlet-name>
+ <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.apache.wink.jaxrs.test.version.Application</param-value>
+ </init-param>
+ <init-param>
+ <param-name>requestProcessorAttribute</param-name>
+ <param-value>requestProcessorAttribute_version</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>CustomHTTPMethodAnnotations</servlet-name>
+ <url-pattern>/customannotations/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Lifecycles</servlet-name>
+ <url-pattern>/lifecycles/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>ReturnTypes</servlet-name>
+ <url-pattern>/returntypes/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Exceptional</servlet-name>
+ <url-pattern>/exceptional/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Sequence</servlet-name>
+ <url-pattern>/sequence/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>LargeEntity</servlet-name>
+ <url-pattern>/largeentity/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Headers</servlet-name>
+ <url-pattern>/headers/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>NoFindMethods</servlet-name>
+ <url-pattern>/nofindmethods/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Cache</servlet-name>
+ <url-pattern>/cache/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>ContentNegotiation</servlet-name>
+ <url-pattern>/contentNegotiation/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>AddressBook</servlet-name>
+ <url-pattern>/addressBook/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>VersionTests</servlet-name>
+ <url-pattern>/version/*</url-pattern>
+ </servlet-mapping>
+</web-app>
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/webapp/index.jsp?rev=794815&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/webapp/index.jsp (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-targetting/src/main/webapp/index.jsp Thu Jul 16 20:01:58 2009
@@ -0,0 +1,23 @@
+<%--
+ 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.
+--%>
+<html>
+<body>
+<h2>Hello World!</h2>
+</body>
+</html>