You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wink.apache.org by bl...@apache.org on 2009/08/07 05:10:46 UTC
svn commit: r801869 [17/21] - in /incubator/wink/trunk:
wink-integration-test/
wink-integration-test/wink-server-integration-test-support/
wink-integration-test/wink-server-integration-test-support/src/main/java/org/apache/wink/test/integration/
wink-i...
Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/Application.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/Application.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/Application.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.exceptions;
+
+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(ExistingResource.class);
+ clazzes.add(ResourceWithMethod.class);
+ clazzes.add(ResourceWithOnlyConsumesAndGET.class);
+ clazzes.add(ResourceWithOnlyProducesAndGET.class);
+ clazzes.add(ResourceWithConsumesAndProducesAndGET.class);
+ clazzes.add(NullResource.class);
+ clazzes.add(ApplicationOctetStreamMessageBodyReader.class);
+ return clazzes;
+ }
+
+}
Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ApplicationOctetStreamMessageBodyReader.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ApplicationOctetStreamMessageBodyReader.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ApplicationOctetStreamMessageBodyReader.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ApplicationOctetStreamMessageBodyReader.java Fri Aug 7 03:10:22 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.itest.exceptions;
+
+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.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.Provider;
+import javax.ws.rs.ext.Providers;
+
+@Provider
+@Consumes("application/octet-stream")
+public class ApplicationOctetStreamMessageBodyReader implements MessageBodyReader<byte[]> {
+
+ @Context
+ private Providers providers;
+
+ public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+ return arg3.equals(MediaType.APPLICATION_OCTET_STREAM_TYPE) && byte[].class.equals(arg0);
+ }
+
+ public byte[] readFrom(Class<byte[]> arg0,
+ Type arg1,
+ Annotation[] arg2,
+ MediaType arg3,
+ MultivaluedMap<String, String> arg4,
+ InputStream arg5) throws IOException, WebApplicationException {
+ MessageBodyReader<String> reader =
+ providers.getMessageBodyReader(String.class, String.class, arg2, arg3);
+ String input = reader.readFrom(String.class, String.class, arg2, arg3, arg4, arg5);
+ return ("userReader" + input).getBytes();
+ }
+
+}
Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ExistingResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ExistingResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ExistingResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ExistingResource.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.exceptions;
+
+import javax.ws.rs.Path;
+
+@Path("existingresource")
+public class ExistingResource {
+
+}
Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/NullResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/NullResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/NullResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/NullResource.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.exceptions;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+@Path("targeting/nullresource")
+public class NullResource {
+
+ @POST
+ @Path("withconsumes")
+ @Consumes("text/plain")
+ public Response returnTextWithConsumes(byte[] echo) {
+ if (echo != null) {
+ return Response.ok(echo).build();
+ }
+ return Response.ok("calledWithConsumes").build();
+ }
+
+ @POST
+ @Path("withoutconsumes")
+ public Response returnTextWithoutConsumes(byte[] echo) {
+ if (echo != null) {
+ return Response.ok(echo).build();
+ }
+ return Response.ok("calledWithoutConsumes").build();
+ }
+
+ @POST
+ @Path("withproduces")
+ @Produces("custom/type")
+ public Response returnTextWithProduces() {
+ return Response.ok("calledWithProduces").build();
+ }
+
+ @POST
+ @Path("withoutproduces")
+ public Response returnTextWithoutProduces() {
+ return Response.ok("calledWithoutProduces").build();
+ }
+}
Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ResourceWithConsumesAndProducesAndGET.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ResourceWithConsumesAndProducesAndGET.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ResourceWithConsumesAndProducesAndGET.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ResourceWithConsumesAndProducesAndGET.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.exceptions;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+@Path("/targeting/resourceconsumesandproduces")
+public class ResourceWithConsumesAndProducesAndGET {
+
+ @GET
+ @Consumes(MediaType.APPLICATION_XML)
+ @Produces(MediaType.APPLICATION_XML)
+ public Response getXML() {
+ return Response.ok("Hello XML Consumes And Produces").build();
+ }
+
+ @GET
+ @Consumes(MediaType.APPLICATION_XML)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response requestXMLThenResponseJSON() {
+ return Response.ok("Hello XML Consumes And JSON Produces").build();
+ }
+
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response getJSON() {
+ return Response.ok("Hello JSON Consumes And Produces").build();
+ }
+}
Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ResourceWithMethod.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ResourceWithMethod.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ResourceWithMethod.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ResourceWithMethod.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.exceptions;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+@Path("/targeting/resourcewithmethod")
+public class ResourceWithMethod {
+
+ @GET
+ public String getSomething() {
+ return "Hello";
+ }
+
+ @PUT
+ @Consumes("text/plain")
+ @Produces("text/plain")
+ public String getSomething(String hello) {
+ return hello;
+ }
+}
Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ResourceWithOnlyConsumesAndGET.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ResourceWithOnlyConsumesAndGET.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ResourceWithOnlyConsumesAndGET.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ResourceWithOnlyConsumesAndGET.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.exceptions;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+@Path("/targeting/resourceonlyconsumes")
+public class ResourceWithOnlyConsumesAndGET {
+
+ @GET
+ @Consumes(MediaType.APPLICATION_XML)
+ public Response getXML() {
+ return Response.ok("Hello XML Consumes").type("text/plain").build();
+ }
+
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Response getJSON() {
+ return Response.ok("Hello JSON Consumes").type("text/plain").build();
+ }
+}
Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ResourceWithOnlyProducesAndGET.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ResourceWithOnlyProducesAndGET.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ResourceWithOnlyProducesAndGET.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/exceptions/ResourceWithOnlyProducesAndGET.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.exceptions;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+@Path("/targeting/resourceonlyproduces")
+public class ResourceWithOnlyProducesAndGET {
+
+ @GET
+ @Produces(MediaType.APPLICATION_XML)
+ public Response getXML() {
+ return Response.ok("Hello XML Produces").build();
+ }
+
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public String getJSON() {
+ return "Hello JSON Produces";
+ }
+
+}
Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/headers/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/headers/Application.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/headers/Application.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/headers/Application.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.headers;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class Application extends javax.ws.rs.core.Application {
+
+ public Set<Class<?>> getClasses() {
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+ classes.add(HeadersResource.class);
+ classes.add(HeadersAllowResource.class);
+ classes.add(HeadersAllowResource2.class);
+ return classes;
+ }
+
+}
Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/headers/HeadersAllowResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/headers/HeadersAllowResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/headers/HeadersAllowResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/headers/HeadersAllowResource.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.headers;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+
+@Path("/headersallow1")
+public class HeadersAllowResource {
+
+ @GET
+ @Path(value = "/allow1")
+ public Response getAllow1() {
+ return Response.ok().build();
+ }
+}
Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/headers/HeadersAllowResource2.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/headers/HeadersAllowResource2.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/headers/HeadersAllowResource2.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/headers/HeadersAllowResource2.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/headers/HeadersResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/headers/HeadersResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/headers/HeadersResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/headers/HeadersResource.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/largeentity/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/largeentity/Application.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/largeentity/Application.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/largeentity/Application.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/largeentity/JARInputStreamProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/largeentity/JARInputStreamProvider.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/largeentity/JARInputStreamProvider.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/largeentity/JARInputStreamProvider.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/largeentity/LargeResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/largeentity/LargeResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/largeentity/LargeResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/largeentity/LargeResource.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.largeentity;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+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(byte[] input) throws UnsupportedEncodingException {
+ final int maxHeaderLength = 100;
+ int headerLength = (input.length < maxHeaderLength) ? input.length : maxHeaderLength;
+ byte[] headerBytes = new byte[headerLength];
+ for (int c = 0; c < headerLength; ++c) {
+ headerBytes[c] = input[c];
+ }
+
+ StringBuffer sb = new StringBuffer();
+ for (int c = 0; c < 50; ++c) {
+ sb.append("abcdefghijklmnopqrstuvwxyz");
+ }
+ // String headerValue = new String(headerBytes, "UTF-8");
+
+ /*
+ * 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).header("appendStringsHeader", sb).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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/lifecycles/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/lifecycles/Application.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/lifecycles/Application.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/lifecycles/Application.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/lifecycles/MyMessageBodyReaderAndWriter.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/lifecycles/MyMessageBodyReaderAndWriter.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/lifecycles/MyMessageBodyReaderAndWriter.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/lifecycles/MyMessageBodyReaderAndWriter.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.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.DELETE;
+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);
+ }
+
+ @DELETE
+ public void resetMethodCounters() {
+ writeToCounter.set(0);
+ readFromCounter.set(0);
+ }
+
+}
Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/lifecycles/MyResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/lifecycles/MyResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/lifecycles/MyResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/lifecycles/MyResource.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.lifecycles;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.ws.rs.DELETE;
+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();
+ }
+
+ @DELETE
+ public void resetMethodCounters() {
+ invokedMethod.set(0);
+ invokedCounterMethod.set(0);
+ constructorCounter.set(0);
+ MyMessageBodyReaderAndWriter.readFromCounter.set(0);
+ MyMessageBodyReaderAndWriter.writeToCounter.set(0);
+ }
+
+}
Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/Application.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/Application.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/Application.java Fri Aug 7 03:10:22 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.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/CustomHttpMethodResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/CustomHttpMethodResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/CustomHttpMethodResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/CustomHttpMethodResource.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/HttpMethodResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/HttpMethodResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/HttpMethodResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/HttpMethodResource.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/HttpMethodWarningResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/HttpMethodWarningResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/HttpMethodWarningResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/HttpMethodWarningResource.java Fri Aug 7 03:10:22 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.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/MyHttpGETAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/MyHttpGETAnnotation.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/MyHttpGETAnnotation.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/MyHttpGETAnnotation.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/MyHttpHEADAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/MyHttpHEADAnnotation.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/MyHttpHEADAnnotation.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/MyHttpHEADAnnotation.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/MyHttpOPTIONSAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/MyHttpOPTIONSAnnotation.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/MyHttpOPTIONSAnnotation.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/methodannotations/MyHttpOPTIONSAnnotation.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/Application.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/Application.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/Application.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/CounterResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/CounterResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/CounterResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/CounterResource.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/ResourceWithHTTPVerbMethodNames.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/ResourceWithHTTPVerbMethodNames.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/ResourceWithHTTPVerbMethodNames.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/ResourceWithHTTPVerbMethodNames.java Fri Aug 7 03:10:22 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.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/ResourceWithSublocatorHTTPVerbMethodNames.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/ResourceWithSublocatorHTTPVerbMethodNames.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/ResourceWithSublocatorHTTPVerbMethodNames.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/ResourceWithSublocatorHTTPVerbMethodNames.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/SomeClassWithHTTPMethodVerbNames.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/SomeClassWithHTTPMethodVerbNames.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/SomeClassWithHTTPMethodVerbNames.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/nofindmethods/SomeClassWithHTTPMethodVerbNames.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/returntype/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/returntype/Application.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/returntype/Application.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/returntype/Application.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/returntype/ReturnTypeStatusResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/returntype/ReturnTypeStatusResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/returntype/ReturnTypeStatusResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/returntype/ReturnTypeStatusResource.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/sequence/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/sequence/Application.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/sequence/Application.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/sequence/Application.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/sequence/SequenceResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/sequence/SequenceResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/sequence/SequenceResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/sequence/SequenceResource.java Fri Aug 7 03:10:22 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.itest.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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/sequence/SequenceSingletonResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/sequence/SequenceSingletonResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/sequence/SequenceSingletonResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/sequence/SequenceSingletonResource.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.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
+ public void clearHits() {
+ hits = 0;
+ }
+
+ @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-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/transferencoding/ChunkedMirror.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/transferencoding/ChunkedMirror.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/transferencoding/ChunkedMirror.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/transferencoding/ChunkedMirror.java Fri Aug 7 03:10:22 2009
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.itest.transferencoding;
+
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+@Path("/chunkedbook")
+public class ChunkedMirror {
+
+ @POST
+ public byte[] postSomething(byte[] b) {
+ return b;
+ }
+}