cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r842447 - in /websites/production/cxf/content: cache/docs.pageCache docs/jaxrs-services-configuration.html
Date Fri, 14 Dec 2012 23:48:03 GMT
Author: buildbot
Date: Fri Dec 14 23:48:02 2012
New Revision: 842447

Log:
Production update by buildbot for cxf

Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/jaxrs-services-configuration.html

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

Modified: websites/production/cxf/content/docs/jaxrs-services-configuration.html
==============================================================================
--- websites/production/cxf/content/docs/jaxrs-services-configuration.html (original)
+++ websites/production/cxf/content/docs/jaxrs-services-configuration.html Fri Dec 14 23:48:02
2012
@@ -124,7 +124,7 @@ Apache CXF -- JAXRS Services Configurati
 <div id="ConfluenceContent"><p><span style="font-size:2em;font-weight:bold">
JAX-RS : Services Configuration </span></p>
 
 <div>
-<ul><li><a shape="rect" href="#JAXRSServicesConfiguration-ConfiguringJAXRSservicesprogrammatically">Configuring
JAX-RS services programmatically</a></li><li><a shape="rect" href="#JAXRSServicesConfiguration-OSGI">OSGI</a></li><ul><li><a
shape="rect" href="#JAXRSServicesConfiguration-Blueprint">Blueprint</a></li><li><a
shape="rect" href="#JAXRSServicesConfiguration-Spring">Spring</a></li></ul><li><a
shape="rect" href="#JAXRSServicesConfiguration-ConfiguringJAXRSendpointsprogrammaticallywithoutSpring">Configuring
JAX-RS endpoints programmatically without Spring</a></li><li><a shape="rect"
href="#JAXRSServicesConfiguration-ConfiguringJAXRSservicesincontainerwithSpringconfigurationfile.">Configuring
JAX-RS services in container with Spring configuration file.</a></li><ul><li><a
shape="rect" href="#JAXRSServicesConfiguration-web.xml">web.xml</a></li><ul><li><a
shape="rect" href="#JAXRSServicesConfiguration-UsingSpringContextLoaderListener">Using
Spring ContextLoaderListener</a></
 li><li><a shape="rect" href="#JAXRSServicesConfiguration-UsingCXFServletinitparameters">Using
CXFServlet init parameters</a></li></ul><li><a shape="rect" href="#JAXRSServicesConfiguration-beans.xml">beans.xml</a></li></ul><li><a
shape="rect" href="#JAXRSServicesConfiguration-ConfiguringJAXRSservicesusingexplicitbeanconfiguration">Configuring
JAX-RS services using explicit bean configuration</a></li><li><a shape="rect"
href="#JAXRSServicesConfiguration-SpringAOP">Spring AOP</a></li><li><a
shape="rect" href="#JAXRSServicesConfiguration-ConfiguringJAXRSservicesincontainerwithoutSpring">Configuring
JAX-RS services in container without Spring</a></li><ul><li><a
shape="rect" href="#JAXRSServicesConfiguration-AttachingJAXRSendpointstoanexistingJettyserver">Attaching
JAXRS endpoints to an existing Jetty server</a></li></ul><li><a
shape="rect" href="#JAXRSServicesConfiguration-JAXRSRuntimeDelegateandApplications">JAX-RS
RuntimeDelegate and Applications</a></li><li><a shape="rect" hre
 f="#JAXRSServicesConfiguration-ConfiguringJAXRSservicesprogrammaticallywithSpringconfigurationfile.">Configuring
