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 [8/21] - in /incubator/wink/trunk: wink-integration-test/ wink-integration-test/wink-server-integration-test-support/ wink-integration-test/wink-server-integration-test-support/src/main/java/org/apache/wink/test/integration/ wink-in...

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/header/HeaderParamExceptionResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/header/HeaderParamExceptionResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/header/HeaderParamExceptionResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/header/HeaderParamExceptionResource.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,163 @@
+/*
+ * 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.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;
+
+@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-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/header/HeaderStringConstructor.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/header/HeaderStringConstructor.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/header/HeaderStringConstructor.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/header/HeaderStringConstructor.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.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-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/newcookie/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/newcookie/Application.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/newcookie/Application.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/newcookie/Application.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.newcookie;
+
+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(CookieResource.class);
+        return clazzes;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/newcookie/CookieResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/newcookie/CookieResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/newcookie/CookieResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/newcookie/CookieResource.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,117 @@
+/*
+ * 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.newcookie;
+
+import java.util.Map;
+
+import javax.ws.rs.CookieParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Cookie;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.NewCookie;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.core.Response.ResponseBuilder;
+import javax.ws.rs.core.Response.Status;
+
+@Path("cookiestests")
+public class CookieResource {
+
+    @Context
+    private UriInfo uri;
+
+    private String  value3;
+
+    // @CookieParam("name2")
+    // private String value2;
+    //
+    // @CookieParam("name")
+    // public static String value = null;
+
+    @GET
+    @Produces("text/plain")
+    @Path("getAll")
+    public Response getCookie(@Context HttpHeaders headers) {
+        Map<String, Cookie> cookies = headers.getCookies();
+        String ret = "";
+        if (cookies != null) {
+            for (String s : cookies.keySet()) {
+                Cookie c = cookies.get(s);
+                ret +=
+                    c.getName() + ","
+                        + c.getValue()
+                        + ","
+                        + c.getPath()
+                        + ","
+                        + c.getDomain()
+                        + "\r";
+            }
+        }
+        return Response.ok(ret).build();
+    }
+
+    @GET
+    @Produces("text/plain")
+    @Path("getValue2")
+    public Response getValue2() {
+        return Response.status(Status.BAD_REQUEST).entity("value2").build();
+        // return
+        // Response.status(Status.BAD_REQUEST).entity(this.value2).build();
+        // return Response.ok(this.value2).build();
+    }
+
+    @GET
+    @Produces("text/plain")
+    @Path("getStaticValue")
+    public Response getStaticValue() {
+        return null;
+        // return Response.ok(value).build();
+    }
+
+    @GET
+    @Produces("text/plain")
+    @Path("getValue3")
+    public Response getValue3() {
+        return Response.status(Status.BAD_REQUEST).entity(this.value3).build();
+        // return Response.ok(this.value3).build();
+    }
+
+    @PUT
+    @Produces("text/plain")
+    public Response setCookies() {
+        ResponseBuilder rb = Response.ok();
+        rb.cookie(new NewCookie("name", "value", uri.getBaseUri().getPath() + uri.getPath(), uri
+            .getBaseUri().getHost(), "comment", 10, false));
+        rb.cookie(new NewCookie("name2", "value2", uri.getBaseUri().getPath() + uri.getPath(), uri
+            .getBaseUri().getHost(), "comment2", 10, false));
+        rb.cookie(new NewCookie("name3", "value3", uri.getBaseUri().getPath() + uri.getPath(), uri
+            .getBaseUri().getHost(), "comment2", 10, false));
+        return rb.build();
+    }
+
+    @CookieParam("name3")
+    public void setValue3(String value3) {
+        this.value3 = value3;
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/query/ParamStringConstructor.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/query/ParamStringConstructor.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/query/ParamStringConstructor.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/query/ParamStringConstructor.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.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;
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/query/QueryParamsExceptionResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/query/QueryParamsExceptionResource.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/query/QueryParamsExceptionResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/java/org/apache/wink/itest/query/QueryParamsExceptionResource.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,168 @@
+/*
+ * 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.query;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+
+@Path("/params/queryparam/exception")
+public class QueryParamsExceptionResource {
+
+    public QueryParamsExceptionResource() {
+        /* do nothing */
+    }
+
+    @QueryParam("CustomStringConstructorFieldQuery")
+    private ParamStringConstructor customStringConstructorFieldQuery;
+
+    @QueryParam("CustomValueOfFieldQuery")
+    private QueryValueOf           customValueOfFieldQuery;
+
+    private ParamStringConstructor customPropertyStringConstructorQuery;
+
+    private QueryValueOf           customPropertyValueOfQuery;
+
+    @QueryParam("CustomStringConstructorPropertyHeader")
+    public void setCustomPropertyStringConstructorQuery(ParamStringConstructor param) {
+        customPropertyStringConstructorQuery = param;
+    }
+
+    @QueryParam("CustomValueOfPropertyHeader")
+    public void setCustomValueOfPropertyHeader(QueryValueOf param) {
+        customPropertyValueOfQuery = param;
+    }
+
+    @GET
+    @Path("primitive")
+    public Response getHeaderParam(@QueryParam("CustomNumQuery") int customNumHeader) {
+        return Response.ok().header("RespCustomNumQuery", customNumHeader).build();
+    }
+
+    // @GET
+    // @Path("constructor")
+    // public Response getStringConstructorHeaderParam(
+    // @HeaderParam("CustomStringHeader") HeaderStringConstructor
+    // customStringHeader) {
+    // return Response.ok().header("RespCustomStringHeader",
+    // customStringHeader.getHeader())
+    // .build();
+    // }
+
+    public static class QueryValueOf {
+        String header;
+
+        private QueryValueOf(String aHeader, int num) {
+            header = aHeader;
+        }
+
+        public String getParamValue() {
+            return header;
+        }
+
+        public static QueryValueOf valueOf(String v) throws Exception {
+            if ("throwWeb".equals(v)) {
+                throw new WebApplicationException(Response.status(498)
+                    .entity("ParamValueOfWebAppEx").build());
+            } else if ("throwNull".equals(v)) {
+                throw new NullPointerException("ParamValueOf NPE");
+            } else if ("throwEx".equals(v)) {
+                throw new Exception("ParamValueOf Exception");
+            }
+            return new QueryValueOf(v, 100);
+        }
+    }
+
+    // @GET
+    // @Path("valueof")
+    // public Response getValueOfHeaderParam(
+    // @QueryParam("CustomValueOfQuery") QueryValueOf customValueOfQuery) {
+    // return Response.ok().header("RespCustomValueOfQuery",
+    // customValueOfQuery.getParamValue())
+    // .build();
+    // }
+    //
+    // @GET
+    // @Path("listvalueof")
+    // public Response getValueOfHeaderParam(
+    // @HeaderParam("CustomListValueOfHeader") List<QueryValueOf>
+    // 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<QueryValueOf>
+    // customValueOfHeader) {
+    // if (customValueOfHeader.size() != 1) {
+    // throw new IllegalArgumentException();
+    // }
+    // return Response.ok().header("RespCustomSetValueOfHeader",
+    // new
+    // ArrayList<QueryValueOf>(customValueOfHeader).get(0).getHeader()).build();
+    // }
+    //
+    // @GET
+    // @Path("sortedsetvalueof")
+    // public Response getValueOfHeaderParam(
+    // @HeaderParam("CustomSortedSetValueOfHeader") SortedSet<QueryValueOf>
+    // 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().entity(customStringConstructorFieldQuery.getParamValue()).build();
+    }
+
+    @GET
+    @Path("fieldvalueof")
+    public Response getFieldValueOfHeaderParam() {
+        return Response.ok().header("RespCustomValueOfFieldHeader",
+                                    customValueOfFieldQuery.getParamValue()).build();
+    }
+
+    @GET
+    @Path("propertystrcstr")
+    public Response getPropertyStringConstructorHeaderParam() {
+        return Response.ok().header("RespCustomStringConstructorPropertyQuery",
+                                    customPropertyStringConstructorQuery.getParamValue()).build();
+    }
+
+    @GET
+    @Path("propertyvalueof")
+    public Response getPropertyValueOfHeaderParam() {
+        return Response.ok().header("RespCustomValueOfPropertyQuery",
+                                    customPropertyValueOfQuery.getParamValue()).build();
+    }
+
+}

