cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r966786 - in /websites/production/cxf/content: cache/docs.pageCache docs/jax-rs-client-api.html
Date Fri, 25 Sep 2015 12:47:37 GMT
Author: buildbot
Date: Fri Sep 25 12:47:36 2015
New Revision: 966786

Log:
Production update by buildbot for cxf

Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/jax-rs-client-api.html

Modified: websites/production/cxf/content/cache/docs.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/cxf/content/docs/jax-rs-client-api.html
==============================================================================
--- websites/production/cxf/content/docs/jax-rs-client-api.html (original)
+++ websites/production/cxf/content/docs/jax-rs-client-api.html Fri Sep 25 12:47:36 2015
@@ -118,11 +118,11 @@ Apache CXF -- JAX-RS Client API
            <!-- Content -->
            <div class="wiki-content">
 <div id="ConfluenceContent"><p>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;<span
class="inline-first-p" style="font-size:2em;font-weight:bold">JAX-RS : Client API</span>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p><style
type="text/css">/*<![CDATA[*/
-div.rbtoc1435780158793 {padding: 0px;}
-div.rbtoc1435780158793 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1435780158793 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1443185217131 {padding: 0px;}
+div.rbtoc1443185217131 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1443185217131 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1435780158793">
+/*]]>*/</style></p><div class="toc-macro rbtoc1443185217131">
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSClientAPI-MavenDependency">Maven
Dependency</a></li><li><a shape="rect" href="#JAX-RSClientAPI-JAX-RS2.0ClientAPI">JAX-RS
2.0 Client API</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSClientAPI-JAX-RS2.0andCXFspecificAPI">JAX-RS
2.0 and CXF specific API</a></li></ul>
 </li><li><a shape="rect" href="#JAX-RSClientAPI-Proxy-basedAPI">Proxy-based
API</a>
@@ -318,7 +318,7 @@ Book b2 = source.getNode("/books/book[po
 </pre>
 </div></div><p>Note that an XMLSource instance can be set to buffer the
input stream thus allowing for executing multiple XPath queries.<br clear="none"> XMlSource
can also help with getting the URIs representing the links or XML instances as Strings.</p><h1
id="JAX-RSClientAPI-SupportforarbitraryHTTPmethodsforsyncinvocations.">Support for arbitrary
HTTP methods for sync invocations.</h1><p>To get the arbitrary HTTP methods supported
with the synchronous client calls or bypass some known Java HTTPUrlConnection issues (example
it will block empty DELETE requests) add the HttpClient-based transport dependency and set
a "use.async.http.conduit" contextual property.</p><p>This will work as is for
asynchronous calls given that the HttpClient-based transport is required.</p><h1
id="JAX-RSClientAPI-ThreadSafety">Thread Safety</h1><p>Proxies and web clients
(clients) are not thread safe by default. In some cases this can be a limitation, especially
when clients are injected; synchronizing o
 n them can cause performance side effects.</p><p>One way to 'make' clients thread-safe
is to use WebClient.fromClient(Client) for web clients or JAXRSClientFactoryBean.fromClient()
factory methods which copy all the original configuration properties and can be used to create
new client instances per every request.</p><p>A single client doing multiple invocations
without changing the current URI or headers is thread-safe. The only limitation in this case
applies to proxies, in that they can not get "out of band" headers without synchronizing,
ex :</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">//
get some response headers passed to us 'out of band', which is not thread-safe for a plain
proxy: 
-String bookHeader = WebClient.toClient(injectedBookStoreProxy).getHeaders().getFirst("BookHeader");

+String bookHeader = WebClient.client(injectedBookStoreProxy).getHeaders().getFirst("BookHeader");

 </pre>
 </div></div><p>Final option is to use a 'threadSafe' boolean property when
creating proxies or web clients (either from Spring or programmatically), see this <a shape="rect"
class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultithreadedClientTest.java">test</a>
for more details. Thread-safe clients created this way keep their state in a thread-local
storage.</p><p>If a number of incoming threads is limited then one option is just
do nothing, while the other option is to reset the thread local state :</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">try
{ 



Mime
View raw message