JAX-RS services programmatically with Spring configuration file.</a></li><li><a
shape="rect" href="#JAXRSServicesConfiguration-Lifecyclemanagement">Lifecycle management</a></li><ul><li><a
shape="rect" href="#JAXRSServicesConfiguration-FromSpring">From Spring</a></li><li><a
shape="rect" href="#JAXRSServicesConfiguration-WithCXFNonSpringJaxrsServlet">With CXFNonSpringJaxrsServlet</a></li><li><a
shape="rect" href="#JAXRSServicesConfiguration-Programmatically">Programmatically</a></li><li><a
shape="rect" href="#JAXRSServicesConfiguration-PostConstructandPreDestroy">PostConstruct
and PreDestroy</a></li></ul><li><a shape="rect" href="#JAXRSServicesConfiguration-Locatingcustomresourcesinwebapplications">Locating
custom resources in web applications</a></li><li><a shape="rect" href="#JAXRSServicesConfiguration-Multipleendpointsandresourceclasses">Multiple
endpoints and re
 source classes</a></li><li><a shape="rect" href="#JAXRSServicesConfiguration-DynamicservletsandasingleJAXRSendpoint">Dynamic
servlets and a single JAX-RS endpoint</a></li><li><a shape="rect" href="#JAXRSServicesConfiguration-ServletContainerConfiguration">Servlet
Container Configuration</a></li><ul><li><a shape="rect" href="#JAXRSServicesConfiguration-Tomcat">Tomcat</a></li></ul></ul></div>
+<ul><li><a shape="rect" href="#JAXRSServicesConfiguration-ConfiguringJAXRSservicesprogrammatically">Configuring
JAX-RS services programmatically</a></li><li><a shape="rect" href="#JAXRSServicesConfiguration-OSGI">OSGI</a></li><ul><li><a
shape="rect" href="#JAXRSServicesConfiguration-Blueprint">Blueprint</a></li><li><a
shape="rect" href="#JAXRSServicesConfiguration-Spring">Spring</a></li></ul><li><a
shape="rect" href="#JAXRSServicesConfiguration-ConfiguringJAXRSendpointsprogrammaticallywithoutSpring">Configuring
JAX-RS endpoints programmatically without Spring</a></li><li><a shape="rect"
href="#JAXRSServicesConfiguration-ConfiguringJAXRSservicesincontainerwithSpringconfigurationfile.">Configuring
JAX-RS services in container with Spring configuration file.</a></li><ul><li><a
shape="rect" href="#JAXRSServicesConfiguration-web.xml">web.xml</a></li><ul><li><a
shape="rect" href="#JAXRSServicesConfiguration-UsingSpringContextLoaderListener">Using
Spring ContextLoaderListener</a></
 li><li><a shape="rect" href="#JAXRSServicesConfiguration-UsingCXFServletinitparameters">Using
CXFServlet init parameters</a></li></ul><li><a shape="rect" href="#JAXRSServicesConfiguration-beans.xml">beans.xml</a></li></ul><li><a
shape="rect" href="#JAXRSServicesConfiguration-ConfiguringJAXRSservicesusingexplicitbeanconfiguration">Configuring
JAX-RS services using explicit bean configuration</a></li><li><a shape="rect"
href="#JAXRSServicesConfiguration-SpringAOP">Spring AOP</a></li><li><a
shape="rect" href="#JAXRSServicesConfiguration-ConfiguringJAXRSservicesincontainerwithoutSpring">Configuring
JAX-RS services in container without Spring</a></li><ul><li><a
shape="rect" href="#JAXRSServicesConfiguration-AttachingJAXRSendpointstoanexistingJettyserver">Attaching
JAXRS endpoints to an existing Jetty server</a></li></ul><li><a
shape="rect" href="#JAXRSServicesConfiguration-JAXRSRuntimeDelegateandApplications">JAX-RS
RuntimeDelegate and Applications</a></li><li><a shape="rect" hre
 f="#JAXRSServicesConfiguration-ConfiguringJAXRSservicesprogrammaticallywithSpringconfigurationfile.">Configuring