Copied: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/webapp/WEB-INF/geronimo-web.xml (from r801788, incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/webapp/WEB-INF/geronimo-web.xml)
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/webapp/WEB-INF/geronimo-web.xml?p2=incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/webapp/WEB-INF/geronimo-web.xml&p1=incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-params/src/main/webapp/WEB-INF/geronimo-web.xml&r1=801788&r2=801869&rev=801869&view=diff
==============================================================================
    (empty)

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/webapp/WEB-INF/web.xml?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/webapp/WEB-INF/web.xml (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/main/webapp/WEB-INF/web.xml Fri Aug  7 03:10:22 2009
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+     http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd" >
+
+<web-app>
+    <display-name>Archetype Created Web Application</display-name>
+    <servlet>
+        <servlet-name>Params</servlet-name>
+        <servlet-class>${wink.rest.servlet}</servlet-class>
+        <init-param>
+            <param-name>javax.ws.rs.Application</param-name>
+            <param-value>org.apache.wink.itest.Application</param-value>
+        </init-param>
+        <init-param>
+            <param-name>requestProcessorAttribute</param-name>
+            <param-value>requestProcessorAttribute_param</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet>
+        <servlet-name>NewCookies</servlet-name>
+        <servlet-class>${wink.rest.servlet}</servlet-class>
+        <init-param>
+            <param-name>javax.ws.rs.Application</param-name>
+            <param-value>org.apache.wink.itest.newcookie.Application</param-value>
+        </init-param>
+        <init-param>
+            <param-name>requestProcessorAttribute</param-name>
+            <param-value>requestProcessorAttribute_newcookie</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>Params</servlet-name>
+        <url-pattern>/params/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>NewCookies</servlet-name>
+        <url-pattern>/newcookies/*</url-pattern>
+    </servlet-mapping>
+</web-app>

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/CookieFieldsTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/CookieFieldsTest.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/CookieFieldsTest.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/CookieFieldsTest.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,217 @@
+/*
+ * 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;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.cookie.CookiePolicy;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.wink.test.integration.ServerEnvironmentInfo;
+
+/**
+ * Test that all the possible cookie fields can be sent by the runtime
+ */
+public class CookieFieldsTest extends TestCase {
+
+    protected HttpClient        httpclient = new HttpClient();
+
+    final private static String BASE_URI   =
+                                               ServerEnvironmentInfo.getBaseURI() + "/newcookies/cookiestests";
+
+    /**
+     * Test that the HttpHeaders.getCookies() method returns correct cookies and
+     * information
+     * 
+     * @throws Exception
+     */
+    public void testHttpHeadersGetCookie() throws Exception {
+        httpclient = new HttpClient();
+        setCookies();
+        // call get to exercise HttpHeaders.getCookies()
+        GetMethod getHttpMethod = new GetMethod();
+        getHttpMethod.getParams().setCookiePolicy(CookiePolicy.RFC_2965);
+        getHttpMethod.setURI(new URI(BASE_URI + "/getAll", false));
+        System.out.println("Request headers:");
+        System.out.println(Arrays.asList(getHttpMethod.getRequestHeaders()));
+        try {
+            int result = httpclient.executeMethod(getHttpMethod);
+            System.out.println("Response status code: " + result);
+            System.out.println("Response body: ");
+            String responseBody = getHttpMethod.getResponseBodyAsString();
+            System.out.println(responseBody);
+            System.out.println("Response headers:");
+            List<Header> headers = Arrays.asList(getHttpMethod.getResponseHeaders());
+            System.out.println(headers);
+            assertEquals(200, result);
+
+            StringTokenizer t = new StringTokenizer(responseBody, "\r\n\t\f");
+            String next = null;
+            boolean name3Found = false;
+            boolean name2Found = false;
+            boolean nameFound = false;
+            String contextRoot = ServerEnvironmentInfo.getContextRoot();
+            if (!"".equals(contextRoot)) {
+                contextRoot = "/" + contextRoot;
+            }
+            while (t.hasMoreTokens()) {
+                next = t.nextToken();
+                if (next.startsWith("name3")) {
+                    assertEquals("name3,value3," + contextRoot
+                        + "/newcookies/cookiestests,"
+                        + ServerEnvironmentInfo.getHostname(), next);
+                    name3Found = true;
+                } else if (next.startsWith("name2")) {
+                    assertEquals("name2,value2," + contextRoot
+                        + "/newcookies/cookiestests,"
+                        + ServerEnvironmentInfo.getHostname(), next);
+                    name2Found = true;
+                } else if (next.startsWith("name")) {
+                    assertEquals("name,value," + contextRoot
+                        + "/newcookies/cookiestests,"
+                        + ServerEnvironmentInfo.getHostname(), next);
+                    nameFound = true;
+                } else
+                    fail("Received an unexpected cookie: " + next);
+            }
+            if (!nameFound || !name2Found || !name3Found)
+                fail("Did not receive all the expected cookies." + nameFound
+                    + name2Found
+                    + name3Found);
+        } finally {
+            getHttpMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Test the @CookieParameter annotation on a private class field
+     * 
+     * @throws Exception
+     */
+    public void testCookieParamPrivateVar() throws Exception {
+        httpclient = new HttpClient();
+        setCookies();
+        GetMethod getHttpMethod = new GetMethod();
+        getHttpMethod.getParams().setCookiePolicy(CookiePolicy.RFC_2965);
+        getHttpMethod.setURI(new URI(BASE_URI + "/getValue2", false));
+        System.out.println("Request headers:");
+        System.out.println(Arrays.asList(getHttpMethod.getRequestHeaders()));
+        try {
+            int result = httpclient.executeMethod(getHttpMethod);
+            System.out.println("Response status code: " + result);
+            System.out.println("Response body: ");
+            String responseBody = getHttpMethod.getResponseBodyAsString();
+            System.out.println(responseBody);
+            System.out.println("Response headers:");
+            List<Header> headers = Arrays.asList(getHttpMethod.getResponseHeaders());
+            System.out.println(headers);
+            assertEquals(400, result);
+            assertEquals("value2", responseBody.trim());
+        } finally {
+            getHttpMethod.releaseConnection();
+        }
+    }
+
+    // /**
+    // * Test the @CookieParameter annotation on a static class field
+    // *
+    // * @throws Exception
+    // */
+    // public void testCookieParamStaticField() throws Exception {
+    // httpclient = new HttpClient();
+    // setCookies();
+    // GetMethod getHttpMethod = new GetMethod();
+    // getHttpMethod.getParams().setCookiePolicy(CookiePolicy.RFC_2965);
+    // getHttpMethod.setURI(new URI(BASE_URI+"/getStaticValue", false));
+    // System.out.println("Request headers:");
+    // System.out.println(Arrays.asList(getHttpMethod.getRequestHeaders()));
+    // try {
+    // int result = httpclient.executeMethod(getHttpMethod);
+    // System.out.println("Response status code: " + result);
+    // System.out.println("Response body: ");
+    // String responseBody = getHttpMethod.getResponseBodyAsString();
+    // System.out.println(responseBody);
+    // System.out.println("Response headers:");
+    // List<Header> headers = Arrays.asList(getHttpMethod.getResponseHeaders());
+    // System.out.println(headers);
+    // assertEquals(400, result);
+    // assertEquals("value", responseBody.trim());
+    // } finally {
+    // getHttpMethod.releaseConnection();
+    // }
+    // }
+
+    /**
+     * Test the @CookieParameter annotation bean property
+     * 
+     * @throws Exception
+     */
+    // public void testCookieParamBeanProp() throws Exception {
+    // httpclient = new HttpClient();
+    // setCookies();
+    // GetMethod getHttpMethod = new GetMethod();
+    // getHttpMethod.getParams().setCookiePolicy(CookiePolicy.RFC_2965);
+    // getHttpMethod.setURI(new URI(BASE_URI+"/getValue3", false));
+    // System.out.println("Request headers:");
+    // System.out.println(Arrays.asList(getHttpMethod.getRequestHeaders()));
+    // try {
+    // int result = httpclient.executeMethod(getHttpMethod);
+    // System.out.println("Response status code: " + result);
+    // System.out.println("Response body: ");
+    // String responseBody = getHttpMethod.getResponseBodyAsString();
+    // System.out.println(responseBody);
+    // System.out.println("Response headers:");
+    // List<Header> headers = Arrays.asList(getHttpMethod.getResponseHeaders());
+    // System.out.println(headers);
+    // assertEquals(400, result);
+    // assertEquals("value3", responseBody.trim());
+    // } finally {
+    // getHttpMethod.releaseConnection();
+    // }
+    // }
+    private void setCookies() throws Exception {
+        // call put to set the cookies
+        PutMethod putHttpMethod = new PutMethod();
+        putHttpMethod.getParams().setCookiePolicy(CookiePolicy.RFC_2965);
+        putHttpMethod.setURI(new URI(BASE_URI, false));
+        System.out.println("Request headers:");
+        System.out.println(Arrays.asList(putHttpMethod.getRequestHeaders()));
+        try {
+            int result = httpclient.executeMethod(putHttpMethod);
+            System.out.println("Response status code: " + result);
+            System.out.println("Response body: ");
+            String responseBody = putHttpMethod.getResponseBodyAsString();
+            System.out.println(responseBody);
+            System.out.println("Response headers:");
+            List<Header> headers = Arrays.asList(putHttpMethod.getResponseHeaders());
+            System.out.println(headers);
+            assertEquals(200, result);
+        } finally {
+            putHttpMethod.releaseConnection();
+        }
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/CookieParamTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/CookieParamTest.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/CookieParamTest.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/CookieParamTest.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,104 @@
+/*
+ * 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;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.cookie.CookiePolicy;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.wink.test.integration.ServerEnvironmentInfo;
+
+/**
+ * Tests the use of cookie parameter.
+ */
+public class CookieParamTest extends TestCase {
+
+    protected HttpClient        httpclient = new HttpClient();
+
+    final private static String BASE_URI   =
+                                               ServerEnvironmentInfo.getBaseURI() + "/params/cookiemonster";
+
+    /**
+     * Tests that a cookie parameter is retrieved.
+     */
+    public void testCookieParam() {
+
+        try {
+            PutMethod httpMethod = new PutMethod();
+            httpMethod.getParams().setCookiePolicy(CookiePolicy.RFC_2109);
+            httpMethod.setURI(new URI(BASE_URI, false));
+            System.out.println("Request headers:");
+            System.out.println(Arrays.asList(httpMethod.getRequestHeaders()));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                System.out.println("Response headers:");
+                System.out.println(Arrays.asList(httpMethod.getResponseHeaders()));
+                assertEquals(200, result);
+                assertEquals("swiped:" + 0, responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+
+            System.out.println("---");
+
+            httpMethod = new PutMethod();
+            httpMethod.getParams().setCookiePolicy(CookiePolicy.RFC_2109);
+            httpMethod.setURI(new URI(BASE_URI, false));
+            httpMethod.setRequestHeader("Cookie", "jar=1");
+            System.out.println("Request headers:");
+            System.out.println(Arrays.asList(httpMethod.getRequestHeaders()));
+            httpclient = new HttpClient();
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                System.out.println("Response headers:");
+                System.out.println(Arrays.asList(httpMethod.getResponseHeaders()));
+                assertEquals(200, result);
+                assertEquals("swiped:" + 1, responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/DefaultValueParamTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/DefaultValueParamTest.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/DefaultValueParamTest.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/DefaultValueParamTest.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,118 @@
+/*
+ * 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;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.wink.test.integration.ServerEnvironmentInfo;
+
+/**
+ * Tests <code>@DefaultValue</code> annotation.
+ */
+public class DefaultValueParamTest extends TestCase {
+
+    protected HttpClient        httpclient = new HttpClient();
+
+    final private static String BASE_URI   =
+                                               ServerEnvironmentInfo.getBaseURI() + "/params/defaultvalue";
+
+    /**
+     * Test that if no parameters are passed, the default values are used.
+     */
+    public void testDefaultValue() {
+
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod.setURI(new URI(BASE_URI, false));
+            System.out.println(Arrays.asList(httpMethod.getRequestHeaders()));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals("getRow:" + "offset="
+                    + "0"
+                    + ";version="
+                    + "1.0"
+                    + ";limit="
+                    + "100"
+                    + ";sort="
+                    + "normal", responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    /**
+     * Test using some default values.
+     */
+    public void testUseSomeDefaultValue() {
+
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod.setURI(new URI(BASE_URI + "?sort=backward&offset=314", false));
+            System.out.println(Arrays.asList(httpMethod.getRequestHeaders()));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals("getRow:" + "offset="
+                    + "314"
+                    + ";version="
+                    + "1.0"
+                    + ";limit="
+                    + "100"
+                    + ";sort="
+                    + "backward", responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/EncodingParamTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/EncodingParamTest.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/EncodingParamTest.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/EncodingParamTest.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,578 @@
+/*
+ * 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;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.wink.test.integration.ServerEnvironmentInfo;
+
+/**
+ * Tests that <code>@Encoded</code> annotated method and parameter level works.
+ */
+public class EncodingParamTest extends TestCase {
+
+    protected HttpClient        httpclient      = new HttpClient();
+
+    final private static String BASE_URI_DECODE =
+                                                    ServerEnvironmentInfo.getBaseURI() + "/params/decodedparams";
+
+    final private static String BASE_URI_ENCODE =
+                                                    ServerEnvironmentInfo.getBaseURI() + "/params/encodingparam";
+
+    // /**
+    // * Test that if regular parameters are passed, the parameters are correct.
+    // */
+    // public void testRegularParametersEncodedMethod() {
+    // try {
+    // GetMethod httpMethod = new GetMethod();
+    // httpMethod.setURI(new URI(BASE_URI_ENCODE
+    // + "/city/Austin/;appversion=1.1?q=Pizza", false));
+    // httpclient = new HttpClient();
+    //
+    // try {
+    // int result = httpclient.executeMethod(httpMethod);
+    // System.out.println("Response status code: " + result);
+    // System.out.println("Response body: ");
+    // String responseBody = httpMethod.getResponseBodyAsString();
+    // System.out.println(responseBody);
+    // assertEquals(200, result);
+    // assertEquals("getShopInCity:q=Pizza;city=Austin;appversion=1.1",
+    // responseBody);
+    // } catch (IOException ioe) {
+    // ioe.printStackTrace();
+    // fail(ioe.getMessage());
+    // } finally {
+    // httpMethod.releaseConnection();
+    // }
+    // } catch (URIException e) {
+    // e.printStackTrace();
+    // fail(e.getMessage());
+    // }
+    // }
+
+    // /**
+    // * Tests that if
+    // */
+    // public void testEncodedMethod() {
+    // try {
+    // GetMethod httpMethod = new GetMethod();
+    // httpMethod.setURI(new URI(BASE_URI_ENCODE
+    // + "/city/Earth, TX/;appversion=1.1+?q=Dave %26 Buster's",
+    // false));
+    // httpclient = new HttpClient();
+    //
+    // try {
+    // int result = httpclient.executeMethod(httpMethod);
+    // System.out.println("Response status code: " + result);
+    // System.out.println("Response body: ");
+    // String responseBody = httpMethod.getResponseBodyAsString();
+    // System.out.println(responseBody);
+    // assertEquals(200, result);
+    // assertEquals(
+    // "getShopInCity:q=Dave%20%26%20Buster's;city=Earth%2C%%20%TX%20D.C.;appversion=1.1"
+    // ,
+    // responseBody);
+    // } catch (IOException ioe) {
+    // ioe.printStackTrace();
+    // fail(ioe.getMessage());
+    // } finally {
+    // httpMethod.releaseConnection();
+    // }
+    // } catch (URIException e) {
+    // e.printStackTrace();
+    // fail(e.getMessage());
+    // }
+    // }
+    //
+    // public void testLocationDecodedMethod() {
+    // try {
+    // GetMethod httpMethod = new GetMethod();
+    // httpMethod.setURI(new URI(BASE_URI_ENCODE
+    // +
+    // "/loc/Earth%2C%20TX/;appversion=1.1%2B?q=Dave%20%26%20Buster's"
+    // ,
+    // true));
+    // httpclient = new HttpClient();
+    //
+    // try {
+    // int result = httpclient.executeMethod(httpMethod);
+    // System.out.println("Response status code: " + result);
+    // System.out.println("Response body: ");
+    // String responseBody = httpMethod.getResponseBodyAsString();
+    // System.out.println(responseBody);
+    // assertEquals(200, result);
+    // assertEquals(
+    // "getShopInLocation:q=Dave%20%26%20Buster's;location=Earth%2C%20TX;appversion=1.1%2B"
+    // ,
+    // responseBody);
+    // } catch (IOException ioe) {
+    // ioe.printStackTrace();
+    // fail(ioe.getMessage());
+    // } finally {
+    // httpMethod.releaseConnection();
+    // }
+    // } catch (URIException e) {
+    // e.printStackTrace();
+    // fail(e.getMessage());
+    // }
+    // }
+    //
+    // public void testPathParamEncoded() {
+    // try {
+    // GetMethod httpMethod = new GetMethod();
+    // httpMethod.setURI(new URI(BASE_URI_ENCODE
+    // + "/country/United%20States/;appversion=1.1%2B", true));
+    // httpclient = new HttpClient();
+    //
+    // try {
+    // int result = httpclient.executeMethod(httpMethod);
+    // System.out.println("Response status code: " + result);
+    // System.out.println("Response body: ");
+    // String responseBody = httpMethod.getResponseBodyAsString();
+    // System.out.println(responseBody);
+    // assertEquals(200, result);
+    // assertEquals("getShopInCountry:location=United%20States;appversion=1.1%2B"
+    // ,
+    // responseBody);
+    // } catch (IOException ioe) {
+    // ioe.printStackTrace();
+    // fail(ioe.getMessage());
+    // } finally {
+    // httpMethod.releaseConnection();
+    // }
+    // } catch (URIException e) {
+    // e.printStackTrace();
+    // fail(e.getMessage());
+    // }
+    // }
+    //
+    // public void testDecodedMethod() {
+    // try {
+    // GetMethod httpMethod = new GetMethod();
+    // httpMethod
+    // .setURI(new URI(BASE_URI_DECODE
+    // +
+    // "/city/Washington D.C./;appversion=1 1?q=Austin's City Pizza"
+    // ,
+    // false));
+    // httpclient = new HttpClient();
+    //
+    // try {
+    // int result = httpclient.executeMethod(httpMethod);
+    // System.out.println("Response status code: " + result);
+    // System.out.println("Response body: ");
+    // String responseBody = httpMethod.getResponseBodyAsString();
+    // System.out.println(responseBody);
+    // assertEquals(200, result);
+    // assertEquals("getRow:" + "offset=" + "0" + ";version=" + "1.0" +
+    // ";limit=" + "100"
+    // + ";sort=" + "normal", responseBody);
+    // } catch (IOException ioe) {
+    // ioe.printStackTrace();
+    // fail(ioe.getMessage());
+    // } finally {
+    // httpMethod.releaseConnection();
+    // }
+    // } catch (URIException e) {
+    // e.printStackTrace();
+    // fail(e.getMessage());
+    // }
+    // }
+
+    public void testSingleDecodedQueryParam() {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            // httpMethod.setURI(new URI(BASE_URI_DECODE
+            // +
+            // "/city;appversion=1.1?location=! * ' ( ) ; : @ & = + $ , / ? % # [ ]"
+            // , false));
+
+            httpMethod
+                .setURI(new URI(
+                                BASE_URI_DECODE + "/city;appversion=1.1?location=%21%20%2A%20%27%20%28%20%29%20%3B%20%3A%20%40%20%26%20%3D%20%2B%20%24%20%2C%20%2F%20%3F%20%25%20%23%20%5B%20%5D",
+                                true));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals("getShopInCityDecoded:location=! * ' ( ) ; : @ & = + $ , / ? % # [ ];appversion=1.1",
+                             responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testSingleEncodedQueryParam() {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod
+                .setURI(new URI(
+                                BASE_URI_ENCODE + "/city;appversion=1.1%2B?location=Austin%2B%20Texas",
+                                true));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals("getShopInCity:location=Austin%2B%20Texas;appversion=1.1%2B",
+                             responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testSingleEncodedQueryParamMethod() {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod
+                .setURI(new URI(
+                                BASE_URI_ENCODE + "/method/city;appversion=1.1%2B?location=Austin%2B%20Texas",
+                                true));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                System.out.println(responseBody);
+                assertEquals("getShopInCityMethod:location=Austin%2B%20Texas;appversion=1.1%2B",
+                             responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testSingleDecodedPathParm() {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod
+                .setURI(new URI(
+                                BASE_URI_DECODE + "/country/United%20States%20of%20America;appversion=1.1%2C2",
+                                true));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals("getShopInCountryDecoded:location=United States of America;appversion=1.1,2",
+                             responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testSingleEncodedPathParam() {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod
+                .setURI(new URI(
+                                BASE_URI_ENCODE + "/country/United%20States%20of%20America;appversion=1.1%2B",
+                                true));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals("getShopInCountry:location=United%20States%20of%20America;appversion=1.1%2B",
+                             responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testSingleEncodedPathParamMethod() {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod
+                .setURI(new URI(
+                                BASE_URI_ENCODE + "/method/country/United%20States%20of%20America;appversion=1.1%2B",
+                                true));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals("getShopInCountryMethod:location=United%20States%20of%20America;appversion=1.1%2B",
+                             responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testSingleDecodedMatrixParam() {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod
+                .setURI(new URI(
+                                BASE_URI_DECODE + "/street;location=Burnet%20Road;appversion=1.1%2B",
+                                true));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals("getShopOnStreetDecoded:location=Burnet Road;appversion=1.1+",
+                             responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testSingleEncodedMatrixParam() {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod
+                .setURI(new URI(
+                                BASE_URI_ENCODE + "/street;location=Burnet%20Road;appversion=1.1%2B",
+                                true));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals("getShopOnStreet:location=Burnet%20Road;appversion=1.1%2B",
+                             responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testSingleEncodedMatrixParamMethod() {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod
+                .setURI(new URI(
+                                BASE_URI_ENCODE + "/method/street;location=Burnet%2B%20Road;appversion=1.1%2B",
+                                true));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals("getShopOnStreetMethod:location=Burnet%2B%20Road;appversion=1.1%2B",
+                             responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testSingleDecodedFormParam() throws Exception {
+        try {
+            PostMethod httpMethod = new PostMethod();
+            httpMethod.setURI(new URI(BASE_URI_DECODE + "/region;appversion=", true));
+            // httpMethod.setParameter("location", "The%20Southwest");
+            httpMethod
+                .setRequestEntity(new StringRequestEntity(
+                                                          "location=%21%20%2A%20%27%20%28%20%29%20%3B%20%3A%20%40%20%26%20%3D%20%2B%20%24%20%2C%20%2F%20%3F%20%25%20%23%20%5B%20%5D",
+                                                          "application/x-www-form-urlencoded",
+                                                          "UTF-8"));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals("getShopInRegionDecoded:location=! * ' ( ) ; : @ & = + $ , / ? % # [ ];appversion=",
+                             responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testSingleEncodedFormParam() throws Exception {
+        try {
+            PostMethod httpMethod = new PostMethod();
+            httpMethod.setURI(new URI(BASE_URI_ENCODE + "/region;appversion=1.1%2B", true));
+            // httpMethod.setParameter("location", "The%20Southwest");
+            httpMethod
+                .setRequestEntity(new StringRequestEntity("location=The%20Southwest",
+                                                          "application/x-www-form-urlencoded",
+                                                          "UTF-8"));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals("getShopInRegion:location=The%20Southwest;appversion=1.1%2B",
+                             responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testSingleEncodedFormParamMethod() throws Exception {
+        try {
+            PostMethod httpMethod = new PostMethod();
+            httpMethod.setURI(new URI(BASE_URI_ENCODE + "/method/region;appversion=1.1%2B", true));
+            httpMethod
+                .setRequestEntity(new StringRequestEntity("location=The%20Southwest",
+                                                          "application/x-www-form-urlencoded",
+                                                          "UTF-8"));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals("getShopInRegionMethod:location=The%20Southwest;appversion=1.1%2B",
+                             responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/FormParamTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/FormParamTest.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/FormParamTest.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-params/src/test/java/org/apache/wink/itest/FormParamTest.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;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.wink.test.integration.ServerEnvironmentInfo;
+
+public class FormParamTest extends TestCase {
+
+    public String getBaseURI() {
+        return ServerEnvironmentInfo.getBaseURI() + "/params/params/form";
+    }
+
+    public void testOnlyEntityFormParam() throws Exception {
+        HttpClient httpclient = new HttpClient();
+
+        PostMethod httpMethod = new PostMethod(getBaseURI() + "/withOnlyEntity");
+        try {
+            StringRequestEntity s =
+                new StringRequestEntity("firstkey=somevalue&someothervalue=somethingelse",
+                                        "application/x-www-form-urlencoded", null);
+            httpMethod.setRequestEntity(s);
+            httpclient.executeMethod(httpMethod);
+            assertEquals(200, httpMethod.getStatusCode());
+            String resp = httpMethod.getResponseBodyAsString();
+            System.out.println(resp);
+            assertTrue(resp, resp.contains("someothervalue=somethingelse"));
+            assertTrue(resp, resp.contains("firstkey=somevalue"));
+        } finally {
+            httpMethod.releaseConnection();
+        }
+    }
+
+    // TODO Fails due to WINK-35 which is not going to be resolved for the time
+    // being
+    // public void testEntityFormParamWithOneFormParam() throws Exception {
+    // HttpClient httpclient = new HttpClient();
+    //
+    // PostMethod httpMethod = new PostMethod(getBaseURI() +
+    // "/withOneKeyAndEntity");
+    // try {
+    // StringRequestEntity s =
+    // new
+    // StringRequestEntity("firstkey=somevalue&someothervalue=somethingelse",
+    // "application/x-www-form-urlencoded", null);
+    // httpMethod.setRequestEntity(s);
+    // httpclient.executeMethod(httpMethod);
+    // assertEquals(200, httpMethod.getStatusCode());
+    // String resp = httpMethod.getResponseBodyAsString();
+    // System.out.println(resp);
+    // assertTrue(resp, resp.startsWith("firstkey=somevalue"));
+    // assertTrue(resp, resp.contains("someothervalue=somethingelse"));
+    // assertTrue(resp, resp.contains("firstkey=somevalue"));
+    // } finally {
+    // httpMethod.releaseConnection();
+    // }
+    // }
+
+    /**
+     * In a weird instance, client posts a form encoded data but the resource is
+     * expecting something else (say a String) as its entity. The engine should
+     * not mangle the InputStream with ServletRequest.getParameter until
+     * absolutely required.
+     * 
+     * @throws Exception
+     */
+    public void testPostFormEntityButResourceDoesNotExpect() throws Exception {
+        HttpClient httpclient = new HttpClient();
+
+        PostMethod httpMethod = new PostMethod(getBaseURI() + "/withStringEntity");
+        try {
+            StringRequestEntity s =
+                new StringRequestEntity("firstkey=somevalue&someothervalue=somethingelse",
+                                        "application/x-www-form-urlencoded", null);
+            httpMethod.setRequestEntity(s);
+            httpclient.executeMethod(httpMethod);
+            assertEquals(200, httpMethod.getStatusCode());
+            String resp = httpMethod.getResponseBodyAsString();
+            System.out.println(resp);
+            assertEquals(resp, "str:firstkey=somevalue&someothervalue=somethingelse");
+        } finally {
+            httpMethod.releaseConnection();
+        }
+    }
+}