Author: sergeyb
Date: Fri Dec 19 04:31:41 2008
New Revision: 728009
URL: http://svn.apache.org/viewvc?rev=728009&view=rev
Log:
Merged revisions 727781 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r727781 | sergeyb | 2008-12-18 18:12:55 +0000 (Thu, 18 Dec 2008) | 1 line
JAXRS : fixing resource resolution issues
........
Added:
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java
- copied unchanged from r727781,
cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java
Modified:
cxf/branches/2.1.x-fixes/ (props changed)
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpring.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpringProviders.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerRestSoap.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JaxRsJaxWsBookTest.java
cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs/WEB-INF/web.xml
cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_proxy/WEB-INF/web.xml
cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml
cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/web.xml
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Dec 19 04:31:41 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,708044,708074,708410,708417,708550,708554,709353-709354,709425,710076,710150,71015
4,711193,711388,711410,711490,711635,711949,711975,712194,712198,712238,712272,712299,712312,712670,712893,713082,713095-713096,713099,713584,713597,713737,713804,713899,714167-714168,714245,714255,717937-717961,718281-718448,718565,718620,718640,718665,718970,719017,719210,719215-719218,719222-719273,719305,719327-719680,720053,720119-720218,720238,720293-720316,720497,721221,721241,721501,722117,722129,722412,722988,723024,723338,723378,723716-723791,724333-724372,724433-724438,724449,724481,724485,724668,724780,724782,724785,724793,724795,724940,725071,725316,725332,725335,725348,725364,725418,725425-725426,725455,725506,725554,725562,725651,725671,725688,725754,725773,725799,725839,726342,726524,726631,726634,726637,726639,726692,726724,726769,726992,727096,727445,727521,727568,727692,727754,727792
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,708044,708074,708410,708417,708550,708554,709353-709354,709425,710076,710150,71015
4,711193,711388,711410,711490,711635,711949,711975,712194,712198,712238,712272,712299,712312,712670,712893,713082,713095-713096,713099,713584,713597,713737,713804,713899,714167-714168,714245,714255,717937-717961,718281-718448,718565,718620,718640,718665,718970,719017,719210,719215-719218,719222-719273,719305,719327-719680,720053,720119-720218,720238,720293-720316,720497,721221,721241,721501,722117,722129,722412,722988,723024,723338,723378,723716-723791,724333-724372,724433-724438,724449,724481,724485,724668,724780,724782,724785,724793,724795,724940,725071,725316,725332,725335,725348,725364,725418,725425-725426,725455,725506,725554,725562,725651,725671,725688,725754,725773,725799,725839,726342,726524,726631,726634,726637,726639,726692,726724,726769,726992,727096,727445,727521,727568,727692,727754,727781,727792
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
Fri Dec 19 04:31:41 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/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
Fri Dec 19 04:31:41 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,9 +98,8 @@
if (requestContentType == null) {
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);
@@ -148,7 +132,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/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
Fri Dec 19 04:31:41 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/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
Fri Dec 19 04:31:41 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/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
Fri Dec 19 04:31:41 2008
@@ -572,7 +572,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;
@@ -702,9 +702,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,
Modified:
cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
Fri Dec 19 04:31:41 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/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpring.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpring.java?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpring.java
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpring.java
Fri Dec 19 04:31:41 2008
@@ -50,7 +50,7 @@
} catch (URISyntaxException e1) {
e1.printStackTrace();
}
- webappcontext.setContextPath("/");
+ webappcontext.setContextPath("/webapp");
webappcontext.setWar(contextPath);
Modified:
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpringProviders.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpringProviders.java?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpringProviders.java
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerResourceCreatedSpringProviders.java
Fri Dec 19 04:31:41 2008
@@ -50,7 +50,7 @@
} catch (URISyntaxException e1) {
e1.printStackTrace();
}
- webappcontext.setContextPath("/");
+ webappcontext.setContextPath("/webapp");
webappcontext.setWar(contextPath);
Modified:
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerRestSoap.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerRestSoap.java?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerRestSoap.java
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServerRestSoap.java
Fri Dec 19 04:31:41 2008
@@ -50,7 +50,7 @@
} catch (URISyntaxException e1) {
e1.printStackTrace();
}
- webappcontext.setContextPath("/");
+ webappcontext.setContextPath("/test");
webappcontext.setWar(contextPath);
Modified:
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
Fri Dec 19 04:31:41 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/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
Fri Dec 19 04:31:41 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/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
Fri Dec 19 04:31:41 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/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
Fri Dec 19 04:31:41 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/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JaxRsJaxWsBookTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JaxRsJaxWsBookTest.java?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JaxRsJaxWsBookTest.java
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JaxRsJaxWsBookTest.java
Fri Dec 19 04:31:41 2008
@@ -46,16 +46,15 @@
@Test
public void testGetBook123() throws Exception {
+
String endpointAddress =
- "http://localhost:9092/rest/bookstore/123";
+ "http://localhost:9092/test/services/rest/bookstore/123";
URL url = new URL(endpointAddress);
URLConnection connect = url.openConnection();
connect.addRequestProperty("Accept", "application/xml");
InputStream in = connect.getInputStream();
-
- InputStream expected = getClass()
- .getResourceAsStream("resources/expected_get_book123.txt");
-
+
+ InputStream expected =
getClass().getResourceAsStream("resources/expected_get_book123.txt");
assertEquals(getStringFromInputStream(expected),
getStringFromInputStream(in));
}
@@ -63,7 +62,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);
@@ -89,7 +88,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/branches/2.1.x-fixes/systests/src/test/resources/jaxrs/WEB-INF/web.xml
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs/WEB-INF/web.xml?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs/WEB-INF/web.xml
(original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs/WEB-INF/web.xml
Fri Dec 19 04:31:41 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/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_proxy/WEB-INF/web.xml
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_proxy/WEB-INF/web.xml?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_proxy/WEB-INF/web.xml
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_proxy/WEB-INF/web.xml
Fri Dec 19 04:31:41 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/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml
Fri Dec 19 04:31:41 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/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/web.xml
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/web.xml?rev=728009&r1=728008&r2=728009&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/web.xml
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/web.xml
Fri Dec 19 04:31:41 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