You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wink.apache.org by jr...@apache.org on 2009/07/14 21:47:02 UTC
svn commit: r794036 [1/3] - in
/incubator/wink/trunk/wink-integration-test/wink-server-integration-test:
./ wink-jaxrs-test-params/ wink-jaxrs-test-params/src/
wink-jaxrs-test-params/src/main/ wink-jaxrs-test-params/src/main/java/
wink-jaxrs-test-param...
Author: jramos
Date: Tue Jul 14 19:47:00 2009
New Revision: 794036
URL: http://svn.apache.org/viewvc?rev=794036&view=rev
Log:
[WINK-59] Drop params integration test suite
Added:
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/pom.xml
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/Application.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/AutoDecodeParamResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/CookieParamResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/DefaultValueResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/EncodingParamResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/HeaderParamResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/MatrixParamNotSetResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/MatrixParamResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/PathSegmentResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/QueryParamNotSetResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/QueryParamResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/form/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/form/FormParamResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/header/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/header/HeaderParamDefaultResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/header/HeaderParamExceptionResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/header/HeaderStringConstructor.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/query/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/query/ParamStringConstructor.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/query/QueryParamsExceptionResource.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/webapp/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/webapp/WEB-INF/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/webapp/WEB-INF/web.xml
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/webapp/index.jsp
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/java/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/java/org/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/java/org/apache/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/java/org/apache/wink/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/java/org/apache/wink/jaxrs/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/java/org/apache/wink/jaxrs/test/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/java/org/apache/wink/jaxrs/test/params/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/java/org/apache/wink/jaxrs/test/params/CookieParamTest.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/java/org/apache/wink/jaxrs/test/params/DefaultValueParamTest.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/java/org/apache/wink/jaxrs/test/params/EncodingParamTest.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/java/org/apache/wink/jaxrs/test/params/FormParamTest.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/java/org/apache/wink/jaxrs/test/params/HeaderParamTest.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/java/org/apache/wink/jaxrs/test/params/MatrixParamTest.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/java/org/apache/wink/jaxrs/test/params/ParamQueryNotSetTest.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/java/org/apache/wink/jaxrs/test/params/PathSegmentTest.java
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/test/java/org/apache/wink/jaxrs/test/params/QueryParamTest.java
Modified:
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/pom.xml
Modified: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/pom.xml?rev=794036&r1=794035&r2=794036&view=diff
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/pom.xml (original)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/pom.xml Tue Jul 14 19:47:00 2009
@@ -16,9 +16,7 @@
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>wink-integration-test</artifactId>
<groupId>org.apache.wink</groupId>
@@ -35,7 +33,8 @@
<modules>
<module>wink-jaxrs-test-context</module>
<module>wink-jaxrs-test-providers</module>
- </modules>
+ <module>wink-jaxrs-test-params</module>
+ </modules>
<properties>
</properties>
@@ -178,8 +177,7 @@
<artifactId>geronimo-maven-plugin</artifactId>
<configuration>
<reporters>
- <reporter
- implementation="org.apache.geronimo.mavenplugins.geronimo.reporting.SurefireReporter">
+ <reporter implementation="org.apache.geronimo.mavenplugins.geronimo.reporting.SurefireReporter">
<reportsDirectory>${project.build.directory}/surefire-reports
</reportsDirectory>
</reporter>
@@ -297,7 +295,7 @@
<phase>pre-integration-test</phase>
<configuration>
<wait>false</wait>
- <deployables />
+ <deployables/>
</configuration>
</execution>
<execution>
@@ -503,4 +501,3 @@
</profiles>
</project>
-
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/pom.xml?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/pom.xml (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/pom.xml Tue Jul 14 19:47:00 2009
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+ <parent>
+ <artifactId>wink-server-integration-test</artifactId>
+ <groupId>org.apache.wink</groupId>
+ <version>0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.wink</groupId>
+ <artifactId>wink-jaxrs-test-params</artifactId>
+ <packaging>war</packaging>
+ <name>wink-jaxrs-test-params Maven Webapp</name>
+ <version>0.1-SNAPSHOT</version>
+ <url>http://maven.apache.org</url>
+ <build>
+ <finalName>wink-jaxrs-test-params</finalName>
+ </build>
+</project>
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/Application.java?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/Application.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/Application.java Tue Jul 14 19:47:00 2009
@@ -0,0 +1,69 @@
+/*
+ * 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.params;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.wink.jaxrs.test.params.form.FormParamResource;
+import org.apache.wink.jaxrs.test.params.header.HeaderParamDefaultResource;
+import org.apache.wink.jaxrs.test.params.header.HeaderParamExceptionResource;
+import org.apache.wink.jaxrs.test.params.query.QueryParamsExceptionResource;
+
+/**
+ * Parameters 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(HeaderParamResource.class);
+ classes.add(MatrixParamResource.class);
+ classes.add(QueryParamResource.class);
+ classes.add(EncodingParamResource.class);
+ classes.add(AutoDecodeParamResource.class);
+ classes.add(DefaultValueResource.class);
+ classes.add(CookieParamResource.class);
+
+ classes.add(HeaderParamDefaultResource.class);
+ classes.add(HeaderParamExceptionResource.class);
+
+ classes.add(QueryParamsExceptionResource.class);
+
+ classes.add(FormParamResource.class);
+
+ classes.add(QueryParamNotSetResource.class);
+ classes.add(MatrixParamNotSetResource.class);
+
+ classes.add(PathSegmentResource.class);
+
+ // classes.add(MultipleEntityParamsResource.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-params/src/main/java/org/apache/wink/jaxrs/test/params/AutoDecodeParamResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/AutoDecodeParamResource.java?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/AutoDecodeParamResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/AutoDecodeParamResource.java Tue Jul 14 19:47:00 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.jaxrs.test.params;
+
+import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.MatrixParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+
+@Path("/decodedparams")
+public class AutoDecodeParamResource {
+
+ final private String appVersion;
+
+ public AutoDecodeParamResource(@MatrixParam("appversion") String appVersion) {
+ this.appVersion = appVersion;
+ }
+
+ @GET
+ @Path("country/{location}")
+ public String getShopInCountryDecoded(@PathParam("location") String location) {
+ return "getShopInCountryDecoded:location=" + location + ";appversion=" + appVersion;
+ }
+
+ @GET
+ @Path("city")
+ public String getShopInCityDecoded(@QueryParam("location") String location) {
+ return "getShopInCityDecoded:location=" + location + ";appversion=" + appVersion;
+ }
+
+ @GET
+ @Path("street")
+ public String getShopOnStreetDecoded(@MatrixParam("location") String location) {
+ return "getShopOnStreetDecoded:location=" + location + ";appversion=" + appVersion;
+ }
+
+ @POST
+ @Path("region")
+ public String getShopInRegionDecoded(@FormParam("location") String location) {
+ return "getShopInRegionDecoded:location=" + location + ";appversion=" + appVersion;
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/CookieParamResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/CookieParamResource.java?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/CookieParamResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/CookieParamResource.java Tue Jul 14 19:47:00 2009
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.params;
+
+import javax.ws.rs.CookieParam;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.NewCookie;
+import javax.ws.rs.core.Response;
+
+@Path("cookiemonster")
+public class CookieParamResource {
+
+ @PUT
+ @Produces("text/plain")
+ public Response swipe(@CookieParam("jar") @DefaultValue("0") String jarSwipes) {
+ return Response.ok("swiped:" + jarSwipes).cookie(new NewCookie("jar", (Integer
+ .valueOf(jarSwipes) + 1) + "")).build();
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/DefaultValueResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/DefaultValueResource.java?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/DefaultValueResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/DefaultValueResource.java Tue Jul 14 19:47:00 2009
@@ -0,0 +1,86 @@
+/*
+ * 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.params;
+
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+
+@Path("defaultvalue")
+public class DefaultValueResource {
+
+ private String version;
+
+ @DefaultValue("100")
+ @QueryParam("limit")
+ private String limit;
+
+ private String sort;
+
+ public DefaultValueResource(@HeaderParam("requestVersion") @DefaultValue("1.0") String version) {
+ this.version = version;
+ }
+
+ public static class Page {
+
+ private String offset;
+
+ public Page(String offset, int dummy) {
+ this.offset = offset;
+ System.out.println("Executed constructor");
+ }
+
+ public String getOffset() {
+ return offset;
+ }
+
+ public int getPage() {
+ return Integer.valueOf(offset) * 1; // Integer.valueOf(limit);
+ }
+
+ public static Page valueOf(String offset) {
+ return new Page(offset, 123);
+ }
+ }
+
+ @GET
+ public String getRow(@QueryParam("offset") @DefaultValue("0") Page page) {
+ return "getRow:" + "offset="
+ + page.getOffset()
+ + ";version="
+ + version
+ + ";limit="
+ + limit
+ + ";sort="
+ + sort;
+ }
+
+ @DefaultValue("normal")
+ @QueryParam("sort")
+ public void setSort(String sort) {
+ this.sort = sort;
+ }
+
+ public String getSort() {
+ return sort;
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/EncodingParamResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/EncodingParamResource.java?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/EncodingParamResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/EncodingParamResource.java Tue Jul 14 19:47:00 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.params;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Encoded;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.MatrixParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+
+@Path("/encodingparam")
+public class EncodingParamResource {
+
+ final private String appVersion;
+
+ public EncodingParamResource(@Encoded @MatrixParam("appversion") String appVersion) {
+ this.appVersion = appVersion;
+ }
+
+ //
+ // @GET
+ // @Path("city/{city}")
+ // public String getShopInCity(@Encoded @QueryParam("q") String searchQuery,
+ // @PathParam("city") String city) {
+ // return "getShopInCity:q=" + searchQuery + ";city=" + city +
+ // ";appversion=" + appVersion;
+ // }
+
+ // @GET
+ // @Path("loc/{location}")
+ // @Encoded
+ // public String getShopInLocation(@QueryParam("q") String searchQuery,
+ // @Encoded @PathParam("location") String location) {
+ // return "getShopInLocation:q=" + searchQuery + ";location=" + location +
+ // ";appversion=" + appVersion;
+ // }
+
+ @GET
+ @Path("country/{location}")
+ public String getShopInCountry(@Encoded @PathParam("location") String location) {
+ return "getShopInCountry:location=" + location + ";appversion=" + appVersion;
+ }
+
+ @GET
+ @Path("method/country/{location}")
+ @Encoded
+ public String getShopInCountryMethod(@PathParam("location") String location) {
+ return "getShopInCountryMethod:location=" + location + ";appversion=" + appVersion;
+ }
+
+ @GET
+ @Encoded
+ @Path("method/city")
+ public String getShopInCityMethod(@QueryParam("location") String location) {
+ return "getShopInCityMethod:location=" + location + ";appversion=" + appVersion;
+ }
+
+ @GET
+ @Path("city")
+ public String getShopInCity(@Encoded @QueryParam("location") String location) {
+ return "getShopInCity:location=" + location + ";appversion=" + appVersion;
+ }
+
+ @GET
+ @Encoded
+ @Path("method/street")
+ public String getShopOnStreetMethod(@MatrixParam("location") String location) {
+ return "getShopOnStreetMethod:location=" + location + ";appversion=" + appVersion;
+ }
+
+ @GET
+ @Path("street")
+ public String getShopOnStreet(@Encoded @MatrixParam("location") String location) {
+ return "getShopOnStreet:location=" + location + ";appversion=" + appVersion;
+ }
+
+ @POST
+ @Path("region")
+ public String getShopInRegion(@Encoded @FormParam("location") String location) {
+ return "getShopInRegion:location=" + location + ";appversion=" + appVersion;
+ }
+
+ @POST
+ @Encoded
+ @Path("method/region")
+ public String getShopInRegionMethod(@FormParam("location") String location) {
+ return "getShopInRegionMethod:location=" + location + ";appversion=" + appVersion;
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/HeaderParamResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/HeaderParamResource.java?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/HeaderParamResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/HeaderParamResource.java Tue Jul 14 19:47:00 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.params;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+
+/**
+ * Resource with<code>HeaderParam</code>.
+ *
+ * @see HeaderParam
+ */
+@Path("header")
+public class HeaderParamResource {
+
+ private String cstrHeaderParam;
+
+ @HeaderParam("Accept-Language")
+ private String acceptLanguage;
+
+ private String agent;
+
+ static public class HeaderValueOf {
+ private HeaderValueOf(String somevalue) {
+ }
+
+ public static HeaderValueOf valueOf(String someValue) {
+ if ("throwex".equals(someValue)) {
+ throw new WebApplicationException(499);
+ } else if ("throwruntimeex".equals(someValue)) {
+ throw new IllegalArgumentException();
+ }
+ return new HeaderValueOf(someValue);
+ }
+ }
+
+ static public class HeaderConstructor {
+ public HeaderConstructor(String somevalue) {
+ if ("throwex".equals(somevalue)) {
+ throw new WebApplicationException(499);
+ } else if ("throwruntimeex".equals(somevalue)) {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+
+ public HeaderParamResource(@HeaderParam("customHeaderParam") String cstrHeaderParam) {
+ this.cstrHeaderParam = cstrHeaderParam;
+ }
+
+ @GET
+ public Response getHeaderParam(@HeaderParam("Accept-Language") String methodLanguage) {
+ return Response.ok("getHeaderParam:" + cstrHeaderParam
+ + ";User-Agent:"
+ + agent
+ + ";Accept-Language:"
+ + acceptLanguage
+ + ";language-method:"
+ + methodLanguage).header("custResponseHeader", "secret").build();
+ }
+
+ @POST
+ public Response getHeaderParamPost(@HeaderParam("CustomHeader") HeaderValueOf customHeader,
+ @HeaderParam("CustomConstructorHeader") HeaderConstructor customHeader2) {
+ return Response.ok().entity("made successful call").build();
+ }
+
+ @HeaderParam("User-Agent")
+ public void setUserAgent(String aUserAgent) {
+ agent = aUserAgent;
+ }
+
+ public String getUserAgent() {
+ return agent;
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/MatrixParamNotSetResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/MatrixParamNotSetResource.java?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/MatrixParamNotSetResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/MatrixParamNotSetResource.java Tue Jul 14 19:47:00 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.jaxrs.test.params;
+
+import java.util.List;
+import java.util.Set;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.MatrixParam;
+import javax.ws.rs.Path;
+
+@Path("/matrixparamnotset")
+public class MatrixParamNotSetResource {
+
+ @Path("int")
+ @GET
+ public String getDefault(@MatrixParam("count") int count) {
+ return count+"";
+ }
+
+ @Path("short")
+ @GET
+ public String getDefault(@MatrixParam("smallCount") short smallCount) {
+ return smallCount+"";
+ }
+
+ @Path("long")
+ @GET
+ public String getDefault(@MatrixParam("longCount") long longCount) {
+ return longCount+"";
+ }
+
+ @Path("float")
+ @GET
+ public String getDefault(@MatrixParam("floatCount") float floatCount) {
+ return floatCount+"";
+ }
+
+ @Path("double")
+ @GET
+ public String getDefault(@MatrixParam("count") double count) {
+ return count+"";
+ }
+
+ @Path("byte")
+ @GET
+ public String getDefault(@MatrixParam("b") byte count) {
+ return count+"";
+ }
+
+ @Path("char")
+ @GET
+ public String getDefault(@MatrixParam("letter") char letter) {
+ return letter + "";
+ }
+
+ @Path("set")
+ @GET
+ public String getDefault(@MatrixParam("bag") Set<Integer> stuff) {
+ return stuff.size()+"";
+ }
+
+ @Path("list")
+ @GET
+ public String getDefault(@MatrixParam("letter") List<String> stuff) {
+ return stuff.size()+"";
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/MatrixParamResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/MatrixParamResource.java?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/MatrixParamResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/MatrixParamResource.java Tue Jul 14 19:47:00 2009
@@ -0,0 +1,348 @@
+/*
+ * 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.params;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.MatrixParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+
+/**
+ * A simple resource to test <code>@MatrixParam</code>.
+ */
+@Path("/matrix")
+public class MatrixParamResource {
+
+ private String constructorParam;
+
+ /**
+ * Resource constructor.
+ *
+ * @param aConstructorParam a simple <code>@MatrixParam</code> constructor parameter
+ */
+ public MatrixParamResource(@MatrixParam("cstrparam") String aConstructorParam) {
+ this.constructorParam = aConstructorParam;
+ }
+
+ /**
+ * GET method for constructor matrix parameter.
+ *
+ * @return transformed string
+ */
+ @GET
+ public String getConstructorMatrixParam() {
+ return "getConstructorMatrixParam:" + constructorParam;
+ }
+
+ /**
+ * POST method for constructor matrix parameter.
+ *
+ * @return transformed string
+ */
+ @POST
+ public String postConstructorMatrixParam() {
+ return "postConstructorMatrixParam:" + constructorParam;
+ }
+
+ /**
+ * PUT method for constructor matrix parameter.
+ *
+ * @return transformed string
+ */
+ @PUT
+ public String putConstructorMatrixParam() {
+ return "putConstructorMatrixParam:" + constructorParam;
+ }
+
+ /**
+ * DELETE method for constructor matrix parameter.
+ *
+ * @return transformed string
+ */
+ @DELETE
+ public String deleteConstructorMatrixParam() {
+ return "deleteConstructorMatrixParam:" + constructorParam;
+ }
+
+ /**
+ * GET method for simple matrix parameter.
+ *
+ * @param life simple parameter
+ * @return transformed string
+ */
+ @GET
+ @Path("simple")
+ public String getSimpleMatrixParam(@MatrixParam("life") String life) {
+ return "getSimpleMatrixParam:" + constructorParam + ";" + life;
+ }
+
+ /**
+ * POST method for simple matrix parameter.
+ *
+ * @param life simple parameter
+ * @return transformed string
+ */
+ @POST
+ @Path("simple")
+ public String postSimpleMatrixParam(@MatrixParam("life") String life) {
+ return "postSimpleMatrixParam:" + constructorParam + ";" + life;
+ }
+
+ /**
+ * PUT method for simple matrix parameter.
+ *
+ * @param life simple parameter
+ * @return transformed string
+ */
+ @PUT
+ @Path("simple")
+ public String putSimpleMatrixParam(@MatrixParam("life") String life) {
+ return "putSimpleMatrixParam:" + constructorParam + ";" + life;
+ }
+
+ /**
+ * DELETE method for simple matrix parameter.
+ *
+ * @param life simple parameter
+ * @return transformed string
+ */
+ @DELETE
+ @Path("simple")
+ public String deleteSimpleMatrixParam(@MatrixParam("life") String life) {
+ return "deleteSimpleMatrixParam:" + constructorParam + ";" + life;
+ }
+
+ /**
+ * GET method for multiple matrix parameters.
+ *
+ * @param first
+ * @param uppercaseOneMoreParam
+ * @param lowercaseOneMoreParam
+ * @return transformed string
+ */
+ @GET
+ @Path("multiple")
+ public String getMultipleMatrixParam(@MatrixParam("1st") String first,
+ @MatrixParam("ONEMOREPARAM") String uppercaseOneMoreParam,
+ @MatrixParam("onemoreparam") String lowercaseOneMoreParam) {
+ return "getMultipleMatrixParam:" + first
+ + ";"
+ + uppercaseOneMoreParam
+ + ";"
+ + lowercaseOneMoreParam;
+ }
+
+ /**
+ * POST method for multiple matrix parameters.
+ *
+ * @param first
+ * @param uppercaseOneMoreParam
+ * @param lowercaseOneMoreParam
+ * @return transformed string
+ */
+ @POST
+ @Path("multiple")
+ public String postMultipleMatrixParam(@MatrixParam("1st") String first,
+ @MatrixParam("ONEMOREPARAM") String uppercaseOneMoreParam,
+ @MatrixParam("onemoreparam") String lowercaseOneMoreParam) {
+ return "postMultipleMatrixParam:" + first
+ + ";"
+ + uppercaseOneMoreParam
+ + ";"
+ + lowercaseOneMoreParam;
+ }
+
+ /**
+ * PUT method for multiple matrix parameters.
+ *
+ * @param first
+ * @param uppercaseOneMoreParam
+ * @param lowercaseOneMoreParam
+ * @return transformed string
+ */
+ @PUT
+ @Path("multiple")
+ public String putMultipleMatrixParam(@MatrixParam("1st") String first,
+ @MatrixParam("ONEMOREPARAM") String uppercaseOneMoreParam,
+ @MatrixParam("onemoreparam") String lowercaseOneMoreParam) {
+ return "putMultipleMatrixParam:" + first
+ + ";"
+ + uppercaseOneMoreParam
+ + ";"
+ + lowercaseOneMoreParam;
+ }
+
+ /**
+ * DELETE method for multiple matrix parameters.
+ *
+ * @param first
+ * @param uppercaseOneMoreParam
+ * @param lowercaseOneMoreParam
+ * @return transformed string
+ */
+ @DELETE
+ @Path("multiple")
+ public String deleteMultipleMatrixParam(@MatrixParam("1st") String first,
+ @MatrixParam("ONEMOREPARAM") String uppercaseOneMoreParam,
+ @MatrixParam("onemoreparam") String lowercaseOneMoreParam) {
+ return "deleteMultipleMatrixParam:" + first
+ + ";"
+ + uppercaseOneMoreParam
+ + ";"
+ + lowercaseOneMoreParam;
+ }
+
+ /**
+ * GET method to test primitive matrix typed parameters
+ *
+ * @param aBoolean
+ * @param anInteger
+ * @param aDouble
+ * @param aByte
+ * @param ch
+ * @param aLong
+ * @param aShort
+ * @param aFloat
+ * @return a transformed string
+ */
+ @GET
+ @Path("types/primitive")
+ public String getMatrixPrimitiveTypes(@MatrixParam("bool") Boolean aBoolean,
+ @MatrixParam("intNumber") int anInteger,
+ @MatrixParam("dbl") double aDouble,
+ @MatrixParam("bite") byte aByte,
+ @MatrixParam("ch") char ch,
+ @MatrixParam("lng") long aLong,
+ @MatrixParam("float") short aShort,
+ @MatrixParam("short") float aFloat) {
+ return "getMatrixParameterPrimitiveTypes:" + aBoolean
+ + ";"
+ + anInteger
+ + ";"
+ + aDouble
+ + ";"
+ + aByte
+ + ";"
+ + ch
+ + ";"
+ + aLong
+ + ";"
+ + aShort
+ + ";"
+ + aFloat;
+ }
+
+ /**
+ * A type with a public string constructor.
+ */
+ public static class ParamWithStringConstructor {
+ private String value = null;
+
+ /**
+ * Should not be called.
+ */
+ public ParamWithStringConstructor() {
+ value = "noconstructor";
+ }
+
+ /**
+ * Should not be called.
+ *
+ * @param anInt
+ */
+ public ParamWithStringConstructor(Integer anInt) {
+ value = "intconstructor";
+ }
+
+ /**
+ * String constructor
+ *
+ * @param aValue
+ */
+ public ParamWithStringConstructor(String aValue) {
+ this.value = aValue;
+ }
+
+ /**
+ * Transform the value to something else.
+ *
+ * @return a transformed value
+ */
+ public Integer transformedValue() {
+ return Integer.valueOf(value);
+ }
+ }
+
+ /**
+ * GET method to test matrix parameter types with a public string constructor.
+ *
+ * @param param parameter which has a string constructor
+ * @return a transformed value
+ */
+ @GET
+ @Path("types/stringcstr")
+ public String getQueryParameterStringConstructor(@MatrixParam("paramStringConstructor") ParamWithStringConstructor param) {
+ return "getMatrixParameterStringConstructor:" + param.transformedValue();
+ }
+
+ /**
+ * Type with a public static valueOf method to test query parameters.
+ */
+ public static class ParamWithValueOf {
+ private String value = null;
+
+ protected ParamWithValueOf(String aValue, int aNum) {
+ value = aValue + aNum;
+ }
+
+ /**
+ * The transformed type value
+ *
+ * @return the transformed type value
+ */
+ public String transformedValue() {
+ return value;
+ }
+
+ /**
+ * Public static valueOf method.
+ *
+ * @param aValue string value to transform into type
+ * @return an instance of the type
+ */
+ public static ParamWithValueOf valueOf(String aValue) {
+ return new ParamWithValueOf(aValue, 789);
+ }
+ }
+
+ /**
+ * GET method to test matrix parameter with a static valueOf(String) method.
+ *
+ * @param param the parameter type has a static valueOf(String) method
+ * @return a transformed value
+ */
+ @GET
+ @Path("types/valueof")
+ public String getQueryParameterValueOf(@MatrixParam("staticValueOf") ParamWithValueOf param) {
+ return "getMatrixParameterValueOf:" + param.transformedValue();
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/PathSegmentResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/PathSegmentResource.java?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/PathSegmentResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/PathSegmentResource.java Tue Jul 14 19:47:00 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.params;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.MatrixParam;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.PathSegment;
+
+@Path("/params/pathsegment")
+public class PathSegmentResource {
+
+ @Path("{loc}")
+ @GET
+ public String helloPath(@PathParam("loc") PathSegment pathSegment) {
+ return pathSegment.getPath();
+ }
+
+ @Path("matrix/{loc}")
+ @GET
+ public String helloPath(@PathParam("loc") String path, @PathParam("loc") PathSegment pathSegment,
+ @MatrixParam("mp") String matrix
+ ) {
+ return path + "-"
+ + pathSegment.getPath()
+ + "-"
+ + pathSegment.getMatrixParameters().get(matrix)
+ + "-"
+ + matrix;
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/QueryParamNotSetResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/QueryParamNotSetResource.java?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/QueryParamNotSetResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/QueryParamNotSetResource.java Tue Jul 14 19:47:00 2009
@@ -0,0 +1,92 @@
+/*
+ * 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.params;
+
+import java.util.List;
+import java.util.Set;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Path("/queryparamnotset")
+public class QueryParamNotSetResource {
+
+ @Path("int")
+ @GET
+ public String getDefault(@QueryParam("count") int count) {
+ return Integer.valueOf(count).toString();
+ }
+
+ @Path("short")
+ @GET
+ public String getDefault(@QueryParam("smallCount") short smallCount) {
+ return ""+smallCount;
+ }
+
+ @Path("long")
+ @GET
+ public String getDefault(@QueryParam("longCount") long longCount) {
+ return ""+longCount;
+ }
+
+ @Path("float")
+ @GET
+ public String getDefault(@QueryParam("floatCount") float floatCount) {
+ return ""+floatCount;
+ }
+
+ @Path("double")
+ @GET
+ public String getDefault(@QueryParam("d") double count) {
+ return ""+count;
+ }
+
+ @Path("byte")
+ @GET
+ @Produces("text/plain")
+ public String getDefault(@QueryParam("b") byte count) {
+ Logger logger = LoggerFactory.getLogger(QueryParamNotSetResource.class);
+ logger.error(count+"");
+ return ""+count;
+ }
+
+ @Path("char")
+ @GET
+ public String getDefault(@QueryParam("letter") char count) {
+ return count + "";
+ }
+
+ @Path("set")
+ @GET
+ public String getDefault(@QueryParam("bag") Set<Integer> stuff) {
+ return ""+stuff.size();
+ }
+
+ @Path("list")
+ @GET
+ public String getDefault(@QueryParam("letter") List<String> stuff) {
+ return ""+stuff.size();
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/QueryParamResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/QueryParamResource.java?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/QueryParamResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/QueryParamResource.java Tue Jul 14 19:47:00 2009
@@ -0,0 +1,364 @@
+/*
+ * 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.params;
+
+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.QueryParam;
+
+/**
+ * A simple resource to test <code>@QueryParam</code>.
+ */
+@Path("query")
+public class QueryParamResource {
+
+ private String aQueryID = "notset";
+
+ /**
+ * Constructor that will not be called.
+ */
+ public QueryParamResource() {
+ /* this code should not be called ever */
+ aQueryID = "notvalid";
+ }
+
+ /**
+ * Constructor with simple query parameter.
+ *
+ * @param aQueryID a query parameter
+ */
+ public QueryParamResource(@QueryParam("queryid") String aQueryID) {
+ this.aQueryID = aQueryID;
+ }
+
+ /**
+ * GET method on root resource.
+ *
+ * @return modified string with constructor query parameter
+ */
+ @GET
+ public String getConstructorQueryID() {
+ return "getConstructorQueryID:" + aQueryID;
+ }
+
+ /**
+ * PUT method on root resource.
+ *
+ * @return modified string with constructor query parameter
+ */
+ @PUT
+ public String putConstructorQueryID() {
+ return "putConstructorQueryID:" + aQueryID;
+ }
+
+ /**
+ * POST method on root resource.
+ *
+ * @return modified string with constructor query parameter
+ */
+ @POST
+ public String postConstructorQueryID() {
+ return "postConstructorQueryID:" + aQueryID;
+ }
+
+ /**
+ * DELETE method on root resource.
+ *
+ * @return modified string with constructor query parameter
+ */
+ @DELETE
+ public String deleteConstructorQueryID() {
+ return "deleteConstructorQueryID:" + aQueryID;
+ }
+
+ /**
+ * GET method with different path and additional query parameter.
+ *
+ * @param aSimpleParameter an additional simple parameter
+ * @return modified string with constructor and path query parameters
+ */
+ @GET
+ @Path("simple")
+ public String getSimpleQueryParameter(@QueryParam("simpleParam") String aSimpleParameter) {
+ return "getSimpleQueryParameter:" + aQueryID + ";" + aSimpleParameter;
+ }
+
+ /**
+ * PUT method with different path and additional query parameter.
+ *
+ * @param aSimpleParameter an additional simple parameter
+ * @return modified string with constructor and path query parameters
+ */
+ @DELETE
+ @Path("simple")
+ public String deleteSimpleQueryParameter(@QueryParam("simpleParam") String aSimpleParameter) {
+ return "deleteSimpleQueryParameter:" + aQueryID + ";" + aSimpleParameter;
+ }
+
+ /**
+ * POST method with different path and additional query parameter.
+ *
+ * @param aSimpleParameter an additional simple parameter
+ * @return modified string with constructor and path query parameters
+ */
+ @PUT
+ @Path("simple")
+ public String putSimpleQueryParameter(@QueryParam("simpleParam") String aSimpleParameter) {
+ return "putSimpleQueryParameter:" + aQueryID + ";" + aSimpleParameter;
+ }
+
+ /**
+ * GET method with different path and additional query parameter.
+ *
+ * @param aSimpleParameter an additional simple parameter
+ * @return modified string with constructor and path query parameters
+ */
+ @POST
+ @Path("simple")
+ public String postSimpleQueryParameter(@QueryParam("simpleParam") String aSimpleParameter) {
+ return "postSimpleQueryParameter:" + aQueryID + ";" + aSimpleParameter;
+ }
+
+ /**
+ * GET method with multiple query parameters.
+ *
+ * @param multiparam1
+ * @param param123
+ * @param oneMoreParam
+ * @return modified string with constructor and all path query parameters
+ */
+ @GET
+ @Path("multiple")
+ public String getMultiQueryParameter(@QueryParam("multiParam1") String multiparam1,
+ @QueryParam("123Param") String param123,
+ @QueryParam("1MOREParam") String oneMoreParam) {
+ return "getMultiQueryParameter:" + aQueryID
+ + ";"
+ + multiparam1
+ + ";"
+ + param123
+ + ";"
+ + oneMoreParam;
+ }
+
+ /**
+ * DELETE method with multiple query parameters.
+ *
+ * @param multiparam1
+ * @param param123
+ * @param oneMoreParam
+ * @return modified string with constructor and all path query parameters
+ */
+ @DELETE
+ @Path("multiple")
+ public String deleteMultiQueryParameter(@QueryParam("multiParam1") String multiparam1,
+ @QueryParam("123Param") String param123,
+ @QueryParam("1MOREParam") String oneMoreParam) {
+ return "deleteMultiQueryParameter:" + aQueryID
+ + ";"
+ + multiparam1
+ + ";"
+ + param123
+ + ";"
+ + oneMoreParam;
+ }
+
+ /**
+ * POST method with multiple query parameters.
+ *
+ * @param multiparam1
+ * @param param123
+ * @param oneMoreParam
+ * @return modified string with constructor and all path query parameters
+ */
+ @POST
+ @Path("multiple")
+ public String postMultiQueryParameter(@QueryParam("multiParam1") String multiparam1,
+ @QueryParam("123Param") String param123,
+ @QueryParam("1MOREParam") String oneMoreParam) {
+ return "postMultiQueryParameter:" + aQueryID
+ + ";"
+ + multiparam1
+ + ";"
+ + param123
+ + ";"
+ + oneMoreParam;
+ }
+
+ /**
+ * PUT method with multiple query parameters.
+ *
+ * @param multiparam1
+ * @param param123
+ * @param oneMoreParam
+ * @return modified string with constructor and all path query parameters
+ */
+ @PUT
+ @Path("multiple")
+ public String putMultiQueryParameter(@QueryParam("multiParam1") String multiparam1,
+ @QueryParam("123Param") String param123,
+ @QueryParam("1MOREParam") String oneMoreParam) {
+ return "putMultiQueryParameter:" + aQueryID
+ + ";"
+ + multiparam1
+ + ";"
+ + param123
+ + ";"
+ + oneMoreParam;
+ }
+
+ /**
+ * GET method with multiple primitive typed query parameters.
+ *
+ * @param aBoolean
+ * @param anInteger
+ * @param aDouble
+ * @param aByte
+ * @param ch
+ * @param aLong
+ * @param aShort
+ * @param aFloat
+ * @return a concatenated string in method parameter order
+ */
+ @GET
+ @Path("types/primitive")
+ public String getQueryParameterPrimitiveTypes(@QueryParam("bool") Boolean aBoolean,
+ @QueryParam("intNumber") int anInteger,
+ @QueryParam("dbl") double aDouble,
+ @QueryParam("bite") byte aByte,
+ @QueryParam("ch") char ch,
+ @QueryParam("lng") long aLong,
+ @QueryParam("float") short aShort,
+ @QueryParam("short") float aFloat) {
+ return "getQueryParameterPrimitiveTypes:" + aBoolean
+ + ";"
+ + anInteger
+ + ";"
+ + aDouble
+ + ";"
+ + aByte
+ + ";"
+ + ch
+ + ";"
+ + aLong
+ + ";"
+ + aShort
+ + ";"
+ + aFloat;
+ }
+
+ /**
+ * A type with a public string constructor.
+ */
+ public static class ParamWithStringConstructor {
+ private String value = null;
+
+ /**
+ * Should not be called.
+ */
+ public ParamWithStringConstructor() {
+ value = "noconstructor";
+ }
+
+ /**
+ * Should not be called.
+ *
+ * @param anInt
+ */
+ public ParamWithStringConstructor(Integer anInt) {
+ value = "intconstructor";
+ }
+
+ /**
+ * String constructor
+ *
+ * @param aValue
+ */
+ public ParamWithStringConstructor(String aValue) {
+ this.value = aValue;
+ }
+
+ /**
+ * Transform the value to something else.
+ *
+ * @return a transformed value
+ */
+ public Integer transformedValue() {
+ return Integer.valueOf(value);
+ }
+ }
+
+ /**
+ * GET method to test parameter types with a public string constructor.
+ *
+ * @param param parameter which has a string constructor
+ * @return a transformed value
+ */
+ @GET
+ @Path("types/stringcstr")
+ public String getQueryParameterStringConstructor(@QueryParam("paramStringConstructor") ParamWithStringConstructor param) {
+ return "getQueryParameterStringConstructor:" + param.transformedValue();
+ }
+
+ /**
+ * Type with a public static valueOf method to test query parameters.
+ */
+ public static class ParamWithValueOf {
+ private String value = null;
+
+ protected ParamWithValueOf(String aValue, int aNum) {
+ value = aValue + aNum;
+ }
+
+ /**
+ * The transformed type value
+ *
+ * @return the transformed type value
+ */
+ public String transformedValue() {
+ return value;
+ }
+
+ /**
+ * Public static valueOf method.
+ *
+ * @param aValue string value to transform into type
+ * @return an instance of the type
+ */
+ public static ParamWithValueOf valueOf(String aValue) {
+ return new ParamWithValueOf(aValue, 789);
+ }
+ }
+
+ /**
+ * GET method to test parameter with a static valueOf(String) method.
+ *
+ * @param param the parameter type has a static valueOf(String) method
+ * @return a transformed value
+ */
+ @GET
+ @Path("types/valueof")
+ public String getQueryParameterValueOf(@QueryParam("staticValueOf") ParamWithValueOf param) {
+ return "getQueryParameterValueOf:" + param.transformedValue();
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/form/FormParamResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/form/FormParamResource.java?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/form/FormParamResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/form/FormParamResource.java Tue Jul 14 19:47:00 2009
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.params.form;
+
+import javax.ws.rs.FormParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.MultivaluedMap;
+
+@Path("params/form")
+public class FormParamResource {
+
+ public FormParamResource() {
+
+ }
+
+ @POST
+ @Path("withOnlyEntity")
+ public String getRes(MultivaluedMap<String, String> entity) {
+ return entity.toString();
+ }
+
+ @POST
+ @Path("withOneKeyAndEntity")
+ public String getRes(@FormParam("firstkey") String firstKey,
+ MultivaluedMap<String, String> entity) {
+ return "firstkey=" + firstKey + "&entity=" + entity.toString();
+ }
+
+ @POST
+ @Path("withStringEntity")
+ public String getStrEntity(String entity) {
+ return "str:" + entity;
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/header/HeaderParamDefaultResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/header/HeaderParamDefaultResource.java?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/header/HeaderParamDefaultResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/header/HeaderParamDefaultResource.java Tue Jul 14 19:47:00 2009
@@ -0,0 +1,101 @@
+/*
+ * 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.params.header;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
+@Path("/params/headerparam/default")
+public class HeaderParamDefaultResource {
+
+ private String customConstructorHeaderParam;
+
+ private String customPropertyHeaderParam;
+
+ private String agent;
+
+ @DefaultValue("english")
+ @HeaderParam("Accept-Language")
+ private String acceptLanguageHeaderParam;
+
+ public HeaderParamDefaultResource(@DefaultValue("MyCustomConstructorHeader") @HeaderParam("CustomConstructorHeader") String cstrHeaderParam) {
+ this.customConstructorHeaderParam = cstrHeaderParam;
+ }
+
+ public Response info(String customMethodHeader) {
+ Response r =
+ Response.status(Status.OK).header("RespCustomConstructorHeader",
+ customConstructorHeaderParam)
+ .header("RespAccept-Language", acceptLanguageHeaderParam)
+ .header("RespCustomMethodHeader", customMethodHeader)
+ .header("RespUserAgent", agent).header("RespCustomPropertyHeader",
+ customPropertyHeaderParam).build();
+ return r;
+ }
+
+ @DefaultValue("MyAgent")
+ @HeaderParam("User-Agent")
+ public void setUserAgent(String aUserAgent) {
+ agent = aUserAgent;
+ }
+
+ public String getUserAgent() {
+ return agent;
+ }
+
+ @DefaultValue("MyCustomPropertyHeader")
+ @HeaderParam("CustomPropertyHeader")
+ public void setCustomPropertyHeader(String customProperty) {
+ customPropertyHeaderParam = customProperty;
+ }
+
+ public String getCustomPropertyHeader() {
+ return customPropertyHeaderParam;
+ }
+
+ @GET
+ public Response getHeaderParam(@DefaultValue("MyCustomMethodHeader") @HeaderParam("CustomMethodHeader") String c) {
+ return info(c);
+ }
+
+ @POST
+ public Response postHeaderParam(@DefaultValue("MyCustomMethodHeader") @HeaderParam("CustomMethodHeader") String c) {
+ return info(c);
+ }
+
+ @PUT
+ public Response putHeaderParam(@DefaultValue("MyCustomMethodHeader") @HeaderParam("CustomMethodHeader") String c) {
+ return info(c);
+ }
+
+ @DELETE
+ public Response deleteHeaderParam(@DefaultValue("MyCustomMethodHeader") @HeaderParam("CustomMethodHeader") String c) {
+ return info(c);
+ }
+
+ /* FIXME: Check if ResponseBuilder header values can be null */
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/header/HeaderParamExceptionResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/header/HeaderParamExceptionResource.java?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/header/HeaderParamExceptionResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/header/HeaderParamExceptionResource.java Tue Jul 14 19:47:00 2009
@@ -0,0 +1,166 @@
+/*
+ * 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.params.header;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.SortedSet;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.Path;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Path("/params/headerparam/exception")
+public class HeaderParamExceptionResource {
+
+ public HeaderParamExceptionResource() {
+ /* do nothing */
+ }
+
+ @HeaderParam("CustomStringConstructorFieldHeader")
+ private HeaderStringConstructor customStringConstructorFieldHeader;
+
+ @HeaderParam("CustomValueOfFieldHeader")
+ private HeaderValueOf customValueOfFieldHeader;
+
+ private HeaderValueOf customPropertyValueOfHeader;
+
+ private HeaderStringConstructor customPropertyStringConstructorHeader;
+
+ @HeaderParam("CustomValueOfPropertyHeader")
+ public void setCustomValueOfPropertyHeader(HeaderValueOf param) {
+ customPropertyValueOfHeader = param;
+ }
+
+ @HeaderParam("CustomStringConstructorPropertyHeader")
+ public void setCustomConstructorPropertyHeader(HeaderStringConstructor param) {
+ customPropertyStringConstructorHeader = param;
+ }
+
+ @GET
+ @Path("primitive")
+ public Response getHeaderParam(@HeaderParam("CustomNumHeader") int customNumHeader) {
+ return Response.ok().header("RespCustomNumHeader", customNumHeader).build();
+ }
+
+ @GET
+ @Path("constructor")
+ public Response getStringConstructorHeaderParam(@HeaderParam("CustomStringHeader") HeaderStringConstructor customStringHeader) {
+ return Response.ok().header("RespCustomStringHeader", customStringHeader.getHeader())
+ .build();
+ }
+
+ public static class HeaderValueOf {
+ String header;
+
+ private HeaderValueOf(String aHeader, int num) {
+ header = aHeader;
+ }
+
+ public String getHeader() {
+ return header;
+ }
+
+ public static HeaderValueOf valueOf(String v) throws Exception {
+ if ("throwWeb".equals(v)) {
+ throw new WebApplicationException(Response.status(498)
+ .entity("HeaderValueOfWebAppEx").build());
+ } else if ("throwNull".equals(v)) {
+ throw new NullPointerException("HeaderValueOf NPE");
+ } else if ("throwEx".equals(v)) {
+ throw new Exception("HeaderValueOf Exception");
+ }
+ return new HeaderValueOf(v, 100);
+ }
+ }
+
+ @GET
+ @Path("valueof")
+ public Response getValueOfHeaderParam(@HeaderParam("CustomValueOfHeader") HeaderValueOf customValueOfHeader) {
+ return Response.ok().header("RespCustomValueOfHeader", customValueOfHeader.getHeader())
+ .build();
+ }
+
+ @GET
+ @Path("listvalueof")
+ public Response getValueOfHeaderParam(@HeaderParam("CustomListValueOfHeader") List<HeaderValueOf> customValueOfHeader) {
+ if (customValueOfHeader.size() != 1) {
+ throw new IllegalArgumentException();
+ }
+ return Response.ok().header("RespCustomListValueOfHeader",
+ customValueOfHeader.get(0).getHeader()).build();
+ }
+
+ @GET
+ @Path("setvalueof")
+ public Response getValueOfHeaderParam(@HeaderParam("CustomSetValueOfHeader") Set<HeaderValueOf> customValueOfHeader) {
+ if (customValueOfHeader.size() != 1) {
+ throw new IllegalArgumentException();
+ }
+ return Response.ok().header("RespCustomSetValueOfHeader",
+ new ArrayList<HeaderValueOf>(customValueOfHeader).get(0)
+ .getHeader()).build();
+ }
+
+ @GET
+ @Path("sortedsetvalueof")
+ public Response getValueOfHeaderParam(@HeaderParam("CustomSortedSetValueOfHeader") SortedSet<HeaderValueOf> customValueOfHeader) {
+ if (customValueOfHeader.size() != 1) {
+ throw new IllegalArgumentException();
+ }
+ return Response.ok().header("RespCustomSortedSetValueOfHeader",
+ customValueOfHeader.first().getHeader()).build();
+ }
+
+ @GET
+ @Path("fieldstrcstr")
+ public Response getFieldStringConstructorHeaderParam() {
+ return Response.ok().header("RespCustomStringConstructorFieldHeader",
+ customStringConstructorFieldHeader.getHeader()).build();
+ }
+
+ @GET
+ @Path("fieldvalueof")
+ public Response getFieldValueOfHeaderParam() {
+ return Response.ok().header("RespCustomValueOfFieldHeader",
+ customValueOfFieldHeader.getHeader()).build();
+ }
+
+ @GET
+ @Path("propertystrcstr")
+ public Response getPropertyStringConstructorHeaderParam() {
+ return Response.ok().header("RespCustomStringConstructorPropertyHeader",
+ customPropertyStringConstructorHeader.getHeader()).build();
+ }
+
+ @GET
+ @Path("propertyvalueof")
+ public Response getPropertyValueOfHeaderParam() {
+ return Response.ok().header("RespCustomValueOfPropertyHeader",
+ customPropertyValueOfHeader.getHeader()).build();
+ }
+
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/header/HeaderStringConstructor.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/header/HeaderStringConstructor.java?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/header/HeaderStringConstructor.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/header/HeaderStringConstructor.java Tue Jul 14 19:47:00 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.params.header;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+
+public class HeaderStringConstructor {
+ String header;
+
+ public HeaderStringConstructor(String aHeader) throws Exception {
+ if ("throwWeb".equals(aHeader)) {
+ throw new WebApplicationException(Response.status(499)
+ .entity("HeaderStringConstructorWebAppEx").build());
+ } else if ("throwNull".equals(aHeader)) {
+ throw new NullPointerException("HeaderStringConstructor NPE");
+ } else if ("throwEx".equals(aHeader)) {
+ throw new Exception("HeaderStringConstructor Exception");
+ }
+ header = aHeader;
+ }
+
+ public String getHeader() {
+ return header;
+ }
+}
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/query/ParamStringConstructor.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/query/ParamStringConstructor.java?rev=794036&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/query/ParamStringConstructor.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/java/org/apache/wink/jaxrs/test/params/query/ParamStringConstructor.java Tue Jul 14 19:47:00 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.params.query;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+
+public class ParamStringConstructor {
+
+ String value;
+
+ public ParamStringConstructor(String aValue) throws Exception {
+ if ("throwWeb".equals(aValue)) {
+ throw new WebApplicationException(Response.status(499).entity("ParamStringConstructor")
+ .build());
+ } else if ("throwNull".equals(aValue)) {
+ throw new NullPointerException("ParamStringConstructor NPE");
+ } else if ("throwEx".equals(aValue)) {
+ throw new Exception("ParamStringConstructor Exception");
+ }
+ value = aValue;
+ }
+
+ public String getParamValue() {
+ return value;
+ }
+}