JAX-RS services programmatically with Spring configuration file.</a></li><li><a
shape="rect" href="#JAXRSServicesConfiguration-Lifecyclemanagement">Lifecycle management</a></li><ul><li><a
shape="rect" href="#JAXRSServicesConfiguration-FromSpring">From Spring</a></li><li><a
shape="rect" href="#JAXRSServicesConfiguration-WithCXFNonSpringJaxrsServlet">With CXFNonSpringJaxrsServlet</a></li><li><a
shape="rect" href="#JAXRSServicesConfiguration-Programmatically">Programmatically</a></li><li><a
shape="rect" href="#JAXRSServicesConfiguration-PostConstructandPreDestroy">PostConstruct
and PreDestroy</a></li></ul><li><a shape="rect" href="#JAXRSServicesConfiguration-Locatingcustomresourcesinwebapplications">Locating
custom resources in web applications</a></li><li><a shape="rect" href="#JAXRSServicesConfiguration-Multipleendpointsandresourceclasses">Multiple
endpoints and re
 source classes</a></li><li><a shape="rect" href="#JAXRSServicesConfiguration-Sharingprovidersbetweenmultipleendpoints">Sharing
providers between multiple endpoints</a></li><li><a shape="rect" href="#JAXRSServicesConfiguration-DynamicservletsandasingleJAXRSendpoint">Dynamic
servlets and a single JAX-RS endpoint</a></li><li><a shape="rect" href="#JAXRSServicesConfiguration-ServletContainerConfiguration">Servlet
Container Configuration</a></li><ul><li><a shape="rect" href="#JAXRSServicesConfiguration-Tomcat">Tomcat</a></li></ul></ul></div>
 
 <h1><a shape="rect" name="JAXRSServicesConfiguration-ConfiguringJAXRSservicesprogrammatically"></a>Configuring
JAX-RS services programmatically</h1>
 
@@ -906,6 +906,72 @@ Since CXF 2.2.3 one can put them directl
 
 <p>One can configure as many jaxrs:server endpoints as needed for a given application,
with every endpoint possibly providing an alternative path to a single resource bean. Every
endpoint can employ as many shared or unique resource classes as needed, and have common or
different providers.  </p>
 
+<h1><a shape="rect" name="JAXRSServicesConfiguration-Sharingprovidersbetweenmultipleendpoints"></a>Sharing
providers between multiple endpoints</h1>
+
+<p>One way to share multiple providers between multiple endpoints is to refer to the
same provider bean from within jaxrs:provider sections:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-xml">
+<span class="code-tag">&lt;beans&gt;</span>
+  <span class="code-tag">&lt;jaxrs:server id=<span class="code-quote">"customerService"</span>
address=<span class="code-quote">"/service1"</span>&gt;</span>
+    <span class="code-tag">&lt;jaxrs:serviceBeans&gt;</span>
+      <span class="code-tag">&lt;bean class=<span class="code-quote">"org.apache.cxf.systest.jaxrs.CustomerService"</span>/&gt;</span>
+    <span class="code-tag">&lt;/jaxrs:serviceBeans&gt;</span>
+    <span class="code-tag">&lt;jaxrs:providers&gt;</span>
+      <span class="code-tag">&lt;bean ref=<span class="code-quote">"customProvider"</span>/&gt;</span>
+    <span class="code-tag">&lt;/jaxrs:providers&gt;</span>
+
+  <span class="code-tag">&lt;/jaxrs:server&gt;</span>
+
+  <span class="code-tag">&lt;jaxrs:server id=<span class="code-quote">"customerService"</span>
address=<span class="code-quote">"/service2"</span>&gt;</span>
+    <span class="code-tag">&lt;jaxrs:serviceBeans&gt;</span>
+      <span class="code-tag">&lt;bean class=<span class="code-quote">"org.apache.cxf.systest.jaxrs.CustomerService2"</span>/&gt;</span>
+    <span class="code-tag">&lt;/jaxrs:serviceBeans&gt;</span>
+    <span class="code-tag">&lt;jaxrs:providers&gt;</span>
+      <span class="code-tag">&lt;bean ref=<span class="code-quote">"customProvider"</span>/&gt;</span>
+    <span class="code-tag">&lt;/jaxrs:providers&gt;</span>
+  <span class="code-tag">&lt;/jaxrs:server&gt;</span>
+  
+  <span class="code-tag">&lt;bean id=<span class="code-quote">"customProvider"</span>
class=<span class="code-quote">"org.apache.cxf.systest.jaxrs.CustomerProvider"</span>/&gt;</span>
+<span class="code-tag">&lt;/beans&gt;</span>
+
+</pre>
+</div></div>
+
+<p>Starting from CXF 2.7.2 it is possible to register provider directly on the bus
as the bus properties and share them between all the providers using this bus:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-xml">
+<span class="code-tag">&lt;beans&gt;</span>
+  
+  <span class="code-tag">&lt;cxf:bus&gt;</span>
+        <span class="code-tag">&lt;cxf:properties&gt;</span>
+            <span class="code-tag">&lt;entry key=<span class="code-quote">"javax.ws.rs.ext.ExceptionMapper"</span>
ref=<span class="code-quote">"exceptionMapper"</span>/&gt;</span>
+        <span class="code-tag">&lt;/cxf:properties&gt;</span>
+  &lt;/cxf:bus
+
+  <span class="code-tag">&lt;bean id=<span class="code-quote">"exceptionMapper"</span>
class=<span class="code-quote">"org.apache.cxf.systest.jaxrs.RuntimeExceptionMapper"</span>/&gt;</span>
+
+  <span class="code-tag">&lt;jaxrs:server id=<span class="code-quote">"customerService"</span>
address=<span class="code-quote">"/service1"</span>&gt;</span>
+    <span class="code-tag">&lt;jaxrs:serviceBeans&gt;</span>
+      <span class="code-tag">&lt;bean class=<span class="code-quote">"org.apache.cxf.systest.jaxrs.CustomerService"</span>/&gt;</span>
+    <span class="code-tag">&lt;/jaxrs:serviceBeans&gt;</span>
+  <span class="code-tag">&lt;/jaxrs:server&gt;</span>
+
+  <span class="code-tag">&lt;jaxrs:server id=<span class="code-quote">"customerService"</span>
address=<span class="code-quote">"/service2"</span>&gt;</span>
+    <span class="code-tag">&lt;jaxrs:serviceBeans&gt;</span>
+      <span class="code-tag">&lt;bean class=<span class="code-quote">"org.apache.cxf.systest.jaxrs.CustomerService2"</span>/&gt;</span>
+    <span class="code-tag">&lt;/jaxrs:serviceBeans&gt;</span>
+  <span class="code-tag">&lt;/jaxrs:server&gt;</span>
+  
+  <span class="code-tag">&lt;/beans&gt;</span>
+</pre>
+</div></div>
+
+<p>Note a global exception mapper has been registered using the name of interface,
"javax.ws.rs.ext.ExceptionMapper", which all the exception mappers have to implement. </p>
+
+<p>Note at the moment it is only possible to register the providers bound to a specific
bus implementing "javax.ws.rs.ext.ExceptionMapper", "javax.ws.rs.ext.MessageBodyReader" or
"javax.ws.rs.ext.MessageBodyWriter" interfaces. Registering all supported JAX-RS and CXF-specific
providers on the specific bus will also be possible soon.  </p>
+
 <h1><a shape="rect" name="JAXRSServicesConfiguration-DynamicservletsandasingleJAXRSendpoint"></a>Dynamic
servlets and a single JAX-RS endpoint</h1>
 
 <p>In some advanced cases you may want to dynamically add new servlets (CXFServlet
or CXFNonSpringJaxrsServlet) with all of them serving the same JAX-RS endpoints. In this case
you most likely want to configure servlets so that the CXF endpoint address is not overridden
:</p>



Mime
View raw message