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/03/19 18:12:19 UTC
svn commit: r756098 - in /cxf/branches/2.1.x-fixes: ./
rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/
rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/
rt/frontend/jaxrs/src/main/ja...
Author: sergeyb
Date: Thu Mar 19 17:12:17 2009
New Revision: 756098
URL: http://svn.apache.org/viewvc?rev=756098&view=rev
Log:
Merged revisions 749596,749963,750010 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r749596 | sergeyb | 2009-03-03 12:27:15 +0000 (Tue, 03 Mar 2009) | 1 line
JAXRS : CXF-2031,CXF-2080 plus some more fixes/clean-up
........
r749963 | sergeyb | 2009-03-04 11:07:50 +0000 (Wed, 04 Mar 2009) | 1 line
JAXRS: CXF-2058 plus support for XmlJavaTypeAdapter on the inbound path
........
r750010 | sergeyb | 2009-03-04 13:53:46 +0000 (Wed, 04 Mar 2009) | 1 line
JAXRS: handling early exceptions which might be thrown by MessageBodyWriters
........
Added:
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/SystemQueryHandler.java
- copied unchanged from r749596, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/SystemQueryHandler.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/SystemQueryHandlerTest.java
- copied unchanged from r749596, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/SystemQueryHandlerTest.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/fortest/jaxb/
- copied from r749963, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/fortest/jaxb/
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/fortest/jaxb/Book.java
- copied unchanged from r749963, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/fortest/jaxb/Book.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/fortest/jaxb/ObjectFactory.java
- copied unchanged from r749963, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/fortest/jaxb/ObjectFactory.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/AtomBookStore3.java
- copied unchanged from r749596, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/AtomBookStore3.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/attachmentData
- copied unchanged from r749596, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/attachmentData
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/attachmentData2
- copied unchanged from r749596, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/attachmentData2
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/attachmentData3
- copied unchanged from r749596, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/attachmentData3
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/attachmentForm
- copied unchanged from r749596, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/attachmentForm
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/book.xsd
- copied unchanged from r749596, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/book.xsd
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/bookid.xsd
- copied unchanged from r749596, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/bookid.xsd
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_book_json2.txt
- copied unchanged from r749596, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_book_json2.txt
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_book_json3.txt
- copied unchanged from r749596, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_book_json3.txt
Removed:
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MappingsHandler.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/attachmentData
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/attachmentData2
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/attachmentData3
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/attachmentForm
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/book.xsd
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/bookid.xsd
Modified:
cxf/branches/2.1.x-fixes/ (props changed)
cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java (props changed)
cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBWrapperHelperTest.java (props changed)
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProvider.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.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/provider/AbstractJAXBProvider.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.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/InjectionUtils.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/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProviderTest.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.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/AtomBookStore.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/AtomBookStore2.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_book_json.txt
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_books_json.txt
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_books_jsonfeed.txt
cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs/WEB-INF/beans.xml
cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_atom/WEB-INF/beans.xml
cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_atom/WEB-INF/web.xml
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 19 17:12:17 2009
@@ -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,727781,727792,728070,728087,728696,728897,729051,729430,729449,729460,729863,730082,730139,730889,730891,731598,731604,731615,731631,731635,732036,732050,732320,732363,732411,732450,
732710,732773,732827,732829,733512,733582,733901,734367,734462,734666,734762,734772,734812,734836,734965,735113,735252,735722-735723,735729,735734,735751,735782,735787,735987,736332,736343,736352,736358-736362,736408,736423,736448,736491,736621,736726,736736,736738-736739,736766,736825,736852,737032,737046,737061,737069,737124,737237,737246,737299,737356,737494,737498,737761,737817,737849,737855,737994,738166,738178,738201,738210,738242,738244,738265,738516,738583,738863,738937,738983,739366-739367,739451-739452,739799-739800,739867,739876-739877,739922,739937,739990,740045,740108,740154,740186,740197,740255,740706,740730,740810,740844,740886,740902,740923,740994,741058,741124,741152,741188,741521,741529,741879,742914,743087,743439,743441,743459,743469,743825,743965,743967,744104-744138,744175,744195,744237,744756,745214,745243,745472,745474,745560,745578,745586,745592,745638,745950,746012,746019-746020,746256,746266,746306,746357,746373-746374,746947,747026,747070,747217,74
7386,747390,747406-747407,747454,747649,747766,747806-747846,747986,748159,748192-748193,748223,748305,748313,748597,748603-748604,748768,749420,749449,749454-749456,749505,749511,749513,749584,749767,749771,749799,749890,750059-750060,750302,750591,750689,750935,751067-751110,751233,751527,751567,751576,751607,751732,751740,751787,751828,751840,751972-751974,752122,752132,752136,752558,752613,752680,752728,752753,752849,752880-752881,752883,752961,752992,753205,753293,753335,753338,753388,755153,755514,755806
+/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,728070,728087,728696,728897,729051,729430,729449,729460,729863,730082,730139,730889,730891,731598,731604,731615,731631,731635,732036,732050,732320,732363,732411,732450,
732710,732773,732827,732829,733512,733582,733901,734367,734462,734666,734762,734772,734812,734836,734965,735113,735252,735722-735723,735729,735734,735751,735782,735787,735987,736332,736343,736352,736358-736362,736408,736423,736448,736491,736621,736726,736736,736738-736739,736766,736825,736852,737032,737046,737061,737069,737124,737237,737246,737299,737356,737494,737498,737761,737817,737849,737855,737994,738166,738178,738201,738210,738242,738244,738265,738516,738583,738863,738937,738983,739366-739367,739451-739452,739799-739800,739867,739876-739877,739922,739937,739990,740045,740108,740154,740186,740197,740255,740706,740730,740810,740844,740886,740902,740923,740994,741058,741124,741152,741188,741521,741529,741879,742914,743087,743439,743441,743459,743469,743825,743965,743967,744104-744138,744175,744195,744237,744756,745214,745243,745472,745474,745560,745578,745586,745592,745638,745950,746012,746019-746020,746256,746266,746306,746357,746373-746374,746947,747026,747070,747217,74
7386,747390,747406-747407,747454,747649,747766,747806-747846,747986,748159,748192-748193,748223,748305,748313,748597,748603-748604,748768,749420,749449,749454-749456,749505,749511,749513,749584,749596,749767,749771,749799,749890,749963,750010,750059-750060,750302,750591,750689,750935,751067-751110,751233,751527,751567,751576,751607,751732,751740,751787,751828,751840,751972-751974,752122,752132,752136,752558,752613,752680,752728,752753,752849,752880-752881,752883,752961,752992,753205,753293,753335,753338,753388,755153,755514,755806
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Propchange: cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 19 17:12:17 2009
@@ -1 +1 @@
-/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java:743825,744104-744138,745472,745474,746947,747026,747070,747390,747407,747806-747846,748193,748597,755514,755806
+/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java:743825,744104-744138,745472,745474,746947,747026,747070,747390,747407,747806-747846,748193,748597,749596,749963,750010,755514,755806
Propchange: cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBWrapperHelperTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 19 17:12:17 2009
@@ -1 +1 @@
-/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBWrapperHelperTest.java:743825,744104-744138,745472,745474,746947,747026,747070,747390,747407,747806-747846,748193,748597,755514,755806
+/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBWrapperHelperTest.java:743825,744104-744138,745472,745474,746947,747026,747070,747390,747407,747806-747846,748193,748597,749596,749963,750010,755514,755806
Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProvider.java?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProvider.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProvider.java Thu Mar 19 17:12:17 2009
@@ -22,6 +22,7 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import javax.ws.rs.core.CacheControl;
import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate;
@@ -96,27 +97,13 @@
public String toString(CacheControl c) {
StringBuilder sb = new StringBuilder();
- if (c.isPublic()) {
- sb.append(PUBLIC).append(';');
- } else {
- sb.append(PRIVATE).append('=');
- for (Iterator<String> it = c.getPrivateFields().iterator(); it.hasNext();) {
- sb.append('\"').append(it.next()).append('\"');
- if (it.hasNext()) {
- sb.append(',');
- }
- }
- sb.append(';');
+ if (c.isPrivate()) {
+ sb.append(PRIVATE);
+ handleFields(c.getPrivateFields(), sb);
}
if (c.isNoCache()) {
- sb.append(NO_CACHE).append('=');
- for (Iterator<String> it = c.getNoCacheFields().iterator(); it.hasNext();) {
- sb.append('\"').append(it.next()).append('\"');
- if (it.hasNext()) {
- sb.append(',');
- }
- }
- sb.append(';');
+ sb.append(NO_CACHE);
+ handleFields(c.getNoCacheFields(), sb);
}
if (c.isNoStore()) {
sb.append(NO_STORE).append(';');
@@ -136,6 +123,20 @@
if (c.getSMaxAge() != -1) {
sb.append(SMAX_AGE).append('=').append(c.getSMaxAge()).append(';');
}
+ Map<String, String> exts = c.getCacheExtension();
+ for (Map.Entry<String, String> entry : exts.entrySet()) {
+ sb.append(entry.getKey());
+ String v = entry.getValue();
+ if (v != null) {
+ sb.append("=");
+ if (v.indexOf(' ') != -1) {
+ sb.append('\"').append(v).append('\"');
+ } else {
+ sb.append(v);
+ }
+ }
+ sb.append(';');
+ }
String s = sb.toString();
return s.endsWith(";") ? s.substring(0, s.length() - 1) : s;
}
@@ -156,4 +157,16 @@
}
}
+ private static void handleFields(List<String> fields, StringBuilder sb) {
+ if (!fields.isEmpty()) {
+ sb.append('=');
+ }
+ for (Iterator<String> it = fields.iterator(); it.hasNext();) {
+ sb.append('\"').append(it.next()).append('\"');
+ if (it.hasNext()) {
+ sb.append(',');
+ }
+ }
+ sb.append(';');
+ }
}
Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java Thu Mar 19 17:12:17 2009
@@ -25,6 +25,7 @@
import javax.ws.rs.core.UriInfo;
+import org.apache.cxf.jaxrs.utils.HttpUtils;
import org.apache.cxf.message.Message;
public class RequestPreprocessor {
@@ -89,7 +90,8 @@
private void updatePath(Message m, String path, String suffix) {
String newPath = path.substring(0, path.length() - (suffix.length() + 1));
- m.put(Message.REQUEST_URI, newPath);
+ HttpUtils.updatePath(m, newPath);
+ //m.put(Message.REQUEST_URI, newPath);
}
}
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=756098&r1=756097&r2=756098&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 Thu Mar 19 17:12:17 2009
@@ -73,7 +73,6 @@
}
- @SuppressWarnings("unchecked")
private void processResponse(Message message, String baseAddress) {
MessageContentsList objs = MessageContentsList.getContentsList(message);
@@ -91,90 +90,120 @@
}
Exchange exchange = message.getExchange();
- OperationResourceInfo operation = (OperationResourceInfo)exchange.get(OperationResourceInfo.class
+ OperationResourceInfo ori = (OperationResourceInfo)exchange.get(OperationResourceInfo.class
.getName());
List<ProviderInfo<ResponseHandler>> handlers =
ProviderFactory.getInstance(baseAddress).getResponseHandlers();
for (ProviderInfo<ResponseHandler> rh : handlers) {
- Response r = rh.getProvider().handleResponse(message, operation, response);
+ Response r = rh.getProvider().handleResponse(message, ori, response);
if (r != null) {
response = r;
}
}
- message.put(Message.RESPONSE_CODE, response.getStatus());
- message.put(Message.PROTOCOL_HEADERS, response.getMetadata());
-
- responseObj = response.getEntity();
- if (responseObj == null) {
- return;
- }
+ serializeMessage(message, response, ori, baseAddress, true);
- Class targetType = responseObj.getClass();
- List<MediaType> availableContentTypes =
- computeAvailableContentTypes(message, response);
-
- Method invoked = operation == null ? null : operation.getMethodToInvoke();
-
- MessageBodyWriter writer = null;
- MediaType responseType = null;
- for (MediaType type : availableContentTypes) {
- writer = ProviderFactory.getInstance(baseAddress)
- .createMessageBodyWriter(targetType,
- invoked != null ? invoked.getGenericReturnType() : null,
- invoked != null ? invoked.getAnnotations() : new Annotation[]{},
- type,
- exchange.getInMessage());
-
- if (writer != null) {
- responseType = type;
- break;
- }
- }
+ } else {
+ message.put(Message.RESPONSE_CODE, 204);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void serializeMessage(Message message,
+ Response response,
+ OperationResourceInfo ori,
+ String baseAddress,
+ boolean firstTry) {
+ message.put(Message.RESPONSE_CODE, response.getStatus());
+ message.put(Message.PROTOCOL_HEADERS, response.getMetadata());
+
+ Object responseObj = response.getEntity();
+ if (responseObj == null) {
+ return;
+ }
+
+ Class targetType = responseObj.getClass();
+ List<MediaType> availableContentTypes =
+ computeAvailableContentTypes(message, response);
+
+ Method invoked = ori == null ? null : ori.getMethodToInvoke();
- OutputStream out = message.getContent(OutputStream.class);
- if (writer == null) {
- message.put(Message.RESPONSE_CODE, 500);
- writeResponseErrorMessage(out,
- "NO_MSG_WRITER",
- invoked != null ? invoked.getReturnType().getSimpleName() : "");
- return;
+ MessageBodyWriter writer = null;
+ MediaType responseType = null;
+ for (MediaType type : availableContentTypes) {
+ writer = ProviderFactory.getInstance(baseAddress)
+ .createMessageBodyWriter(targetType,
+ invoked != null ? invoked.getGenericReturnType() : null,
+ invoked != null ? invoked.getAnnotations() : new Annotation[]{},
+ type,
+ message.getExchange().getInMessage());
+
+ if (writer != null) {
+ responseType = type;
+ break;
}
+ }
+
+ OutputStream out = message.getContent(OutputStream.class);
+ if (writer == null) {
+ message.put(Message.RESPONSE_CODE, 500);
+ writeResponseErrorMessage(out,
+ "NO_MSG_WRITER",
+ invoked != null ? invoked.getReturnType().getSimpleName() : "");
+ return;
+ }
+
+ try {
- try {
-
- responseType = checkFinalContentType(responseType);
- LOG.fine("Response content type is: " + responseType.toString());
- message.put(Message.CONTENT_TYPE, responseType.toString());
-
- LOG.fine("Response EntityProvider is: " + writer.getClass().getName());
- writer.writeTo(responseObj, targetType, invoked.getGenericReturnType(),
- invoked != null ? invoked.getAnnotations() : new Annotation[]{},
- responseType,
- response.getMetadata(),
- out);
-
- } catch (IOException e) {
- e.printStackTrace();
- message.put(Message.RESPONSE_CODE, 500);
- writeResponseErrorMessage(out, "SERIALIZE_ERROR",
- responseObj.getClass().getSimpleName());
- }
-
- } else {
- message.put(Message.RESPONSE_CODE, 204);
+ responseType = checkFinalContentType(responseType);
+ LOG.fine("Response content type is: " + responseType.toString());
+ message.put(Message.CONTENT_TYPE, responseType.toString());
+
+ LOG.fine("Response EntityProvider is: " + writer.getClass().getName());
+ writer.writeTo(responseObj, targetType, invoked.getGenericReturnType(),
+ invoked != null ? invoked.getAnnotations() : new Annotation[]{},
+ responseType,
+ response.getMetadata(),
+ out);
+
+ } catch (IOException ex) {
+ handleWriteException(message, response, ori, baseAddress, ex, responseObj, firstTry);
+ } catch (Exception ex) {
+ handleWriteException(message, response, ori, baseAddress, ex, responseObj, firstTry);
}
}
+ private void handleWriteException(Message message,
+ Response response,
+ OperationResourceInfo ori,
+ String baseAddress,
+ Exception ex,
+ Object responseObj,
+ boolean firstTry) {
+ OutputStream out = message.getContent(OutputStream.class);
+ if (firstTry) {
+ Response excResponse = JAXRSUtils.convertFaultToResponse(ex, baseAddress, message);
+ if (excResponse != null) {
+ serializeMessage(message, excResponse, ori, baseAddress, false);
+ }
+ } else {
+ message.put(Message.RESPONSE_CODE, 500);
+ writeResponseErrorMessage(out, "SERIALIZE_ERROR",
+ responseObj.getClass().getSimpleName());
+ }
+ }
+
private void writeResponseErrorMessage(OutputStream out, String errorString,
String parameter) {
try {
- out.write(new org.apache.cxf.common.i18n.Message(errorString,
- BUNDLE,
- parameter
- ).toString().getBytes("UTF-8"));
+ org.apache.cxf.common.i18n.Message message =
+ new org.apache.cxf.common.i18n.Message(errorString,
+ BUNDLE,
+ parameter);
+ LOG.warning(message.toString());
+ out.write(message.toString().getBytes("UTF-8"));
} catch (IOException another) {
// ignore
}
Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java Thu Mar 19 17:12:17 2009
@@ -70,8 +70,7 @@
}
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] anns) {
- return isSupported(type, genericType, anns)
- || AnnotationUtils.getAnnotation(anns, XmlJavaTypeAdapter.class) != null;
+ return isSupported(type, genericType, anns);
}
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations) {
@@ -134,7 +133,7 @@
}
}
- private JAXBContext getPackageContext(Class<?> type) {
+ protected JAXBContext getPackageContext(Class<?> type) {
if (type == null) {
return null;
}
@@ -145,27 +144,38 @@
try {
context = JAXBContext.newInstance(packageName, type.getClassLoader());
packageContexts.put(packageName, context);
- return context;
} catch (JAXBException ex) {
LOG.fine("Error creating a JAXBContext using ObjectFactory : "
+ ex.getMessage());
return null;
}
}
+ return context;
}
- return null;
}
- protected boolean isSupported(Class<?> type, Type genericType, Annotation[] annotations) {
+ protected boolean isSupported(Class<?> type, Type genericType, Annotation[] anns) {
+ // TODO : Shall we just return true and let readFrom/writeTo
+ // fail if JAXB can't handle a given type ?
+
+ // TODO: still not checked :
+ // - XmlJavaTypeAdapter at package level
+ // - anything else ?
return type.getAnnotation(XmlRootElement.class) != null
|| JAXBElement.class.isAssignableFrom(type)
|| objectFactoryForClass(type)
- || (type != genericType && objectFactoryForType(genericType));
+ || (type != genericType && objectFactoryForType(genericType))
+ || adapterAvailable(type, anns);
+
+ }
+ protected boolean adapterAvailable(Class<?> type, Annotation[] anns) {
+ return AnnotationUtils.getAnnotation(anns, XmlJavaTypeAdapter.class) != null
+ || type.getAnnotation(XmlJavaTypeAdapter.class) != null;
}
- private boolean objectFactoryForClass(Class<?> type) {
+ protected boolean objectFactoryForClass(Class<?> type) {
try {
return type.getClassLoader().loadClass(PackageUtils.getPackageName(type)
+ ".ObjectFactory") != null;
@@ -202,24 +212,39 @@
return marshaller;
}
- protected Class<?> getActualType(Class<?> type, Type genericType) {
+ protected Class<?> getActualType(Class<?> type, Type genericType, Annotation[] anns) {
Class<?> theType = null;
if (JAXBElement.class.isAssignableFrom(type)) {
theType = InjectionUtils.getActualType(genericType);
} else {
theType = type;
}
+ XmlJavaTypeAdapter adapter = getAdapter(theType, anns);
+ if (adapter != null) {
+ if (adapter.type() != XmlJavaTypeAdapter.DEFAULT.class) {
+ theType = adapter.type();
+ } else {
+ Type[] types = InjectionUtils.getActualTypes(adapter.value().getGenericSuperclass());
+ if (types != null && types.length == 2) {
+ theType = (Class)types[0];
+ }
+ }
+ }
return theType;
}
@SuppressWarnings("unchecked")
- protected Object checkAdapter(Object obj, Annotation[] anns) {
- XmlJavaTypeAdapter typeAdapter = AnnotationUtils.getAnnotation(anns, XmlJavaTypeAdapter.class);
+ protected Object checkAdapter(Object obj, Annotation[] anns, boolean marshal) {
+ XmlJavaTypeAdapter typeAdapter = getAdapter(obj.getClass(), anns);
if (typeAdapter != null) {
try {
XmlAdapter xmlAdapter = typeAdapter.value().newInstance();
- return xmlAdapter.marshal(obj);
+ if (marshal) {
+ return xmlAdapter.marshal(obj);
+ } else {
+ return xmlAdapter.unmarshal(obj);
+ }
} catch (Exception ex) {
LOG.warning("Problem using the XmlJavaTypeAdapter");
ex.printStackTrace();
@@ -228,9 +253,24 @@
return obj;
}
+ protected XmlJavaTypeAdapter getAdapter(Class<?> type, Annotation[] anns) {
+ XmlJavaTypeAdapter typeAdapter = AnnotationUtils.getAnnotation(anns, XmlJavaTypeAdapter.class);
+ if (typeAdapter == null) {
+ typeAdapter = type.getAnnotation(XmlJavaTypeAdapter.class);
+ }
+ return typeAdapter;
+ }
+
+
protected Schema getSchema() {
return schema;
}
+
+
+ static void clearContexts() {
+ classContexts.clear();
+ packageContexts.clear();
+ }
protected static void handleJAXBException(JAXBException e) {
Throwable t = e.getLinkedException() != null
Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java Thu Mar 19 17:12:17 2009
@@ -84,14 +84,17 @@
MultivaluedMap<String, String> headers, InputStream is)
throws IOException {
try {
- Class<?> theType = getActualType(type, genericType);
+ Class<?> theType = getActualType(type, genericType, anns);
Unmarshaller unmarshaller = createUnmarshaller(theType, genericType);
+ Object response = null;
if (JAXBElement.class.isAssignableFrom(type)) {
- return unmarshaller.unmarshal(new StreamSource(is), theType);
+ response = unmarshaller.unmarshal(new StreamSource(is), theType);
} else {
- return unmarshaller.unmarshal(is);
+ response = unmarshaller.unmarshal(is);
}
+ response = checkAdapter(response, anns, false);
+ return response;
} catch (JAXBException e) {
handleJAXBException(e);
@@ -109,7 +112,7 @@
MediaType m, MultivaluedMap<String, Object> headers, OutputStream os)
throws IOException {
try {
- Object actualObject = checkAdapter(obj, anns);
+ Object actualObject = checkAdapter(obj, anns, true);
Class<?> actualClass = actualObject.getClass();
if (cls == genericType) {
genericType = actualClass;
@@ -122,6 +125,10 @@
} catch (JAXBException e) {
throw new WebApplicationException(e);
+ } catch (WebApplicationException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new WebApplicationException(e);
}
}
Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java Thu Mar 19 17:12:17 2009
@@ -103,7 +103,8 @@
throws IOException {
try {
- Class<?> theType = getActualType(type, genericType);
+ Class<?> theType = getActualType(type, genericType, anns);
+
Unmarshaller unmarshaller = createUnmarshaller(theType, genericType);
MappedXMLInputFactory factory = new MappedXMLInputFactory(namespaceMap);
@@ -114,6 +115,7 @@
} else {
response = unmarshaller.unmarshal(xsw);
}
+ response = checkAdapter(response, anns, false);
return response;
} catch (JAXBException e) {
@@ -134,7 +136,7 @@
throws IOException {
try {
- Object actualObject = checkAdapter(obj, anns);
+ Object actualObject = checkAdapter(obj, anns, true);
Class<?> actualClass = actualObject.getClass();
if (cls == genericType) {
genericType = actualClass;
@@ -164,6 +166,8 @@
throw new WebApplicationException(e);
} catch (XMLStreamException e) {
throw new WebApplicationException(e);
+ } catch (Exception e) {
+ throw new WebApplicationException(e);
}
}
Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java Thu Mar 19 17:12:17 2009
@@ -38,10 +38,10 @@
import javax.ws.rs.ext.MessageBodyWriter;
import org.apache.cxf.jaxrs.client.ResponseExceptionMapper;
-import org.apache.cxf.jaxrs.ext.MappingsHandler;
import org.apache.cxf.jaxrs.ext.ParameterHandler;
import org.apache.cxf.jaxrs.ext.RequestHandler;
import org.apache.cxf.jaxrs.ext.ResponseHandler;
+import org.apache.cxf.jaxrs.ext.SystemQueryHandler;
import org.apache.cxf.jaxrs.impl.RequestPreprocessor;
import org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper;
import org.apache.cxf.jaxrs.model.ProviderInfo;
@@ -66,7 +66,7 @@
new PrimitiveTextProvider(),
new ActivationProvider(),
new WebApplicationExceptionMapper(),
- new MappingsHandler());
+ new SystemQueryHandler());
}
private List<ProviderInfo<MessageBodyReader>> messageReaders =
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=756098&r1=756097&r2=756098&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 Thu Mar 19 17:12:17 2009
@@ -103,6 +103,19 @@
return address;
}
+ public static void updatePath(Message m, String path) {
+ String baseAddress = getBaseAddress(m);
+ boolean pathSlash = path.startsWith("/");
+ boolean baseSlash = baseAddress.endsWith("/");
+ if (pathSlash && baseSlash) {
+ path = path.substring(1);
+ } else if (!pathSlash && !baseSlash) {
+ path = "/" + path;
+ }
+ m.put(Message.REQUEST_URI, baseAddress + path);
+ }
+
+
public static String getPathToMatch(String path, String address, boolean addSlash) {
int ind = path.indexOf(address);
Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java Thu Mar 19 17:12:17 2009
@@ -132,6 +132,15 @@
return (Class<?>)paramType.getActualTypeArguments()[0];
}
+ public static Type[] getActualTypes(Type genericType) {
+ if (genericType == null
+ || !ParameterizedType.class.isAssignableFrom(genericType.getClass())) {
+ return null;
+ }
+ ParameterizedType paramType = (ParameterizedType)genericType;
+ return paramType.getActualTypeArguments();
+ }
+
public static void injectThroughMethod(Object requestObject,
Method method,
Object parameterValue) {
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=756098&r1=756097&r2=756098&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 Thu Mar 19 17:12:17 2009
@@ -545,6 +545,9 @@
String defaultValue) {
List<String> values = new HttpHeadersImpl(m).getRequestHeader(header);
+ if (values != null && values.isEmpty()) {
+ values = null;
+ }
String basePath = HttpUtils.getOriginalAddress(m);
return InjectionUtils.createParameterObject(values,
pClass,
Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProviderTest.java?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProviderTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProviderTest.java Thu Mar 19 17:12:17 2009
@@ -61,4 +61,31 @@
String parsed = CacheControl.valueOf(s).toString();
assertEquals(s, parsed);
}
+
+ @Test
+ public void testNoCacheEnabled() {
+ CacheControl cc = new CacheControl();
+ cc.setNoCache(true);
+ assertEquals("no-cache;no-transform", cc.toString());
+ }
+
+ @Test
+ public void testNoCacheDisabled() {
+ CacheControl cc = new CacheControl();
+ cc.setNoCache(false);
+ assertEquals("no-transform", cc.toString());
+ }
+
+ @Test
+ public void testCacheExtensionToString() {
+ CacheControl cc = new CacheControl();
+ cc.getCacheExtension().put("ext1", null);
+ cc.getCacheExtension().put("ext2", "value2");
+ cc.getCacheExtension().put("ext3", "value 3");
+ String value = cc.toString();
+ assertTrue(value.indexOf("ext1") != -1 && value.indexOf("ext1=") == -1);
+ assertTrue(value.indexOf("ext2=value2") != -1);
+ assertTrue(value.indexOf("ext3=\"value 3\"") != -1);
+ }
+
}
Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java Thu Mar 19 17:12:17 2009
@@ -31,6 +31,7 @@
import java.util.Map;
import javax.ws.rs.core.MediaType;
+import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.PropertyException;
@@ -43,6 +44,7 @@
import javax.xml.validation.Schema;
import org.w3c.dom.Node;
+
import org.xml.sax.ContentHandler;
import org.junit.Assert;
@@ -71,6 +73,21 @@
assertNotNull("schema can not be read from disk", s);
}
+ @Test
+ public void testPackageContext() {
+ JAXBElementProvider p = new JAXBElementProvider();
+ try {
+ JAXBContext context = p.getPackageContext(org.apache.cxf.jaxrs.fortest.jaxb.Book.class);
+ JAXBContext context2 = p.getPackageContext(org.apache.cxf.jaxrs.fortest.jaxb.Book.class);
+ assertNotNull(context);
+ assertNotNull(context2);
+ assertSame(context, context2);
+ } finally {
+ JAXBElementProvider.clearContexts();
+ }
+
+ }
+
@Test
public void testSetMarshallProperties() throws Exception {
Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java Thu Mar 19 17:12:17 2009
@@ -21,13 +21,17 @@
import javax.ws.rs.core.Response;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+
import org.junit.Assert;
import org.junit.Test;
public class HttpUtilsTest extends Assert {
@Test
- public void testUpdatePath() {
+ public void testPathToMatch() {
assertEquals("/", HttpUtils.getPathToMatch("/", "/", true));
assertEquals("/", HttpUtils.getPathToMatch("/", "/bar", true));
assertEquals("/bar", HttpUtils.getPathToMatch("/bar", "/", true));
@@ -39,6 +43,24 @@
}
@Test
+ public void testUpdatePath() {
+
+ Message m = new MessageImpl();
+ m.setExchange(new ExchangeImpl());
+ m.put(Message.ENDPOINT_ADDRESS, "http://localhost/");
+ HttpUtils.updatePath(m, "/bar");
+ assertEquals("/bar", m.get(Message.REQUEST_URI));
+ HttpUtils.updatePath(m, "bar");
+ assertEquals("/bar", m.get(Message.REQUEST_URI));
+ HttpUtils.updatePath(m, "bar/");
+ assertEquals("/bar/", m.get(Message.REQUEST_URI));
+ m.put(Message.ENDPOINT_ADDRESS, "http://localhost");
+ HttpUtils.updatePath(m, "bar/");
+ assertEquals("/bar/", m.get(Message.REQUEST_URI));
+ }
+
+
+ @Test
public void testParameterErrorStatus() {
assertEquals(Response.Status.NOT_FOUND,
HttpUtils.getParameterFailureStatus(ParameterType.PATH));
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=756098&r1=756097&r2=756098&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 Thu Mar 19 17:12:17 2009
@@ -229,7 +229,8 @@
response.getWriter().write("<table " + (serviceListStyleSheet == null
? "cellpadding=\"1\" cellspacing=\"1\" border=\"1\" width=\"100%\"" : "") + ">");
for (ServletDestination sd : destinations) {
- if (null != sd.getEndpointInfo().getName()) {
+ if (null != sd.getEndpointInfo().getName()
+ && null != sd.getEndpointInfo().getInterface()) {
response.getWriter().write("<tr><td>");
response.getWriter().write("<span class=\"porttypename\">"
+ sd.getEndpointInfo().getInterface().getName().getLocalPart()
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/AtomBookStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/AtomBookStore.java?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/AtomBookStore.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/AtomBookStore.java Thu Mar 19 17:12:17 2009
@@ -47,10 +47,10 @@
import org.apache.cxf.customer.book.BookNotFoundDetails;
import org.apache.cxf.customer.book.BookNotFoundFault;
-@Path("/bookstore/")
+@Path("/")
public class AtomBookStore {
- @Context private UriInfo uField;
+ @Context protected UriInfo uField;
private HttpHeaders headers;
private Map<Long, Book> books = new HashMap<Long, Book>();
private Map<Long, CD> cds = new HashMap<Long, CD>();
@@ -124,7 +124,7 @@
// this code is broken as Response does not
URI uri =
- uField.getBaseUriBuilder().path("bookstore", "books", "entries",
+ uField.getBaseUriBuilder().path("books/entries",
Long.toString(b.getId())).build();
return Response.created(uri).entity(e).build();
} catch (Exception ex) {
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/AtomBookStore2.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/AtomBookStore2.java?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/AtomBookStore2.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/AtomBookStore2.java Thu Mar 19 17:12:17 2009
@@ -40,6 +40,11 @@
return super.getBooksAsFeed(uParam);
}
+
+ @Context
+ public void setUriInfo(UriInfo ui) {
+ super.uField = ui;
+ }
}
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java Thu Mar 19 17:12:17 2009
@@ -20,6 +20,8 @@
package org.apache.cxf.systest.jaxrs;
+import java.io.IOException;
+import java.io.OutputStream;
import java.net.URL;
import java.util.Calendar;
import java.util.GregorianCalendar;
@@ -47,6 +49,7 @@
import javax.ws.rs.core.PathSegment;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
+import javax.ws.rs.core.StreamingOutput;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@@ -173,6 +176,14 @@
}
@GET
+ @Path("/bookheaders2/")
+ public Book getBookByHeader(@DefaultValue("123") @HeaderParam("BOOK2") String id)
+ throws Exception {
+ return doGetBook(id);
+ }
+
+
+ @GET
@Path("/bookquery")
public Book getBookByURLQuery(@QueryParam("urlid") String urlValue) throws Exception {
String url2 = new URL(urlValue).toString();
@@ -253,8 +264,14 @@
return doGetBook(currentBookId);
}
+ @GET
+ @Path("/books/stream")
+ @ProduceMime("application/xml")
+ public StreamingOutput writeToStreamAndFail() {
+ return new StreamingOutputImpl();
+ }
+
private Book doGetBook(String id) throws BookNotFoundFault {
- //System.out.println("----invoking getBook with id: " + id);
Book book = books.get(Long.parseLong(id));
if (book != null) {
return book;
@@ -306,6 +323,15 @@
return Response.ok(book).build();
}
+
+ @POST
+ @Path("/booksinfo")
+ @ProduceMime("text/xml")
+ @ConsumeMime("application/xml")
+ public Response addBook(@XmlJavaTypeAdapter(BookInfoAdapter.class)
+ BookInfo bookInfo) {
+ return Response.ok(bookInfo.asBook()).build();
+ }
@POST
@Path("/binarybooks")
@@ -446,9 +472,16 @@
private String name;
private long id;
+ public BookInfo() {
+
+ }
+
public BookInfo(Book b) {
this.name = b.getName();
this.id = b.getId();
+ if (id == 0) {
+ id = 124;
+ }
}
public String getName() {
@@ -458,6 +491,13 @@
public long getId() {
return id;
}
+
+ public Book asBook() {
+ Book b = new Book();
+ b.setId(id);
+ b.setName(name);
+ return b;
+ }
}
public static class BookInfoAdapter extends XmlAdapter<Book, BookInfo> {
@@ -468,9 +508,8 @@
}
@Override
- public BookInfo unmarshal(Book v) throws Exception {
- // TODO Auto-generated method stub
- return null;
+ public BookInfo unmarshal(Book b) throws Exception {
+ return new BookInfo(b);
}
}
@@ -480,6 +519,17 @@
throw new RuntimeException("The bad book");
}
}
+
+ private static class StreamingOutputImpl implements StreamingOutput {
+
+ public void write(OutputStream output) throws IOException, WebApplicationException {
+ //output.write("This is not supposed to go on the wire".getBytes());
+ throw new WebApplicationException(
+ Response.status(410).type("text/plain")
+ .entity("This is supposed to go on the wire").build());
+ }
+
+ }
}
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java Thu Mar 19 17:12:17 2009
@@ -38,6 +38,7 @@
import org.apache.cxf.io.CachedOutputStream;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.codehaus.jettison.json.JSONObject;
+
import org.junit.BeforeClass;
import org.junit.Test;
@@ -54,17 +55,17 @@
@Test
public void testGetBooks() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstore/books/feed";
+ "http://localhost:9080/bookstore/bookstore/books/feed";
Feed feed = getFeed(endpointAddress, null);
- assertEquals("http://localhost:9080/bookstore/books/feed",
+ assertEquals("http://localhost:9080/bookstore/bookstore/books/feed",
feed.getBaseUri().toString());
assertEquals("Collection of Books", feed.getTitle());
- getAndCompareJson("http://localhost:9080/bookstore/books/feed",
+ getAndCompareJson("http://localhost:9080/bookstore/bookstore/books/feed",
"resources/expected_atom_books_json.txt",
"application/json");
- getAndCompareJson("http://localhost:9080/bookstore/books/jsonfeed",
+ getAndCompareJson("http://localhost:9080/bookstore/bookstore/books/jsonfeed",
"resources/expected_atom_books_jsonfeed.txt",
"application/json, text/html, application/xml;q=0.9,"
+ " application/xhtml+xml, image/png, image/jpeg, image/gif,"
@@ -98,25 +99,25 @@
endpointAddress =
- "http://localhost:9080/bookstore/books/subresources/123";
+ "http://localhost:9080/bookstore/bookstore/books/subresources/123";
entry = getEntry(endpointAddress, null);
assertEquals("CXF in Action", entry.getTitle());
- getAndCompareJson("http://localhost:9080/bookstore/books/entries/123",
+ getAndCompareJson("http://localhost:9080/bookstore/bookstore/books/entries/123",
"resources/expected_atom_book_json.txt",
"application/json");
- getAndCompareJson("http://localhost:9080/bookstore/books/entries/123?_type="
+ getAndCompareJson("http://localhost:9080/bookstore/bookstore/books/entries/123?_type="
+ "application/json",
"resources/expected_atom_book_json.txt",
"*/*");
- getAndCompareJson("http://localhost:9080/bookstore/books/entries/123?_type="
+ getAndCompareJson("http://localhost:9080/bookstore/bookstore/books/entries/123?_type="
+ "json",
"resources/expected_atom_book_json.txt",
"*/*");
// do the same using extension mappings
- getAndCompareJson("http://localhost:9080/bookstore/books/entries/123.json",
+ getAndCompareJson("http://localhost:9080/bookstore/bookstore/books/entries/123.json",
"resources/expected_atom_book_json.txt",
"*/*");
@@ -126,11 +127,22 @@
@Test
public void testGetBooks2() throws Exception {
String endpointAddress =
- "http://localhost:9080";
+ "http://localhost:9080/bookstore/sub/";
Feed feed = getFeed(endpointAddress, null);
- assertEquals("http://localhost:9080/",
+ assertEquals("http://localhost:9080/bookstore/sub/",
feed.getBaseUri().toString());
assertEquals("Collection of Books", feed.getTitle());
+
+ getAndCompareJson("http://localhost:9080/bookstore/sub/books/entries/123.json",
+ "resources/expected_atom_book_json2.txt",
+ "*/*");
+ }
+
+ @Test
+ public void testGetBooks3() throws Exception {
+ getAndCompareJson("http://localhost:9080/atom/atom/books/entries/123.json",
+ "resources/expected_atom_book_json3.txt",
+ "*/*");
}
private void getAndCompareJson(String address,
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Thu Mar 19 17:12:17 2009
@@ -85,6 +85,13 @@
"application/xml", 404);
}
+ @Test
+ public void testWriteAndFailEarly() throws Exception {
+ getAndCompare("http://localhost:9080/bookstore/books/stream",
+ "This is supposed to go on the wire",
+ "application/xml, text/plain", 410);
+ }
+
@Test
public void testAcceptTypeMismatch() throws Exception {
@@ -287,6 +294,13 @@
}
@Test
+ public void testGetBookByHeaderDefault() throws Exception {
+ getAndCompareAsStrings("http://localhost:9080/bookstore/bookheaders2",
+ "resources/expected_get_book123.txt",
+ "application/xml;q=0.5,text/xml", 200);
+ }
+
+ @Test
public void testGetBookElement() throws Exception {
getAndCompareAsStrings("http://localhost:9080/bookstore/books/element",
"resources/expected_get_book123.txt",
@@ -351,11 +365,17 @@
@Test
public void testAddBook() throws Exception {
- String endpointAddress =
- "http://localhost:9080/bookstore/books";
-
+ doAddBook("http://localhost:9080/bookstore/books");
+ }
+
+ @Test
+ public void testAddBookXmlAdapter() throws Exception {
+ doAddBook("http://localhost:9080/bookstore/booksinfo");
+ }
+
+ private void doAddBook(String address) throws Exception {
File input = new File(getClass().getResource("resources/add_book.txt").toURI());
- PostMethod post = new PostMethod(endpointAddress);
+ PostMethod post = new PostMethod(address);
post.setRequestHeader("Content-Type", "application/xml");
RequestEntity entity = new FileRequestEntity(input, "text/xml; charset=ISO-8859-1");
post.setRequestEntity(entity);
@@ -371,8 +391,8 @@
} finally {
// Release current connection to the connection pool once you are done
post.releaseConnection();
- }
- }
+ }
+ }
@Test
public void testUpdateBook() throws Exception {
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java Thu Mar 19 17:12:17 2009
@@ -179,7 +179,7 @@
+ "boundary=\"----=_Part_4_701508.1145579811786\"";
post.setRequestHeader("Content-Type", ct);
InputStream is =
- getClass().getResourceAsStream("/org/apache/cxf/systest/jaxrs/" + resourceName);
+ getClass().getResourceAsStream("/org/apache/cxf/systest/jaxrs/resources/" + resourceName);
RequestEntity entity = new InputStreamRequestEntity(is);
post.setRequestEntity(entity);
HttpClient httpclient = new HttpClient();
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_book_json.txt
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_book_json.txt?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_book_json.txt (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_book_json.txt Thu Mar 19 17:12:17 2009
@@ -9,6 +9,6 @@
]
},
"attributes":{
- "xml:base":"http://localhost:9080/bookstore/books/entries/123"
+ "xml:base":"http://localhost:9080/bookstore/bookstore/books/entries/123"
}
}
\ No newline at end of file
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_books_json.txt
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_books_json.txt?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_books_json.txt (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_books_json.txt Thu Mar 19 17:12:17 2009
@@ -18,7 +18,7 @@
}
],
"attributes":{
- "xml:base":"http://localhost:9080/bookstore/books/feed"
+ "xml:base":"http://localhost:9080/bookstore/bookstore/books/feed"
}
}
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_books_jsonfeed.txt
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_books_jsonfeed.txt?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_books_jsonfeed.txt (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_books_jsonfeed.txt Thu Mar 19 17:12:17 2009
@@ -18,7 +18,7 @@
}
],
"attributes":{
- "xml:base":"http://localhost:9080/bookstore/books/jsonfeed"
+ "xml:base":"http://localhost:9080/bookstore/bookstore/books/jsonfeed"
}
}
Modified: cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs/WEB-INF/beans.xml?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs/WEB-INF/beans.xml (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs/WEB-INF/beans.xml Thu Mar 19 17:12:17 2009
@@ -87,8 +87,8 @@
</bean>
<util:list id="theSchemas">
- <value>classpath:/org/apache/cxf/systest/jaxrs/bookid.xsd</value>
- <value>classpath:/org/apache/cxf/systest/jaxrs/book.xsd</value>
+ <value>classpath:/org/apache/cxf/systest/jaxrs/resources/bookid.xsd</value>
+ <value>classpath:/org/apache/cxf/systest/jaxrs/resources/book.xsd</value>
</util:list>
<util:list id="jsonTypes">
Modified: cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_atom/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_atom/WEB-INF/beans.xml?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_atom/WEB-INF/beans.xml (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_atom/WEB-INF/beans.xml Thu Mar 19 17:12:17 2009
@@ -39,22 +39,56 @@
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxrs:server id="atomservice"
- address="/"
+ address="/bookstore"
staticSubresourceResolution="true">
<jaxrs:serviceBeans>
<ref bean="atomstore"/>
- <ref bean="atomstore2"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
- <bean class="org.apache.cxf.jaxrs.provider.AtomFeedProvider"/>
- <bean class="org.apache.cxf.jaxrs.provider.AtomEntryProvider"/>
+ <ref bean="feed"/>
+ <ref bean="entry"/>
</jaxrs:providers>
<jaxrs:extensionMappings>
<entry key="json" value="application/json"/>
</jaxrs:extensionMappings>
</jaxrs:server>
+
+ <jaxrs:server id="atomservice2"
+ address="/sub"
+ staticSubresourceResolution="true">
+ <jaxrs:serviceBeans>
+ <ref bean="atomstore2"/>
+ </jaxrs:serviceBeans>
+ <jaxrs:providers>
+ <ref bean="feed"/>
+ <ref bean="entry"/>
+ </jaxrs:providers>
+ <jaxrs:extensionMappings>
+ <entry key="json" value="application/json"/>
+ </jaxrs:extensionMappings>
+ </jaxrs:server>
+
+ <jaxrs:server id="atomservice3"
+ address="/">
+ <jaxrs:serviceBeans>
+ <ref bean="atomstore3"/>
+ </jaxrs:serviceBeans>
+ <jaxrs:providers>
+ <ref bean="feed"/>
+ <ref bean="entry"/>
+ </jaxrs:providers>
+ <jaxrs:extensionMappings>
+ <entry key="json" value="application/json"/>
+ </jaxrs:extensionMappings>
+ </jaxrs:server>
+
<bean id="atomstore" class="org.apache.cxf.systest.jaxrs.AtomBookStore"/>
<bean id="atomstore2" class="org.apache.cxf.systest.jaxrs.AtomBookStore2"/>
+ <bean id="atomstore3" class="org.apache.cxf.systest.jaxrs.AtomBookStore3"/>
+
+ <bean id="feed" class="org.apache.cxf.jaxrs.provider.AtomFeedProvider"/>
+ <bean id="entry" class="org.apache.cxf.jaxrs.provider.AtomEntryProvider"/>
+
</beans>
<!-- END SNIPPET: beans -->
Modified: cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_atom/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_atom/WEB-INF/web.xml?rev=756098&r1=756097&r2=756098&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_atom/WEB-INF/web.xml (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_atom/WEB-INF/web.xml Thu Mar 19 17:12:17 2009
@@ -44,7 +44,13 @@
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
- <url-pattern>/*</url-pattern>
+ <url-pattern>/bookstore/*</url-pattern>
</servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>CXFServlet</servlet-name>
+ <url-pattern>/atom/*</url-pattern>
+ </servlet-mapping>
+
</web-app>
<!-- END SNIPPET: webxml -->