Skip to content
Permalink
Browse files
[CXF-5542] Doing the best effort to prevent the loss of TL contexts w…
…hen providers are shared between the components with different buses

git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1564749 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Sergey Beryozkin committed Feb 5, 2014
1 parent 5d1e71a commit 2319407b4fdbb14e65118fa41fed92e2361de551
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 13 deletions.
@@ -28,7 +28,7 @@
public class CustomInFaultyInterceptor extends AbstractPhaseInterceptor<Message> {

public CustomInFaultyInterceptor() {
super(Phase.PRE_INVOKE);
super(Phase.PRE_LOGICAL);
}

public void handleMessage(Message message) throws Fault {
@@ -97,6 +97,7 @@ public void testEchoSuperBookCollectionProxy() throws Exception {
"http://localhost:" + PORT + "/webapp/store2";
BookStoreSpring proxy = JAXRSClientFactory.create(endpointAddress, BookStoreSpring.class,
Collections.singletonList(new JacksonJsonProvider()));
WebClient.getConfig(proxy).getHttpConduit().getClient().setReceiveTimeout(10000000L);
List<SuperBook> books =
proxy.echoSuperBookCollectionJson(Collections.singletonList(new SuperBook("Super", 124L, true)));
assertEquals(124L, books.get(0).getId());
@@ -119,7 +120,7 @@ public void testEchoSuperBookProxy() throws Exception {
public void testEchoGenericSuperBookCollectionProxy() throws Exception {

String endpointAddress =
"http://localhost:" + PORT + "/webapp/genericstore";
"http://localhost:" + PORT + "/webapp/custombus/genericstore";
GenericBookStoreSpring proxy = JAXRSClientFactory.create(endpointAddress,
GenericBookStoreSpring.class, Collections.singletonList(new JacksonJsonProvider()));
List<SuperBook> books =
@@ -132,7 +133,7 @@ public void testEchoGenericSuperBookCollectionProxy() throws Exception {
public void testEchoGenericSuperBookProxy() throws Exception {

String endpointAddress =
"http://localhost:" + PORT + "/webapp/genericstore";
"http://localhost:" + PORT + "/webapp/custombus/genericstore";
GenericBookStoreSpring proxy = JAXRSClientFactory.create(endpointAddress,
GenericBookStoreSpring.class, Collections.singletonList(new JacksonJsonProvider()));
WebClient.getConfig(proxy).getHttpConduit().getClient().setReceiveTimeout(1000000000L);
@@ -271,7 +272,7 @@ public void testEchoGenericSuperBookCollectionProxy2XmlType() throws Exception {
public void testEchoGenericSuperBookWebClient() throws Exception {

String endpointAddress =
"http://localhost:" + PORT + "/webapp/genericstore/books/superbook";
"http://localhost:" + PORT + "/webapp/custombus/genericstore/books/superbook";
WebClient wc = WebClient.create(endpointAddress,
Collections.singletonList(new JacksonJsonProvider()));
wc.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON);
@@ -284,7 +285,7 @@ public void testEchoGenericSuperBookWebClient() throws Exception {
public void testEchoGenericSuperBookWebClientXml() throws Exception {

String endpointAddress =
"http://localhost:" + PORT + "/webapp/genericstore/books/superbook";
"http://localhost:" + PORT + "/webapp/custombus/genericstore/books/superbook";
WebClient wc = WebClient.create(endpointAddress);
wc.accept(MediaType.APPLICATION_XML).type(MediaType.APPLICATION_XML);
SuperBook book = wc.post(new SuperBook("Super", 124L, true), SuperBook.class);
@@ -296,7 +297,7 @@ public void testEchoGenericSuperBookWebClientXml() throws Exception {
public void testEchoGenericSuperBookCollectionWebClient() throws Exception {

String endpointAddress =
"http://localhost:" + PORT + "/webapp/genericstore/books/superbooks";
"http://localhost:" + PORT + "/webapp/custombus/genericstore/books/superbooks";
WebClient wc = WebClient.create(endpointAddress,
Collections.singletonList(new JacksonJsonProvider()));
WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(100000000L);
@@ -314,7 +315,7 @@ public void testEchoGenericSuperBookCollectionWebClient() throws Exception {
public void testGetGenericSuperBookCollectionWebClient() throws Exception {

String endpointAddress =
"http://localhost:" + PORT + "/webapp/genericstore/books/superbooks2";
"http://localhost:" + PORT + "/webapp/custombus/genericstore/books/superbooks2";
WebClient wc = WebClient.create(endpointAddress,
Collections.singletonList(new JacksonJsonProvider()));
WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(100000000L);
@@ -331,7 +332,7 @@ public void testGetGenericSuperBookCollectionWebClient() throws Exception {
public void testEchoGenericSuperBookCollectionWebClientXml() throws Exception {

String endpointAddress =
"http://localhost:" + PORT + "/webapp/genericstore/books/superbooks";
"http://localhost:" + PORT + "/webapp/custombus/genericstore/books/superbooks";
WebClient wc = WebClient.create(endpointAddress);
wc.accept(MediaType.APPLICATION_XML).type(MediaType.APPLICATION_XML);
Collection<? extends SuperBook> books =
@@ -20,13 +20,16 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:core="http://cxf.apache.org/core"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/core
http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd">
<import resource="classpath:/META-INF/cxf/cxf.xml"/>

<jaxrs:server id="bookservice"
address="/store1">
<jaxrs:serviceBeans>
@@ -47,7 +50,10 @@ http://cxf.apache.org/schemas/jaxrs.xsd">
</jaxrs:providers>
</jaxrs:server>

<core:bus name="cxf1" id="cxf1"/>

<jaxrs:server id="genericBookStore"
bus="cxf1"
address="/genericstore">
<jaxrs:serviceBeans>
<ref bean="gBookStore"/>
@@ -20,21 +20,45 @@
-->
<!-- START SNIPPET: webxml -->
<web-app>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/beans.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<display-name>CXF Servlet</display-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>CXFServletBus</servlet-name>
<display-name>CXF Servlet Bus</display-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<init-param>
<param-name>config-location</param-name>
<param-value>/WEB-INF/beans.xml</param-value>
<param-name>bus</param-name>
<param-value>
cxf1
</param-value>
</init-param>

<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>CXFServletBus</servlet-name>
<url-pattern>/custombus/*</url-pattern>
</servlet-mapping>
</web-app>
<!-- END SNIPPET: webxml -->

0 comments on commit 2319407

Please sign in to comment.