Author: buildbot Date: Fri Dec 12 17:47:09 2014 New Revision: 932469 Log: Production update by buildbot for cxf
Modified: websites/production/cxf/content/cache/docs.pageCache websites/production/cxf/content/docs/jax-rs-redirection.html Modified: websites/production/cxf/content/cache/docs.pageCache ============================================================================== Binary files - no diff available. Modified: websites/production/cxf/content/docs/jax-rs-redirection.html ============================================================================== --- websites/production/cxf/content/docs/jax-rs-redirection.html (original) +++ websites/production/cxf/content/docs/jax-rs-redirection.html Fri Dec 12 17:47:09 2014 @@ -117,40 +117,17 @@ Apache CXF -- JAX-RS Redirection <td height="100%"> <!-- Content --> <div class="wiki-content"> -<div id="ConfluenceContent"><p></p><p></p><p></p><p></p><p><span class="inline-first-p" style="font-size:2em;font-weight:bold"> JAX-RS : Redirection </span></p><p></p><p></p><p></p><p></p><p></p> +<div id="ConfluenceContent"><p> </p><p> </p><p> </p><p> </p><p> <span class="inline-first-p" style="font-size:2em;font-weight:bold">JAX-RS : Redirection</span> </p><p> </p><p> </p><p> </p><p> </p><p><style type="text/css">/*<![CDATA[*/ +div.rbtoc1418406403497 {padding: 0px;} +div.rbtoc1418406403497 ul {list-style: disc;margin-left: 0px;} +div.rbtoc1418406403497 li {margin-left: 0px;padding-left: 0px;} -<style type="text/css">/*<![CDATA[*/ -div.rbtoc1408383988577 {padding: 0px;} -div.rbtoc1408383988577 ul {list-style: disc;margin-left: 0px;} -div.rbtoc1408383988577 li {margin-left: 0px;padding-left: 0px;} - -/*]]>*/</style><div class="toc-macro rbtoc1408383988577"> +/*]]>*/</style></p><div class="toc-macro rbtoc1418406403497"> <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSRedirection-WithRequestDispatcherProvider">With RequestDispatcherProvider</a> <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSRedirection-Loggingredirects">Logging redirects</a></li></ul> </li><li><a shape="rect" href="#JAX-RSRedirection-WithCXFServlet">With CXFServlet</a></li><li><a shape="rect" href="#JAX-RSRedirection-CustomRedirection">Custom Redirection</a></li></ul> -</div> - -<h1 id="JAX-RSRedirection-WithRequestDispatcherProvider">With RequestDispatcherProvider</h1> - -<p><a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java">RequestDispatcherProvider</a> is a JAXRS MessageBodyWriter which can redirect to JSP pages, named or default servlets. It can be used to serve all the responses from a given resource class or restricted to serving a limited set of classes only using a classResources map property.</p> - -<p>Starting from CXF 2.5.0 and 2.4.4 it is also possible to specify that only responses to requests with matching URIs that will be processed.</p> - -<p>At the moment, this provider is statically configured to support text/html content types, but it can be easily configured to support other content types if needed. </p> - -<p>In addition to 'resourcePath' and 'dispatcherName' properties, one can set a 'scope' property which has two possible values, 'request' and 'session' with 'request' being the default value. It affects the way the JSP code can retrieve parameters passed to it by the RequestDispatcherProvider. If it is a 'request' scope then all the parameters are set as the attributes on the current HTTP request. If session scope then they're set as the attributes on the current HTTP session.</p> - -<p><code>RequestDispatcherProvider</code> sets the following parameters :</p> - -<ul class="alternate"><li>JAXRS method response object. The name of this parameter is either a simple class name of this object (lower case) or a value retrieved from a beanNames map property using the fully qualified class name of this object.</li><li>All the path, query and matrix parameters which have been initialized during the method execution</li><li>"absolute.path", "base.path" and "relative.path" obtained from the current UriInfo</li></ul> - - - -<p>Here are some examples. Lets assume we have a book.war web application deployed.</p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ -<jaxrs:server id="bookservice1" address="/bookstore1"> +</div><h1 id="JAX-RSRedirection-WithRequestDispatcherProvider">With RequestDispatcherProvider</h1><p><a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java">RequestDispatcherProvider</a> is a JAXRS MessageBodyWriter which can redirect to JSP pages, named or default servlets. It can be used to serve all the responses from a given resource class or restricted to serving a limited set of classes only using a classResources map property.</p><p>Starting from CXF 2.5.0 and 2.4.4 it is also possible to specify that only responses to requests with matching URIs that will be processed.</p><p>At the moment, this provider is statically configured to support text/html content types, but it can be easily configured to support other content types if needed.</p><p>In addition to 'resourcePath' and 'dispatcherName' properties, one can set a 'scope' property which has two possi ble values, 'request' and 'session' with 'request' being the default value. It affects the way the JSP code can retrieve parameters passed to it by the RequestDispatcherProvider. If it is a 'request' scope then all the parameters are set as the attributes on the current HTTP request. If session scope then they're set as the attributes on the current HTTP session.</p><p><code>RequestDispatcherProvider</code> sets the following parameters :</p><ul class="alternate"><li>JAXRS method response object. The name of this parameter is either a simple class name of this object (lower case) or a value retrieved from a beanNames map property using the fully qualified class name of this object.</li><li>All the path, query and matrix parameters which have been initialized during the method execution</li><li>"absolute.path", "base.path" and "relative.path" obtained from the current UriInfo</li></ul><p>Here are some examples. Lets assume we have a book.war web application deployed.</p><div class="c ode panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<jaxrs:server id="bookservice1" address="/bookstore1"> <jaxrs:serviceBeans> <bean class="org.apache.cxf.systest.jaxrs.BookStoreDispatch"/> </jaxrs:serviceBeans> @@ -164,27 +141,14 @@ div.rbtoc1408383988577 li {margin-left: </bean> ]]></script> -</div></div> - -<p>The above redirects the response to a default book.html page which is available directly in the /webapps/book folder. Typically one would do it to return some static confirmation to the client. For example, consider a POST form request that has been processed by a given JAX-RS method and the only thing that needs to be done now is to return the HTML confirmation view. Note that JAX-RS MessageBodyWriters are not invoked if the resource method returns no custom object - which is not needed in the case of the static confirmation, so for RequestDispatcherProvider be able to redirect to book.html one should simply introduce say an EmptyConfirmation bean with no properties and return it from the resource method.</p> - -<p>Here is another example (omitting jaxrs:server declaration for brewity):</p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ - -<bean id="dispatchProvider" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> +</div></div><p>The above redirects the response to a default book.html page which is available directly in the /webapps/book folder. Typically one would do it to return some static confirmation to the client. For example, consider a POST form request that has been processed by a given JAX-RS method and the only thing that needs to be done now is to return the HTML confirmation view. Note that JAX-RS MessageBodyWriters are not invoked if the resource method returns no custom object - which is not needed in the case of the static confirmation, so for RequestDispatcherProvider be able to redirect to book.html one should simply introduce say an EmptyConfirmation bean with no properties and return it from the resource method.</p><p>Here is another example (omitting jaxrs:server declaration for brewity):</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<bean id="dispatchProvider" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> <property name="resourcePath" value="/book.jsp"/> </bean> ]]></script> -</div></div> - -<p>The only difference from the previous example is that "/book.jsp" will be delegated to with the task of creating a view. This is a more interesting example and we presume that the resource method returns say an instance of the "org.bar.Book" bean:</p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ -@Path("/books") +</div></div><p>The only difference from the previous example is that "/book.jsp" will be delegated to with the task of creating a view. This is a more interesting example and we presume that the resource method returns say an instance of the "org.bar.Book" bean:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[@Path("/books") public Resource { @GET @Produces({"text/html", "application/xml"}) @@ -194,16 +158,8 @@ public Resource { } } ]]></script> -</div></div> - -<p>Note how non-intrusive RequestDispatcherProvider is as far as writing the JAX-RS resource code is concerned, you simply list supported media types in @Produces as usual. </p> - -<p>RequestDispatcherProvider will make an instance of Book available as an HttpServletRequest attribute named "org.bar.Book" by default. this can be customized. If a "beanName" property is set, for example to "book", then book.jsp will access a Book instance as a "book" attribute. If you have say 2 resource methods returning instances of different bean classes, possibly for different view handlers then a beanNames map property can be used, for example: </p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ - -<bean id="dispatchProvider" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> +</div></div><p>Note how non-intrusive RequestDispatcherProvider is as far as writing the JAX-RS resource code is concerned, you simply list supported media types in @Produces as usual.</p><p>RequestDispatcherProvider will make an instance of Book available as an HttpServletRequest attribute named "org.bar.Book" by default. this can be customized. If a "beanName" property is set, for example to "book", then book.jsp will access a Book instance as a "book" attribute. If you have say 2 resource methods returning instances of different bean classes, possibly for different view handlers then a beanNames map property can be used, for example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<bean id="dispatchProvider" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> <property name="classResources"> <map> <entry key="org.bar.Book" value="/book.jsp"/> @@ -219,18 +175,8 @@ public Resource { </bean> ]]></script> -</div></div> - -<p>The above configuration says that a "book.jsp" resource will handle an instance of Book by accessing it as a "book" attribute and a "customer.jsp" - an instance of Customer by retrieving it as a "customer" attribute. Note you don't need to use the "beanNames" property in such cases, a simpler "beanName" property can do unless you have a single (jsp) resource dealing with both Book and Customer. </p> - -<p>Apart from making an instance of response class available as HttpServletRequest attribute, RequestDispatcherProvider will also make all the Path, Query and Matrix parameters available as HttpServletRequest parameters (as opposed to attributes) by default. For example, given the above code fragment, an HttpServletRequest parameter named "id" representing a @PathParam("id") available to the view handler, as well as all other query and matrix parameters.<br clear="none"> -Note that RequestDispatcherProvider can be configured to save all these request parameters as HttpServletRequest attributes by setting a boolean saveParametersAsAttributes property to true. </p> - -<p>Now, imagine a scenario like this: we have two resource methods returning a ReservationStatus bean. The first method returns a successful confirmation or uses Response.seeOther(...) to redirect to a method handling the failed reservation. So both methods return the same ReservationStatus bean but we will have two different views handling successful and failed reservations respectively. Here is one way to manage it:</p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ -<bean id="reserveRegistrationViews" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> +</div></div><p>The above configuration says that a "book.jsp" resource will handle an instance of Book by accessing it as a "book" attribute and a "customer.jsp" - an instance of Customer by retrieving it as a "customer" attribute. Note you don't need to use the "beanNames" property in such cases, a simpler "beanName" property can do unless you have a single (jsp) resource dealing with both Book and Customer.</p><p>Apart from making an instance of response class available as HttpServletRequest attribute, RequestDispatcherProvider will also make all the Path, Query and Matrix parameters available as HttpServletRequest parameters (as opposed to attributes) by default. For example, given the above code fragment, an HttpServletRequest parameter named "id" representing a @PathParam("id") available to the view handler, as well as all other query and matrix parameters.<br clear="none"> Note that RequestDispatcherProvider can be configured to save all these request parameters as HttpServlet Request attributes by setting a boolean saveParametersAsAttributes property to true.</p><p>Now, imagine a scenario like this: we have two resource methods returning a ReservationStatus bean. The first method returns a successful confirmation or uses Response.seeOther(...) to redirect to a method handling the failed reservation. So both methods return the same ReservationStatus bean but we will have two different views handling successful and failed reservations respectively. Here is one way to manage it:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<bean id="reserveRegistrationViews" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> <property name="resourcePaths"> <map> <entry key="/reservations/reserve/complete" value="/forms/reservationConfirm.jsp"/> @@ -240,18 +186,8 @@ Note that RequestDispatcherProvider can <property name="beanName" value="data"/> </bean> ]]></script> -</div></div> - -<p>Given that the same ReservationStatus bean is returned in both cases, it is actually the original request URI fragments which are used to match which view handler will deal with a given ReservationStatus, example, a response to request URI "http://localhost:8080/reservations/reserve/complete" will be handled by "/forms/reservationConfirm.jsp". </p> - -<p>Note that RequestDispatcherProvider has a 'dispatcherName' property - that can be handy when redirecting to named servlets (example, MyServlet) including<br clear="none"> -such ones as "jsp" or "default", especially when CXFServlet handling a given invocation has a uri pattern (typically, wildcard) that may also capture the redirection request, see the next section for more information. </p> - -<p>Next, imagine a scenario like this: we have a single resource method accepting some data and the response view will need to be different depending on the status of the request processing. Using enumerations is the most effective option in this case:</p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ -package resource; +</div></div><p>Given that the same ReservationStatus bean is returned in both cases, it is actually the original request URI fragments which are used to match which view handler will deal with a given ReservationStatus, example, a response to request URI "http://localhost:8080/reservations/reserve/complete" will be handled by "/forms/reservationConfirm.jsp".</p><p>Note that RequestDispatcherProvider has a 'dispatcherName' property - that can be handy when redirecting to named servlets (example, MyServlet) including<br clear="none"> such ones as "jsp" or "default", especially when CXFServlet handling a given invocation has a uri pattern (typically, wildcard) that may also capture the redirection request, see the next section for more information.</p><p>Next, imagine a scenario like this: we have a single resource method accepting some data and the response view will need to be different depending on the status of the request processing. Using enumerations is the most effective option in this case:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[package resource; public class Status { UPDATE_SUCCESS, @@ -272,26 +208,14 @@ public class Resource { } } ]]></script> -</div></div> - - -<p>Next, you may have a single JSP handler which will check whether it is Status.UPDATE_SUCCESS or Status.UPDATE_FAILURE and format the response accordingly. In this case a basic RequestDispatcherProvider configuration will do:</p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ - -<bean id="dispatchProvider" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> +</div></div><p>Next, you may have a single JSP handler which will check whether it is Status.UPDATE_SUCCESS or Status.UPDATE_FAILURE and format the response accordingly. In this case a basic RequestDispatcherProvider configuration will do:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<bean id="dispatchProvider" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> <property name="resourcePath" value="/updateStatus.jsp"/> </bean> ]]></script> -</div></div> - -<p>Alternatively you may have a dedicated view handler dealing with the specific status, in this case either: </p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ -<bean id="reserveRegistrationViews" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> +</div></div><p>Alternatively you may have a dedicated view handler dealing with the specific status, in this case either:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<bean id="reserveRegistrationViews" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> <property name="classResources"> <map> <entry key="resource.Status.UPDATE_SUCCESS" value="/forms/updateSuccess.jsp"/> @@ -300,13 +224,8 @@ public class Resource { </property> </bean> ]]></script> -</div></div> - -<p>or, starting from CXF 2.7.1,</p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ -<beans xmlns="http://www.springframework.org/schema/beans" +</div></div><p>or, starting from CXF 2.7.1,</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation=" @@ -333,76 +252,31 @@ http://www.springframework.org/schema/ut </bean> </beans> ]]></script> -</div></div> - -<p>will help.</p> - - -<p>Starting from CXF 2.6.1 it is possible to configure the provider to check if the current class has an associated view handler or not, for example:</p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ -<bean id="viewHandler" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> +</div></div><p>will help.</p><p>Starting from CXF 2.6.1 it is possible to configure the provider to check if the current class has an associated view handler or not, for example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<bean id="viewHandler" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> <property name="dispatcherName" value=jsp""/> <property name="useClassNames" value="true"/> </bean> ]]></script> -</div></div> - -<p>For example, given a simple class name such as "BookInfo", RequestDispatcherProvider will check if a "/WEB-INF/bookInfo.jsp" handler is available or not. The provider will likely be extended to check few more locations as needed. </p> - -<p>RequestDispatcherProvider also checks a "redirect.resource.path" property on the outbound message. If this property is set then it will try to find a RequestDispatcher available on a given path.</p> - - -<p>Finally, a 'servletContextPath' property can be used to have some other ServletContext (as opposed to the current one) be used for RequestDispatcher look-ups. If set then the current ServletContext.getContext(servletContextPath) will be used to get the needed ServletContext.</p> - -<h2 id="JAX-RSRedirection-Loggingredirects">Logging redirects</h2> - -<p>To get RequestDispatcherProvider log the information about redirects, please set a 'logRedirects' property:</p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ -<bean id="reserveRegistrationViews" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> +</div></div><p>For example, given a simple class name such as "BookInfo", RequestDispatcherProvider will check if a "/WEB-INF/bookInfo.jsp" handler is available or not. The provider will likely be extended to check few more locations as needed.</p><p>RequestDispatcherProvider also checks a "redirect.resource.path" property on the outbound message. If this property is set then it will try to find a RequestDispatcher available on a given path.</p><p>A new property, "includeResource" is available starting from CXF 3.0.4: RequestDispatcher.include() instead of RequestDispatcher.forward() will be used if this property is set to true.</p><p>Finally, a 'servletContextPath' property can be used to have some other ServletContext (as opposed to the current one) be used for RequestDispatcher look-ups. If set then the current ServletContext.getContext(servletContextPath) will be used to get the needed ServletContext.</p><h2 id="JAX-RSRedirection-Loggingredirects">Logging redirects</h2><p>To get RequestDispatcherProvider log the information about redirects, please set a 'logRedirects' property:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<bean id="reserveRegistrationViews" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> <property name="logRedirects" value="true"/> <!-- other properties as needed --> </bean> ]]></script> -</div></div> - -<p>You will see the logging entry like this one:</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ -23-Jul-2012 11:26:13 org.apache.cxf.jaxrs.provider.RequestDispatcherProvider logRedirection +</div></div><p>You will see the logging entry like this one:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[23-Jul-2012 11:26:13 org.apache.cxf.jaxrs.provider.RequestDispatcherProvider logRedirection INFO: Setting an instance of "oauth2.common.ConsumerRegistration" as HttpServletRequest attribute "newClient" and redirecting the response to "/forms/registerAppConfirm.jsp" ]]></script> -</div></div> - -<h1 id="JAX-RSRedirection-WithCXFServlet">With CXFServlet</h1> - -<p>Please see the "Redirection" section on the <a shape="rect" href="servlet-transport.html">Servlet Transport</a> page.</p> - -<p>Note that both CXFServlet and JAXRS RequestDispatcherProvider can work together effectively on executing the redirection requests as described at that page.</p> - -<p>If CXFServlet URI pattern does not match the resource URIs RequestDispatcherProvider is redirecting to then there's nothing to worry about. </p> - -<p>If you have CXFServlet listening on "/" (thus effectively catching all the requests) and also would like to use RequestDispatcherProvider, then make sure that a 'dispatcherName' property is also set, for example:</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ -<bean id="dispatchProvider" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> +</div></div><h1 id="JAX-RSRedirection-WithCXFServlet">With CXFServlet</h1><p>Please see the "Redirection" section on the <a shape="rect" href="servlet-transport.html">Servlet Transport</a> page.</p><p>Note that both CXFServlet and JAXRS RequestDispatcherProvider can work together effectively on executing the redirection requests as described at that page.</p><p>If CXFServlet URI pattern does not match the resource URIs RequestDispatcherProvider is redirecting to then there's nothing to worry about.</p><p>If you have CXFServlet listening on "/" (thus effectively catching all the requests) and also would like to use RequestDispatcherProvider, then make sure that a 'dispatcherName' property is also set, for example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<bean id="dispatchProvider" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> <property name="dispatcherName" value="jsp"/> <property name="resourcePath" value="/WEB-INF/jsp/test.jsp"/> </bean> ]]></script> -</div></div> - -<p>If resources which are redirected to can be made public (i.e, moved out of /WEB-INF) then alternative option (instead of adding a 'dispatcherName' property to RequestDispatcherProvider and still have CXFServlet listening on '/') is to configure both RequestDispatcherProvider and CXFServlet to redirect to resources such as "/jsp/test.jsp". </p> - -<p>Also if you have many public view handlers then rather than having a "dispatcherName" property set on every dispatcher bean, you can get it set only once on CXFServlet:</p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ -<servlet> +</div></div><p>If resources which are redirected to can be made public (i.e, moved out of /WEB-INF) then alternative option (instead of adding a 'dispatcherName' property to RequestDispatcherProvider and still have CXFServlet listening on '/') is to configure both RequestDispatcherProvider and CXFServlet to redirect to resources such as "/jsp/test.jsp".</p><p>Also if you have many public view handlers then rather than having a "dispatcherName" property set on every dispatcher bean, you can get it set only once on CXFServlet:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<servlet> <servlet-name>RESTServlet</servlet-name> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> <init-param> @@ -420,14 +294,7 @@ INFO: Setting an instance of "oauth <url-pattern>/*</url-pattern> </servlet-mapping> ]]></script> -</div></div> - -<p>Here we have all the requests targeted at /form/* (example, /form/book.jsp, etc) handled by a jsp handler.</p> - - -<h1 id="JAX-RSRedirection-CustomRedirection">Custom Redirection</h1> - -<p>One can borrow some of the code from RequestDispatcherProvider and do the custom redirection from CXF in interceptors or custom invokers, if you will try to do it then you will also need to set an AbstractHTTPDestination.REQUEST_REDIRECTED property with a 'true' value on a current input message.</p></div> +</div></div><p>Here we have all the requests targeted at /form/* (example, /form/book.jsp, etc) handled by a jsp handler.</p><h1 id="JAX-RSRedirection-CustomRedirection">Custom Redirection</h1><p>One can borrow some of the code from RequestDispatcherProvider and do the custom redirection from CXF in interceptors or custom invokers, if you will try to do it then you will also need to set an AbstractHTTPDestination.REQUEST_REDIRECTED property with a 'true' value on a current input message.</p></div> </div> <!-- Content --> </td>