Author: jliu
Date: Fri Feb 8 05:55:33 2008
New Revision: 619889
URL: http://svn.apache.org/viewvc?rev=619889&view=rev
Log:
Apply patch CXF-1416(Enhancement to JAX-RS spring configuration) on behalf of
Barry Fitzgerald.
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java
(with props)
Modified:
incubator/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
incubator/cxf/trunk/systests/src/test/resources/jaxrs_spring/WEB-INF/beans.xml
Modified:
incubator/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java?rev=619889&r1=619888&r2=619889&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
(original)
+++
incubator/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
Fri Feb 8 05:55:33 2008
@@ -66,7 +66,8 @@
setFirstChildAsProperty(el, ctx, bean, "bindingConfig");
} else if ("inInterceptors".equals(name) ||
"inFaultInterceptors".equals(name)
|| "outInterceptors".equals(name) ||
"outFaultInterceptors".equals(name)
- || "features".equals(name) || "schemaLocations".equals(name)) {
+ || "features".equals(name) || "schemaLocations".equals(name)
+ || "serviceBeans".equals(name)) {
List list = ctx.getDelegate().parseListElement(el,
bean.getBeanDefinition());
bean.addPropertyValue(name, list);
} else {
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java?rev=619889&r1=619888&r2=619889&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
Fri Feb 8 05:55:33 2008
@@ -34,7 +34,7 @@
@BeforeClass
public static void startServers() throws Exception {
assertTrue("server did not launch correctly",
- launchServer(BookServerResourceCreatedOutside.class));
+ launchServer(BookServerResourceCreatedSpring.class));
}
@Test
@@ -52,6 +52,19 @@
.getResourceAsStream("resources/expected_get_book123.txt");
assertEquals(getStringFromInputStream(expected),
getStringFromInputStream(in));
+ }
+
+ @Test
+ public void testPetStore() throws Exception {
+
+ String endpointAddress =
+ "http://localhost:9080/petstore/pets/24";
+ URL url = new URL(endpointAddress);
+ URLConnection connect = url.openConnection();
+ connect.addRequestProperty("Accept", "text/xml");
+ InputStream in = connect.getInputStream();
+ assertNotNull(in);
+ assertEquals(PetStore.CLOSED, getStringFromInputStream(in));
}
private String getStringFromInputStream(InputStream in) throws Exception {
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java?rev=619889&view=auto
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java
(added)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java
Fri Feb 8 05:55:33 2008
@@ -0,0 +1,50 @@
+/**
+ * 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 javax.ws.rs.HttpMethod;
+import javax.ws.rs.ProduceMime;
+import javax.ws.rs.UriParam;
+import javax.ws.rs.UriTemplate;
+import javax.ws.rs.core.Response;
+
+
[EMAIL PROTECTED]("/petstore/")
+public class PetStore {
+
+ public static final String CLOSED = "The Pet Store is closed";
+
+ public PetStore() {
+ System.out.println("Petstore constructed");
+ }
+
+ @HttpMethod("GET")
+ @UriTemplate("/pets/{petId}/")
+ @ProduceMime("text/xml")
+ public Response getStatus(@UriParam("petId") String petId) throws
Exception {
+ System.out.println("----invoking getStatus on the petStore for id: " +
petId);
+
+ return Response.Builder.ok(CLOSED).build();
+ }
+}
+
+
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
incubator/cxf/trunk/systests/src/test/resources/jaxrs_spring/WEB-INF/beans.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/resources/jaxrs_spring/WEB-INF/beans.xml?rev=619889&r1=619888&r2=619889&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/resources/jaxrs_spring/WEB-INF/beans.xml
(original)
+++
incubator/cxf/trunk/systests/src/test/resources/jaxrs_spring/WEB-INF/beans.xml
Fri Feb 8 05:55:33 2008
@@ -40,10 +40,13 @@
<jaxrs:server id="bookservice"
address="/">
<jaxrs:serviceBeans>
+ <ref bean="petstore"/>
<ref bean="bookstore"/>
</jaxrs:serviceBeans>
</jaxrs:server>
<bean id="bookstore" scope="prototype"
class="org.apache.cxf.systest.jaxrs.BookStore">
+ </bean>
+ <bean id="petstore" scope="prototype"
class="org.apache.cxf.systest.jaxrs.PetStore">
</bean>
</beans>