You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2009/04/07 16:09:38 UTC
svn commit: r762784 [2/2] - in /cxf/trunk:
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/
rt/frontend/jaxrs/src/main/java/or...
Added: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/ResourceUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/ResourceUtilsTest.java?rev=762784&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/ResourceUtilsTest.java (added)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/ResourceUtilsTest.java Tue Apr 7 14:09:36 2009
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jaxrs.utils;
+
+import java.lang.reflect.Constructor;
+
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.cxf.jaxrs.Customer;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ResourceUtilsTest extends Assert {
+
+ @Test
+ public void testFindResourceConstructor() {
+ Constructor c = ResourceUtils.findResourceConstructor(Customer.class);
+ assertNotNull(c);
+ assertEquals(1, c.getParameterTypes().length);
+ assertEquals(UriInfo.class, c.getParameterTypes()[0]);
+ }
+
+
+}
Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/ResourceUtilsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/ResourceUtilsTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=762784&r1=762783&r2=762784&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java Tue Apr 7 14:09:36 2009
@@ -237,9 +237,14 @@
for (Iterator<?> iter = headers.keySet().iterator(); iter.hasNext();) {
String header = (String)iter.next();
List<?> headerList = (List<?>)headers.get(header);
- for (Object value : headerList) {
- response.addHeader(header, (String)value);
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < headerList.size(); i++) {
+ sb.append(headerList.get(i));
+ if (i + 1 < headerList.size()) {
+ sb.append(',');
+ }
}
+ response.addHeader(header, sb.toString());
}
} else {
response.setContentType(ct);
Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java?rev=762784&r1=762783&r2=762784&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java Tue Apr 7 14:09:36 2009
@@ -36,7 +36,6 @@
@Override
public void loadBus(ServletConfig servletConfig) throws ServletException {
loadBusNoConfig(servletConfig);
- // You could add the endpoint publish codes here
}
private void loadBusNoConfig(ServletConfig servletConfig) throws ServletException {
Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/Book.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/Book.java?rev=762784&r1=762783&r2=762784&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/Book.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/Book.java Tue Apr 7 14:09:36 2009
@@ -64,15 +64,18 @@
@Path("chapters/{chapterid}/")
@Produces("application/xml;charset=ISO-8859-1")
public Chapter getChapter(@PathParam("chapterid")int chapterid) {
- System.out.println("----invoking getChapter with chapterid: " + chapterid);
-
return chapters.get(new Long(chapterid));
}
+
+ @GET
+ @Path("chapters/badencoding/{chapterid}/")
+ @Produces("application/xml;charset=UTF-48")
+ public Chapter getChapterBadEncoding(@PathParam("chapterid")int chapterid) {
+ return chapters.get(new Long(chapterid));
+ }
@Path("chapters/sub/{chapterid}/")
public Chapter getSubChapter(@PathParam("chapterid")int chapterid) {
- System.out.println("----invoking getChapter with chapterid: " + chapterid);
-
return chapters.get(new Long(chapterid));
}
Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookContinuationServer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookContinuationServer.java?rev=762784&r1=762783&r2=762784&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookContinuationServer.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookContinuationServer.java Tue Apr 7 14:09:36 2009
@@ -20,6 +20,7 @@
package org.apache.cxf.systest.jaxrs;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
public class BookContinuationServer extends AbstractBusTestServerBase {
@@ -27,7 +28,8 @@
protected void run() {
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(BookContinuationStore.class);
- //default lifecycle is per-request, change it to singleton
+ sf.setResourceProvider(BookContinuationStore.class,
+ new SingletonResourceProvider(new BookContinuationStore()));
sf.setAddress("http://localhost:9080/");
sf.create();
Added: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookNonSpringServer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookNonSpringServer.java?rev=762784&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookNonSpringServer.java (added)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookNonSpringServer.java Tue Apr 7 14:09:36 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.cxf.systest.jaxrs;
+
+
+
+
+public class BookNonSpringServer extends AbstractSpringServer {
+
+ public BookNonSpringServer() {
+ super("/jaxrs_non_spring");
+ }
+
+ public static void main(String args[]) {
+ try {
+ BookNonSpringServer s = new BookNonSpringServer();
+ s.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(-1);
+ } finally {
+ System.out.println("done!");
+ }
+ }
+
+}
Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookNonSpringServer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookNonSpringServer.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java?rev=762784&r1=762783&r2=762784&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java Tue Apr 7 14:09:36 2009
@@ -33,7 +33,7 @@
protected void run() {
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
- sf.setResourceClasses(BookStore.class);
+ sf.setResourceClasses(BookStore.class, BookStorePerRequest.class);
//default lifecycle is per-request, change it to singleton
BinaryDataProvider p = new BinaryDataProvider();
p.setProduceMediaTypes(Collections.singletonList("application/bar"));
Added: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStorePerRequest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStorePerRequest.java?rev=762784&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStorePerRequest.java (added)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStorePerRequest.java Tue Apr 7 14:09:36 2009
@@ -0,0 +1,72 @@
+/**
+ * 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.cxf.systest.jaxrs;
+
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+
+@Path("/bookstore2")
+public class BookStorePerRequest {
+
+ private HttpHeaders httpHeaders;
+ private Map<Long, Book> books = new HashMap<Long, Book>();
+
+ public BookStorePerRequest(@Context HttpHeaders headers) {
+ httpHeaders = headers;
+ init();
+ }
+
+ @GET
+ @Path("/bookheaders/")
+ public Book getBookByHeader() throws Exception {
+
+ List<String> ids = httpHeaders.getRequestHeader("BOOK");
+ return doGetBook(ids.get(0) + ids.get(1) + ids.get(2));
+ }
+
+ private Book doGetBook(String id) throws BookNotFoundFault {
+ Book book = books.get(Long.parseLong(id));
+ if (book != null) {
+ return book;
+ } else {
+ BookNotFoundDetails details = new BookNotFoundDetails();
+ details.setId(Long.parseLong(id));
+ throw new BookNotFoundFault(details);
+ }
+ }
+
+
+ final void init() {
+ Book book = new Book();
+ book.setId(123);
+ book.setName("CXF in Action");
+ books.put(book.getId(), book);
+ }
+
+}
+
+
Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStorePerRequest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStorePerRequest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=762784&r1=762783&r2=762784&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Tue Apr 7 14:09:36 2009
@@ -354,6 +354,13 @@
}
@Test
+ public void testGetBookByHeaderPerRequest() throws Exception {
+ getAndCompareAsStrings("http://localhost:9080/bookstore2/bookheaders",
+ "resources/expected_get_book123.txt",
+ "application/xml;q=0.5,text/xml", "text/xml", 200);
+ }
+
+ @Test
public void testGetBookByHeaderDefault() throws Exception {
getAndCompareAsStrings("http://localhost:9080/bookstore/bookheaders2",
"resources/expected_get_book123.txt",
@@ -402,6 +409,14 @@
}
@Test
+ public void testGetChapterEncodingDefault() throws Exception {
+
+ getAndCompareAsStrings("http://localhost:9080/bookstore/booksubresource/123/chapters/badencoding/1",
+ "resources/expected_get_chapter1_utf.txt",
+ "application/xml", "application/xml;charset=UTF-8", 200);
+ }
+
+ @Test
public void testGetChapterChapter() throws Exception {
getAndCompareAsStrings("http://localhost:9080/bookstore/booksubresource/123/chapters/sub/1/recurse",
@@ -829,6 +844,10 @@
expectedValue, content);
if (expectedStatus == 200) {
assertEquals("123", get.getResponseHeader("BookId").getValue());
+ assertNotNull(get.getResponseHeader("Date"));
+ }
+ if (expectedStatus == 405) {
+ assertNotNull(get.getResponseHeader("Allow"));
}
if (expectedContentType != null) {
Header ct = get.getResponseHeader("Content-Type");
Added: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java?rev=762784&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java (added)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java Tue Apr 7 14:09:36 2009
@@ -0,0 +1,116 @@
+/**
+ * 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.cxf.systest.jaxrs;
+
+import java.io.InputStream;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.io.CachedOutputStream;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class JAXRSClientServerNonSpringBookTest extends AbstractBusClientServerTestBase {
+
+ @BeforeClass
+ public static void startServers() throws Exception {
+ assertTrue("server did not launch correctly",
+ launchServer(BookNonSpringServer.class, true));
+ }
+
+
+ @Test
+ public void testGetBook123Singleton() throws Exception {
+ getAndCompareAsStrings("http://localhost:9080/singleton/bookstore/books/123",
+ "resources/expected_get_book123.txt",
+ "application/xml", 200);
+
+ }
+
+ @Test
+ public void testGetBook123ApplicationSingleton() throws Exception {
+ getAndCompareAsStrings("http://localhost:9080/application/bookstore/books/123",
+ "resources/expected_get_book123.txt",
+ "application/xml", 200);
+
+ }
+
+ @Test
+ public void testGetBook123ApplicationPerRequest() throws Exception {
+ getAndCompareAsStrings("http://localhost:9080/application/bookstore2/bookheaders",
+ "resources/expected_get_book123.txt",
+ "application/xml", 200);
+
+ }
+
+ private void getAndCompareAsStrings(String address,
+ String resourcePath,
+ String acceptType,
+ int status) throws Exception {
+ String expected = getStringFromInputStream(
+ getClass().getResourceAsStream(resourcePath));
+ getAndCompare(address,
+ expected,
+ acceptType,
+ acceptType,
+ status);
+ }
+
+
+
+ private void getAndCompare(String address,
+ String expectedValue,
+ String acceptType,
+ String expectedContentType,
+ int expectedStatus) throws Exception {
+ GetMethod get = new GetMethod(address);
+ get.setRequestHeader("Accept", acceptType);
+ get.setRequestHeader("Accept-Language", "da;q=0.8,en");
+ get.setRequestHeader("Book", "1,2,3");
+ HttpClient httpClient = new HttpClient();
+ try {
+ int result = httpClient.executeMethod(get);
+ assertEquals(expectedStatus, result);
+ String content = getStringFromInputStream(get.getResponseBodyAsStream());
+ assertEquals("Expected value is wrong",
+ expectedValue, content);
+ if (expectedContentType != null) {
+ Header ct = get.getResponseHeader("Content-Type");
+ assertEquals("Wrong type of response", expectedContentType, ct.getValue());
+ }
+ } finally {
+ get.releaseConnection();
+ }
+ }
+
+
+ private String getStringFromInputStream(InputStream in) throws Exception {
+ CachedOutputStream bos = new CachedOutputStream();
+ IOUtils.copy(in, bos);
+ in.close();
+ bos.close();
+ return bos.getOut().toString();
+ }
+
+}
Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java?rev=762784&r1=762783&r2=762784&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java Tue Apr 7 14:09:36 2009
@@ -24,11 +24,13 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
+import java.net.Socket;
import java.net.URL;
import java.net.URLConnection;
import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+
import org.junit.BeforeClass;
import org.junit.Test;
@@ -98,7 +100,6 @@
httpUrlConnection.setRequestProperty("Accept", "text/xml");
httpUrlConnection.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
httpUrlConnection.setRequestProperty("Connection", "close");
- //httpurlconnection.setRequestProperty("Content-Length", String.valueOf(is.available()));
OutputStream outputstream = httpUrlConnection.getOutputStream();
File inputFile = new File(getClass().getResource("resources/singleValPostBody.txt").toURI());
@@ -123,6 +124,23 @@
httpUrlConnection.disconnect();
}
+ @Test
+ public void testPostPetStatus2() throws Exception {
+
+
+ Socket s = new Socket("localhost", 9080);
+ IOUtils.copyAndCloseInput(getClass().getResource("resources/formRequest.txt").openStream(),
+ s.getOutputStream());
+
+ s.getOutputStream().flush();
+ try {
+ assertTrue("Wrong status returned", getStringFromInputStream(s.getInputStream())
+ .contains("open"));
+ } finally {
+ s.close();
+ }
+ }
+
private String getStringFromInputStream(InputStream in) throws Exception {
return IOUtils.toString(in);
}
Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java?rev=762784&r1=762783&r2=762784&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java Tue Apr 7 14:09:36 2009
@@ -45,8 +45,8 @@
import org.apache.cxf.jaxrs.client.ResponseExceptionMapper;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.jaxrs.ext.form.Form;
+import org.apache.cxf.jaxrs.ext.xml.XMLSource;
import org.apache.cxf.jaxrs.impl.MetadataMap;
-import org.apache.cxf.jaxrs.utils.XMLSource;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.junit.BeforeClass;
Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java?rev=762784&r1=762783&r2=762784&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java Tue Apr 7 14:09:36 2009
@@ -25,6 +25,7 @@
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
@@ -34,7 +35,6 @@
public static final String CLOSED = "The Pet Store is closed";
public PetStore() {
- System.out.println("Petstore constructed");
}
@GET
@@ -42,19 +42,16 @@
@Produces("text/xml")
public Response getStatus(@PathParam("petId")
String petId) throws Exception {
- System.out.println("----invoking getStatus on the petStore for id: " + petId);
return Response.ok(CLOSED).build();
}
@POST
@Path("/pets/")
- @Consumes("application/x-www-form-urlencoded")
+ @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces("text/xml")
public Response updateStatus(MultivaluedMap<String, String> params) throws Exception {
- System.out.println("----invoking updateStatus on the petStore with stauts post param value of: "
- + params.getFirst("status"));
-
+ System.out.println(params);
return Response.ok(params.getFirst("status")).build();
}
}
Added: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt?rev=762784&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt (added)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt Tue Apr 7 14:09:36 2009
@@ -0,0 +1,14 @@
+POST /webapp/petstore/pets HTTP/1.1
+Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
+Accept-Language: en-ie
+Content-Type: application/x-www-form-urlencoded
+UA-CPU: x86
+Accept-Encoding: gzip, deflate
+User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; iOpus-Web-Automation; .NET CLR 2.0.50727)
+Host: localhost:9080
+Content-Length: 27
+Connection: Close
+Cache-Control: no-cache
+
+status=open¶m2=hfsello
+
Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cxf/trunk/systests/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml?rev=762784&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml (added)
+++ cxf/trunk/systests/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml Tue Apr 7 14:09:36 2009
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app
+ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<!--
+ 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.
+-->
+<!-- START SNIPPET: webxml -->
+<web-app>
+
+ <servlet>
+ <servlet-name>CXFServlet</servlet-name>
+ <display-name>CXF Servlet</display-name>
+ <servlet-class>
+ org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet
+ </servlet-class>
+ <init-param>
+ <param-name>jaxrs.serviceClasses</param-name>
+ <param-value>
+ org.apache.cxf.systest.jaxrs.BookStore
+ </param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>CXFServlet2</servlet-name>
+ <display-name>CXF Servlet2</display-name>
+ <servlet-class>
+ org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet
+ </servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.apache.cxf.systest.jaxrs.BookApplication</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+
+ <servlet-mapping>
+ <servlet-name>CXFServlet</servlet-name>
+ <url-pattern>/singleton/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>CXFServlet2</servlet-name>
+ <url-pattern>/application/*</url-pattern>
+ </servlet-mapping>
+</web-app>
+<!-- END SNIPPET: webxml -->
\ No newline at end of file
Propchange: cxf/trunk/systests/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/systests/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: cxf/trunk/systests/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml