Author: sergeyb
Date: Thu Dec 18 10:12:55 2008
New Revision: 727781
URL: http://svn.apache.org/viewvc?rev=727781&view=rev
Log:
JAXRS : fixing resource resolution issues
Added:
cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java
(with props)
Modified:
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpring.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpringProviders.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerRestSoap.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JaxRsJaxWsBookTest.java
cxf/trunk/systests/src/test/resources/jaxrs/WEB-INF/web.xml
cxf/trunk/systests/src/test/resources/jaxrs_proxy/WEB-INF/web.xml
cxf/trunk/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml
cxf/trunk/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/web.xml
Modified:
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
(original)
+++
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
Thu Dec 18 10:12:55 2008
@@ -40,6 +40,7 @@
import org.apache.cxf.jaxrs.model.OperationResourceInfo;
import org.apache.cxf.jaxrs.model.URITemplate;
import org.apache.cxf.jaxrs.provider.ProviderFactory;
+import org.apache.cxf.jaxrs.utils.HttpUtils;
import org.apache.cxf.jaxrs.utils.InjectionUtils;
import org.apache.cxf.jaxrs.utils.JAXRSUtils;
import org.apache.cxf.message.Exchange;
@@ -108,7 +109,7 @@
try {
result = invoke(exchange, resourceObject, methodToInvoke, params);
} catch (Fault ex) {
- String baseAddress =
(String)exchange.getInMessage().get(Message.BASE_PATH);
+ String baseAddress =
HttpUtils.getOriginalAddress(exchange.getInMessage());
Response excResponse =
JAXRSUtils.convertFaultToResponse(ex.getCause(), baseAddress);
if (excResponse == null) {
ProviderFactory.getInstance(baseAddress).clearThreadLocalProxies();
Modified:
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
(original)
+++
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
Thu Dec 18 10:12:55 2008
@@ -41,6 +41,7 @@
import org.apache.cxf.jaxrs.model.ProviderInfo;
import org.apache.cxf.jaxrs.model.URITemplate;
import org.apache.cxf.jaxrs.provider.ProviderFactory;
+import org.apache.cxf.jaxrs.utils.HttpUtils;
import org.apache.cxf.jaxrs.utils.JAXRSUtils;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
@@ -61,13 +62,15 @@
public void handleMessage(Message message) {
- String baseAddress = (String)message.get(Message.BASE_PATH);
+
+ String originalAddress = HttpUtils.getOriginalAddress(message);
+
try {
- processRequest(message, baseAddress);
+ processRequest(message, originalAddress);
} catch (RuntimeException ex) {
- Response excResponse = JAXRSUtils.convertFaultToResponse(ex,
baseAddress);
+ Response excResponse = JAXRSUtils.convertFaultToResponse(ex,
originalAddress);
if (excResponse == null) {
-
ProviderFactory.getInstance(baseAddress).clearThreadLocalProxies();
+
ProviderFactory.getInstance(originalAddress).clearThreadLocalProxies();
throw ex;
}
message.getExchange().put(Response.class, excResponse);
@@ -76,25 +79,7 @@
}
- private static String updatePath(String path, String address) {
- if (address.startsWith("http")) {
- int idx = address.indexOf('/', 7);
- if (idx != -1) {
- address = address.substring(idx);
- }
- }
-
- if (path.startsWith(address)) {
- path = path.substring(address.length());
- if (!path.startsWith("/")) {
- path = "/" + path;
- }
- }
-
- return path;
- }
-
- private void processRequest(Message message, String baseAddress) {
+ private void processRequest(Message message, String originalAddress) {
if (message.getExchange().get(OperationResourceInfo.class) != null) {
// it's a suspended invocation;
@@ -102,7 +87,7 @@
}
RequestPreprocessor rp =
- ProviderFactory.getInstance(baseAddress).getRequestPreprocessor();
+
ProviderFactory.getInstance(originalAddress).getRequestPreprocessor();
if (rp != null) {
rp.preprocess(message, new UriInfoImpl(message, null));
}
@@ -113,8 +98,7 @@
requestContentType = "*/*";
}
- String rawPath = (String)message.get(Message.REQUEST_URI);
- rawPath = updatePath(rawPath, baseAddress);
+ String rawPath = HttpUtils.getPathToMatch(message);
//1. Matching target resource class
Service service = message.getExchange().get(Service.class);
@@ -147,7 +131,7 @@
OperationResourceInfo ori = null;
List<ProviderInfo<RequestHandler>> shs =
- ProviderFactory.getInstance(baseAddress).getRequestHandlers();
+ ProviderFactory.getInstance(originalAddress).getRequestHandlers();
for (ProviderInfo<RequestHandler> sh : shs) {
String newAcceptTypes =
(String)message.get(Message.ACCEPT_CONTENT_TYPE);
if (!acceptTypes.equals(newAcceptTypes) || ori == null) {
Modified:
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
(original)
+++
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
Thu Dec 18 10:12:55 2008
@@ -41,6 +41,7 @@
import org.apache.cxf.jaxrs.model.OperationResourceInfo;
import org.apache.cxf.jaxrs.model.ProviderInfo;
import org.apache.cxf.jaxrs.provider.ProviderFactory;
+import org.apache.cxf.jaxrs.utils.HttpUtils;
import org.apache.cxf.jaxrs.utils.JAXRSUtils;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.Message;
@@ -57,7 +58,7 @@
public void handleMessage(Message message) {
- String baseAddress =
(String)message.getExchange().getInMessage().get(Message.BASE_PATH);
+ String baseAddress =
HttpUtils.getOriginalAddress(message.getExchange().getInMessage());
try {
processResponse(message, baseAddress);
} finally {
Modified:
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
(original)
+++
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
Thu Dec 18 10:12:55 2008
@@ -19,7 +19,9 @@
package org.apache.cxf.jaxrs.utils;
+import java.net.MalformedURLException;
import java.net.URI;
+import java.net.URL;
import java.util.List;
import java.util.Map;
@@ -28,7 +30,9 @@
import org.apache.cxf.jaxrs.impl.PathSegmentImpl;
import org.apache.cxf.message.Message;
+import org.apache.cxf.transport.Destination;
import org.apache.cxf.transport.http.AbstractHTTPDestination;
+import org.apache.cxf.transport.servlet.ServletDestination;
public final class HttpUtils {
private static final String LOCAL_IP_ADDRESS = "127.0.0.1";
@@ -55,6 +59,46 @@
return u;
}
+ public static String getPathToMatch(Message m) {
+
+ String requestAddress = (String)m.get(Message.REQUEST_URI);
+ String baseAddress = getBaseAddress(m);
+
+ return getPathToMatch(requestAddress, baseAddress);
+ }
+
+ public static String getBaseAddress(Message m) {
+ try {
+ String address = null;
+ Destination d = m.getExchange().getDestination();
+ if (d instanceof ServletDestination) {
+ address =
((ServletDestination)d).getEndpointInfo().getAddress();
+ } else {
+ address = d.getAddress().getAddress().getValue();
+ }
+ return new URL(address).getPath();
+ } catch (MalformedURLException ex) {
+ return (String)m.get(Message.BASE_PATH);
+ }
+ }
+
+ public static String getPathToMatch(String path, String address) {
+
+ int ind = path.indexOf(address);
+ if (ind == 0) {
+ path = path.substring(ind + address.length());
+ }
+ if (!path.startsWith("/")) {
+ path = "/" + path;
+ }
+
+ return path;
+ }
+
+ public static String getOriginalAddress(Message m) {
+ Destination d = m.getDestination();
+ return d == null ? "/" : d.getAddress().getAddress().getValue();
+ }
public static String fromPathSegment(PathSegment ps) {
if (PathSegmentImpl.class.isAssignableFrom(ps.getClass())) {
Modified:
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
(original)
+++
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
Thu Dec 18 10:12:55 2008
@@ -606,7 +606,7 @@
public static ContextResolver<?> createContextResolver(Type genericType,
Message m) {
if (genericType instanceof ParameterizedType) {
- return
ProviderFactory.getInstance((String)m.get(Message.BASE_PATH)).createContextResolver(
+ return
ProviderFactory.getInstance(HttpUtils.getOriginalAddress(m)).createContextResolver(
((ParameterizedType)genericType).getActualTypeArguments()[0], m);
}
return null;
@@ -736,9 +736,8 @@
List<MediaType> types = JAXRSUtils.intersectMimeTypes(consumeTypes,
contentType);
MessageBodyReader provider = null;
-
for (MediaType type : types) {
- provider =
ProviderFactory.getInstance((String)m.get(Message.BASE_PATH))
+ provider =
ProviderFactory.getInstance(HttpUtils.getOriginalAddress(m))
.createMessageBodyReader(targetTypeClass,
parameterType,
parameterAnnotations,
Added:
cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java?rev=727781&view=auto
==============================================================================
---
cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java
(added)
+++
cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java
Thu Dec 18 10:12:55 2008
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.jaxrs.utils;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class HttpUtilsTest extends Assert {
+
+ @Test
+ public void testUpdatePath() {
+ assertEquals("/", HttpUtils.getPathToMatch("/", "/"));
+ assertEquals("/", HttpUtils.getPathToMatch("/", "/bar"));
+ assertEquals("/bar", HttpUtils.getPathToMatch("/bar", "/"));
+
+ assertEquals("/", HttpUtils.getPathToMatch("/bar", "/bar"));
+ assertEquals("/bar", HttpUtils.getPathToMatch("/baz/bar", "/baz"));
+ assertEquals("/baz/bar/foo/",
HttpUtils.getPathToMatch("/baz/bar/foo/", "/bar"));
+
+ }
+
+}
Propchange:
cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
---
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
(original)
+++
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
Thu Dec 18 10:12:55 2008
@@ -21,6 +21,7 @@
import java.io.IOException;
import java.io.OutputStream;
import java.net.URL;
+import java.net.URLDecoder;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
@@ -269,7 +270,16 @@
String reqPrefix = request.getRequestURL().toString();
String pathInfo = request.getPathInfo() == null ? "" :
request.getPathInfo();
//fix for CXF-898
- if (!"/".equals(pathInfo) || reqPrefix.endsWith("/")) {
+ if (!"/".equals(pathInfo) || reqPrefix.endsWith("/")) {
+ // needs to be done given that pathInfo is decoded
+ // TODO :
+ // it's unlikely servlet path will contain encoded values so we're
most likely safe
+ // however we need to ensure if it happens then thsi code works
propely too
+ try {
+ reqPrefix = URLDecoder.decode(reqPrefix, "UTF-8");
+ } catch (Exception ex) {
+ // unlikey to happen
+ }
reqPrefix = reqPrefix.substring(0, reqPrefix.length() -
pathInfo.length());
}
return reqPrefix;
Modified:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpring.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpring.java?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpring.java
(original)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpring.java
Thu Dec 18 10:12:55 2008
@@ -50,7 +50,7 @@
} catch (URISyntaxException e1) {
e1.printStackTrace();
}
- webappcontext.setContextPath("/");
+ webappcontext.setContextPath("/webapp");
webappcontext.setWar(contextPath);
Modified:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpringProviders.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpringProviders.java?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpringProviders.java
(original)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpringProviders.java
Thu Dec 18 10:12:55 2008
@@ -50,7 +50,7 @@
} catch (URISyntaxException e1) {
e1.printStackTrace();
}
- webappcontext.setContextPath("/");
+ webappcontext.setContextPath("/webapp");
webappcontext.setWar(contextPath);
Modified:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerRestSoap.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerRestSoap.java?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerRestSoap.java
(original)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerRestSoap.java
Thu Dec 18 10:12:55 2008
@@ -50,7 +50,7 @@
} catch (URISyntaxException e1) {
e1.printStackTrace();
}
- webappcontext.setContextPath("/");
+ webappcontext.setContextPath("/test");
webappcontext.setWar(contextPath);
Modified:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
(original)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
Thu Dec 18 10:12:55 2008
@@ -40,7 +40,7 @@
@Test
public void testGetThatBook123() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123";
+ "http://localhost:9080/test/bookstorestorage/thosebooks/123";
URL url = new URL(endpointAddress);
URLConnection connect = url.openConnection();
connect.addRequestProperty("Accept", "application/xml");
@@ -56,7 +56,7 @@
@Test
public void testGetThatBookOverloaded() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123/123";
+ "http://localhost:9080/test/bookstorestorage/thosebooks/123/123";
URL url = new URL(endpointAddress);
URLConnection connect = url.openConnection();
connect.addRequestProperty("Accept", "application/xml");
@@ -72,7 +72,7 @@
@Test
public void testGetThatBookOverloaded2() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks";
+ "http://localhost:9080/test/bookstorestorage/thosebooks";
URL url = new URL(endpointAddress);
URLConnection connect = url.openConnection();
connect.addRequestProperty("Accept", "application/xml");
@@ -88,7 +88,7 @@
@Test
public void testGetBook123() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstore/books/123";
+ "http://localhost:9080/test/bookstore/books/123";
URL url = new URL(endpointAddress);
URLConnection connect = url.openConnection();
connect.addRequestProperty("Accept", "application/json");
Modified:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
(original)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
Thu Dec 18 10:12:55 2008
@@ -41,7 +41,7 @@
public void testGetBook123() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstore/books/123";
+ "http://localhost:9080/webapp/bookstore/books/123";
URL url = new URL(endpointAddress);
URLConnection connect = url.openConnection();
connect.addRequestProperty("Accept", "application/xml");
@@ -58,7 +58,7 @@
public void testPetStore() throws Exception {
String endpointAddress =
- "http://localhost:9080/petstore/pets/24";
+ "http://localhost:9080/webapp/petstore/pets/24";
URL url = new URL(endpointAddress);
URLConnection connect = url.openConnection();
connect.addRequestProperty("Accept", "text/xml");
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=727781&r1=727780&r2=727781&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
Thu Dec 18 10:12:55 2008
@@ -44,7 +44,7 @@
public void testGetBook123() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstore/books/123";
+ "http://localhost:9080/webapp/bookstore/books/123";
URL url = new URL(endpointAddress);
URLConnection connect = url.openConnection();
connect.addRequestProperty("Accept", "application/json");
@@ -65,7 +65,7 @@
public void testGetBookNotFound() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstore/books/12345";
+ "http://localhost:9080/webapp/bookstore/books/12345";
URL url = new URL(endpointAddress);
URLConnection connect = url.openConnection();
connect.addRequestProperty("Accept", "application/json");
@@ -84,7 +84,7 @@
public void testPostPetStatus() throws Exception {
String endpointAddress =
- "http://localhost:9080/petstore/pets";
+ "http://localhost:9080/webapp/petstore/pets";
URL url = new URL(endpointAddress);
HttpURLConnection httpUrlConnection =
(HttpURLConnection)url.openConnection();
Modified:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
(original)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
Thu Dec 18 10:12:55 2008
@@ -45,7 +45,7 @@
@Test
public void testGetBookByUriInfo() throws Exception {
String endpointAddress =
- "http://localhost:9080/thebooks/bookstore/bookinfo?"
+ "http://localhost:9080/the/thebooks/bookstore/bookinfo?"
+ "param1=12¶m2=3";
getBook(endpointAddress, "resources/expected_get_book123json.txt");
}
@@ -53,7 +53,7 @@
@Test
public void testGetBook123() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstore/books/123";
+ "http://localhost:9080/the/bookstore/books/123";
getBook(endpointAddress, "resources/expected_get_book123json.txt");
getBook(endpointAddress, "resources/expected_get_book123json.txt",
"application/jettison");
@@ -61,7 +61,7 @@
@Test
public void testGetBookAsArray() throws Exception {
- URL url = new URL("http://localhost:9080/bookstore/books/list/123");
+ URL url = new
URL("http://localhost:9080/the/bookstore/books/list/123");
URLConnection connect = url.openConnection();
connect.addRequestProperty("Accept", "application/json");
InputStream in = connect.getInputStream();
@@ -74,21 +74,21 @@
@Test
public void testGetBookWithEncodedQueryValue() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstore/booksquery?id=12%2B3";
+ "http://localhost:9080/the/bookstore/booksquery?id=12%2B3";
getBook(endpointAddress, "resources/expected_get_book123json.txt");
}
@Test
public void testGetBookWithEncodedPathValue() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstore/id=12%2B3";
+ "http://localhost:9080/the/bookstore/id=12%2B3";
getBook(endpointAddress, "resources/expected_get_book123json.txt");
}
@Test
public void testGetDefaultBook() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstore";
+ "http://localhost:9080/the/bookstore";
getBook(endpointAddress, "resources/expected_get_book123json.txt");
}
@@ -109,13 +109,13 @@
@Test
public void testAddInvalidXmlBook() throws Exception {
- doPost("http://localhost:9080/bookstore/books/convert",
+ doPost("http://localhost:9080/the/bookstore/books/convert",
500,
"application/xml",
"resources/add_book.txt",
null);
- doPost("http://localhost:9080/thebooks/bookstore/books/convert",
+ doPost("http://localhost:9080/the/thebooks/bookstore/books/convert",
500,
"application/xml",
"resources/add_book.txt",
@@ -126,13 +126,13 @@
@Test
public void testAddInvalidJsonBook() throws Exception {
- doPost("http://localhost:9080/bookstore/books/convert",
+ doPost("http://localhost:9080/the/bookstore/books/convert",
500,
"application/json",
"resources/add_book2json_invalid.txt",
null);
- doPost("http://localhost:9080/thebooks/bookstore/books/convert",
+ doPost("http://localhost:9080/the/thebooks/bookstore/books/convert",
500,
"application/json",
"resources/add_book2json_invalid.txt",
@@ -143,13 +143,13 @@
@Test
public void testAddValidXmlBook() throws Exception {
- doPost("http://localhost:9080/bookstore/books/convert",
+ doPost("http://localhost:9080/the/bookstore/books/convert",
200,
"application/xml",
"resources/add_book2.txt",
"resources/expected_get_book123.txt");
- doPost("http://localhost:9080/thebooks/bookstore/books/convert",
+ doPost("http://localhost:9080/the/thebooks/bookstore/books/convert",
200,
"application/xml",
"resources/add_book2.txt",
@@ -159,19 +159,19 @@
@Test
public void testAddValidBookJson() throws Exception {
- doPost("http://localhost:9080/bookstore/books/convert",
+ doPost("http://localhost:9080/the/bookstore/books/convert",
200,
"application/json",
"resources/add_book2json.txt",
"resources/expected_get_book123.txt");
- doPost("http://localhost:9080/thebooks/bookstore/books/convert",
+ doPost("http://localhost:9080/the/thebooks/bookstore/books/convert",
200,
"application/json",
"resources/add_book2json.txt",
"resources/expected_get_book123.txt");
- doPost("http://localhost:9080/thebooks/bookstore/books/convert",
+ doPost("http://localhost:9080/the/thebooks/bookstore/books/convert",
200,
"application/jettison",
"resources/add_book2json.txt",
Modified:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JaxRsJaxWsBookTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JaxRsJaxWsBookTest.java?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JaxRsJaxWsBookTest.java
(original)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JaxRsJaxWsBookTest.java
Thu Dec 18 10:12:55 2008
@@ -47,7 +47,7 @@
@Test
public void testGetBook123() throws Exception {
- InputStream in =
getRestInputStream("http://localhost:9092/rest/bookstore/123");
+ InputStream in =
getRestInputStream("http://localhost:9092/test/services/rest/bookstore/123");
InputStream expected =
getClass().getResourceAsStream("resources/expected_get_book123.txt");
assertEquals(getStringFromInputStream(expected),
getStringFromInputStream(in));
@@ -58,7 +58,7 @@
public void testAddGetBookRest() throws Exception {
String endpointAddress =
- "http://localhost:9092/rest/bookstore/books";
+ "http://localhost:9092/test/services/rest/bookstore/books";
File input = new
File(getClass().getResource("resources/add_book.txt").toURI());
PostMethod post = new PostMethod(endpointAddress);
@@ -84,7 +84,7 @@
@Test
public void testGetBookSoap() throws Exception {
String wsdlAddress =
- "http://localhost:9092/soap/bookservice?wsdl";
+ "http://localhost:9092/test/services/soap/bookservice?wsdl";
URL wsdlUrl = new URL(wsdlAddress);
BookSoapService service =
new BookSoapService(wsdlUrl,
Modified: cxf/trunk/systests/src/test/resources/jaxrs/WEB-INF/web.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/resources/jaxrs/WEB-INF/web.xml?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/resources/jaxrs/WEB-INF/web.xml (original)
+++ cxf/trunk/systests/src/test/resources/jaxrs/WEB-INF/web.xml Thu Dec 18
10:12:55 2008
@@ -46,7 +46,7 @@
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
- <url-pattern>/*</url-pattern>
+ <url-pattern>/the/*</url-pattern>
</servlet-mapping>
</web-app>
<!-- END SNIPPET: webxml -->
\ No newline at end of file
Modified: cxf/trunk/systests/src/test/resources/jaxrs_proxy/WEB-INF/web.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/resources/jaxrs_proxy/WEB-INF/web.xml?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/resources/jaxrs_proxy/WEB-INF/web.xml (original)
+++ cxf/trunk/systests/src/test/resources/jaxrs_proxy/WEB-INF/web.xml Thu Dec
18 10:12:55 2008
@@ -44,7 +44,7 @@
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
- <url-pattern>/*</url-pattern>
+ <url-pattern>/test/*</url-pattern>
</servlet-mapping>
</web-app>
<!-- END SNIPPET: webxml -->
Modified:
cxf/trunk/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml
(original)
+++ cxf/trunk/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml Thu
Dec 18 10:12:55 2008
@@ -29,15 +29,22 @@
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd">
- <jaxws:endpoint xmlns:s="http://books.com"
+ <import resource="classpath:META-INF/cxf/cxf.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
+
+
+ <jaxws:endpoint xmlns:s="http://books.com"
serviceName="s:BookService"
endpointName="s:BookPort"
id="soapservice"
implementor="#bookstore"
- address="http://localhost:9092/soap/bookservice" />
-
+ address="/soap/bookservice" />
+
<jaxrs:server id="restservice"
- address="http://localhost:9092/rest">
+ address="/rest">
<jaxrs:serviceBeans>
<ref bean="bookstore"/>
</jaxrs:serviceBeans>
Modified: cxf/trunk/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/web.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/web.xml?rev=727781&r1=727780&r2=727781&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/web.xml
(original)
+++ cxf/trunk/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/web.xml Thu
Dec 18 10:12:55 2008
@@ -46,7 +46,7 @@
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
- <url-pattern>/*</url-pattern>
+ <url-pattern>/services/*</url-pattern>
</servlet-mapping>
</web-app>
<!-- END SNIPPET: webxml -->
\ No newline at end of file