Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

NOTE: We're publishing endpoints "http://localhost/mycontext/services/Greeter1" and "http://localhost/mycontext/services/GreeterRest", but we set jaxws:endpoint/@address and jaxrs:server/@address to relative values such as "/Greeter1" "/GreeterRest".

Disabling the Services Page

By default, Apache CXF creates a /services page containing a listing of the available endpoints. To disable this listing, configure the Servlet as follows:

Code Block
languagejava
titleDisable Services Listing
<servlet>
    ....
    <init-param>
        <param-name>hide-service-list-page</param-name>
        <param-value>true</param-value>
    </init-param> 
</servlet>


Support for Asynchronous Requests

...

Code Block
xml
xml
<servlet>
    <servlet-name>CXFServlet</servlet-name>
    <display-name>CXF Servlet</display-name>
    <servlet-class>
       org.apache.cxf.transport.servlet.CXFServlet
    </servlet-class>

    <!-- Enable asynchronous requests -->
 
    <async-supported>true</async-supported>

    <load-on-startup>1</load-on-startup> 
</servlet>
servlet>

Anchor
redirecting
redirecting
Redirecting requests and serving the static content

Starting from CXF 2.2.5 it is possible to configure CXFServlet to redirect current requests to other servlets or serve the static resources."

init-param namedescription
redirects-list

...

space separated list of URI patterns; if a given request URI matches one of the patterns then CXFServlet will try to find a RequestDispatcher using the pathInfo of the current HTTP request and will redirect the request to it

...

...

redirect-servlet-path

...

can be used to affect a RequestDispatcher lookup, if specified then it will concatenated with the pathInfo of the current request

...

...

redirect-servlet-name

...

enable a named RequestDispatcher look-up, after one of the URI patterns in the "redirects-list" has matched the current request URI

...

...

static-resources-list

...

space separated list of static resource such as html, css, or pdf files which CXFServlet will serve directly

...

from classpath
static-cache-controlset parameter value to HTTP response Cache-Control header

One can have requests redirected to other servlets or JSP pages.

...

For example, please see this web.xml.

The "http://localhost:9080/the/bookstore1/books/html/123" request URI will initially be matched by the CXFServlet given that it has a more specific URI pattern than the RedirectCXFServlet. After a current URI has reached a jaxrs:server endpoint, the response will be redirected by the JAXRS RequestDispatcherProvider to a "/book.html" address, see "dispatchProvider1" bean here.

...