Modified: websites/production/cxf/content/docs/jaxrs-services-description.html
==============================================================================
--- websites/production/cxf/content/docs/jaxrs-services-description.html
(original)
+++ websites/production/cxf/content/docs/jaxrs-services-description.html Wed
Sep 13 15:05:52 2017
@@ -32,8 +32,8 @@
<link type="text/css" rel="stylesheet"
href="/resources/highlighter/styles/shThemeCXF.css">
<script src='/resources/highlighter/scripts/shCore.js'></script>
-<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
+<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
@@ -121,11 +121,11 @@ Apache CXF -- JAXRS Services Description
 </p><p> </p><p> </p><p> </p><p><style
type="text/css">/*<![CDATA[*/
-div.rbtoc1505311223690 {padding: 0px;}
-div.rbtoc1505311223690 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1505311223690 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1505314892664 {padding: 0px;}
+div.rbtoc1505314892664 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1505314892664 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1505311223690">
+/*]]>*/</style></p><div class="toc-macro rbtoc1505314892664">
<ul class="toc-indentation"><li><a shape="rect"
href="#JAXRSServicesDescription-Swagger">Swagger</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#JAXRSServicesDescription-Swagger-FirstDevelopment">Swagger-First
Development</a></li><li><a shape="rect"
href="#JAXRSServicesDescription-SwaggerAutoGeneration">Swagger Auto
Generation</a></li></ul>
</li><li><a shape="rect" href="#JAXRSServicesDescription-WADL">WADL</a>
@@ -144,7 +144,7 @@ div.rbtoc1505311223690 li {margin-left:
</li><li><a shape="rect"
href="#JAXRSServicesDescription-java2wadlMavenplugin">java2wadl Maven
plugin</a></li><li><a shape="rect"
href="#JAXRSServicesDescription-WADLTransformations">WADL
Transformations</a></li><li><a shape="rect"
href="#JAXRSServicesDescription-ServicelistingsandWADLqueries">Service listings
and WADL queries</a></li><li><a shape="rect"
href="#JAXRSServicesDescription-WADLinJSONformat">WADL in JSON
format</a></li></ul>
</li><li><a shape="rect"
href="#JAXRSServicesDescription-HidinglinkstoJAXRSendpointsfromtheservicespage">Hiding
links to JAXRS endpoints from the services page</a></li></ul>
</div><h1 id="JAXRSServicesDescription-Swagger">Swagger</h1><h2
id="JAXRSServicesDescription-Swagger-FirstDevelopment">Swagger-First
Development</h2><h2 id="JAXRSServicesDescription-SwaggerAutoGeneration">Swagger
Auto Generation</h2><p>Please see the <a shape="rect"
href="http://cxf.apache.org/docs/swagger2feature.html">Swagger2Feature page</a>
for more information</p><h1
id="JAXRSServicesDescription-WADL">WADL</h1><p> </p><p>CXF JAX-RS supports
(Web Application Description Language|http://www.w3.org/Submission/wadl]
(WADL). <br clear="none"> Users can use WADL documents to generate the initial
code and have WADL auto-generated on demand.</p><h2
id="JAXRSServicesDescription-Overview">Overview</h2><p>WADL is a
resource-centric description language which has been designed to facilitate the
modeling, description and testing of<br clear="none"> RESTful Web applications.
Please check the official <a shape="rect" class="external-link"
href="http://www.w3.org/Submission/wadl/" rel="no
follow">page</a> for more information, this section provides a brief overview
of main WADL constructs.</p><h3
id="JAXRSServicesDescription-Basicexample">Basic example</h3><p>A top level
WADL document element is called "application". Usually it may contain a
"grammars" section and "resources" element with one or more top-level
"resource" elements, with each one representing a specific root resource, for
example:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><application
xmlns="http://wadl.dev.java.net/2009/02" xmlns:ns="http://superbooks">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><application
xmlns="http://wadl.dev.java.net/2009/02" xmlns:ns="http://superbooks">
<grammars>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://superbooks" attributeFormDefault="unqualified"
elementFormDefault="unqualified"
@@ -181,7 +181,7 @@ div.rbtoc1505311223690 li {margin-left:
</application>
</pre>
</div></div><p>This document describes an application that has
"http://localhost:8080/" base URI. It can handle GET requests such as<br
clear="none"> "http://localhost:8080/bookstore/1",
"http://localhost:8080/bookstore/123", etc. Additionally it can handle similar
GET requests at<br clear="none"> "http://localhost:8080/books/bookstore/1",
"http://localhost:8080/books/bookstore/123", etc, note an extra "books" path
segment.</p><p>"application/xml" media type is supported and response
representation elements link to "{<a shape="rect" class="external-link"
href="http://superbooks" rel="nofollow">http://superbooks</a>}thebook" element
declared in a schema inlined in the grammars section.</p><p>Note that
"resources" element has two child "resource" elements, one with
"/bookstore/{id}" path, another one with "/books" path.</p><p>These 2 resources
can be represented as JAX-RS root resources. For example, these resources can
be mapped to concrete Java classes such as BookStoreRootResource
with @Path("/bookstore/{id}") and BooksResource with @Path("/books").
BookStoreRootResource root resource will have a single @GET resource method
with no @Path, presumably returning Book (JAXB) bean. The second BooksResource
root resource will have a single subresource locator with
@Path("/bookstore/{id}") which will return a subresource with a single @GET
resource method.</p><p>This is just one possible interpretation of how the
above WADL description can be mapped to JAX-RS resources and
methods.</p><p>Also note that the resource with the "/books" path has another
child resource with the "/bookstore/{id}" path, but it could've had a
"/books/bookstore/{id}" path instead and no child resource.</p><h3
id="JAXRSServicesDescription-WADLwithreferences">WADL with
references</h3><p>Basic WADL example in the previous section shows a "grammars"
section with the inlined schema, as well as a "resource" description with the
"/bookstore/{id}" path listed twice, as an immediate child of the "res
ources" and as a child of the "resource" element with the "/books"
path.</p><p>Note that inlined schemas can be included instead by referencing
external schemas. Likewise, most of WADL element declarations such as
"resource", "method", "representation", etc can be shared by using the same
document or external references. Here is how the basic example can be
simplified with the help of references:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><application
xmlns="http://wadl.dev.java.net/2009/02" xmlns:ns="http://superbooks">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><application
xmlns="http://wadl.dev.java.net/2009/02" xmlns:ns="http://superbooks">
<grammars>
<include href="schemas/book.xsd"/>
</grammars>
@@ -209,7 +209,7 @@ div.rbtoc1505311223690 li {margin-left:
</application>
</pre>
</div></div><p>Note that a book.xsd schema resource located in the 'schemas'
path relative to the location of this WADL document is referenced using
wadl:include element. Abstract resource type "bookResource" is declared as an
immediate child of wadl:application and is linked to concrete resource elements
using a "#bookResource" reference.</p><h3
id="JAXRSServicesDescription-SharingdeclarationsbetweenmultipleWADLs">Sharing
declarations between multiple WADLs</h3><p>WADL references allow for having
WADL documents with abstract declarations only and concrete WADLs referencing
them, thus making it possible to reuse resource declarations in different web
application descriptions.</p><p>For example, the following baseApplication.wadl
documents describes an abstract "bookResource" resource:</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><application
xmlns="http://wadl.dev.java.net/2009/02" xmlns:ns="http://superbooks">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><application
xmlns="http://wadl.dev.java.net/2009/02" xmlns:ns="http://superbooks">
<grammars>
<include href="schemas/book.xsd"/>
</grammars>
@@ -225,7 +225,7 @@ div.rbtoc1505311223690 li {margin-left:
</application>
</pre>
</div></div><p>and this WADL document links to the abstract resource by using
an external WADL reference with a "baseResource" fragment.</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><application
xmlns="http://wadl.dev.java.net/2009/02" xmlns:ns="http://superbooks">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><application
xmlns="http://wadl.dev.java.net/2009/02" xmlns:ns="http://superbooks">
<resources base="http://localhost:8080/">
<resource path="/bookstore/{id}"
type="baseApplication.wadl#bookResource"/>
@@ -236,7 +236,7 @@ div.rbtoc1505311223690 li {margin-left:
</application>
</pre>
</div></div><p><strong>New</strong>: Starting from CXF 2.5.0 and 2.4.4 all
WADL elements may link to top-level local declarations, see this <a
shape="rect" class="external-link"
href="http://www.w3.org/Submission/wadl/#x3-36000A.2"
rel="nofollow">example</a>.</p><h2
id="JAXRSServicesDescription-WADL-firstDevelopment">WADL-first
Development</h2><p>CXF 2.4.1 introduces a wadl2java code generator and
cxf-wadl2java-plugin Maven plugin which can be used to generate server and
client JAX-RS code and speed up the transition between modeling and
implementation stages.</p><p><strong>Note</strong> If you are looking for a
wadl2java code generator from a Java.net project started by Marc Hadley then
please follow this <a shape="rect" class="external-link"
href="http://wadl.java.net/wadl2java.html" rel="nofollow">link</a>.</p><p>Code
generator expects WADL resource and method elements to have "id" attributes set
which can provide hints on how to name generated classes and methods. For
example:</
p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><application
xmlns="http://wadl.dev.java.net/2009/02" xmlns:ns="http://superbooks">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><application
xmlns="http://wadl.dev.java.net/2009/02" xmlns:ns="http://superbooks">
<grammars>
<include href="schemas/book.xsd"/>
</grammars>
@@ -262,7 +262,7 @@ div.rbtoc1505311223690 li {margin-left:
-validate -h -v -verbose -quiet <wadl>
</pre>
</div></div><p>Note 'tMap', 'repMap', 'noTypes' and 'inheritResourceParams'
options are supported starting from CXF 2.6.3, 'noVoidForEmptyResponses' - from
2.6.4, '-async' - from 2.7.1, '-xjc' - from
2.7.4,</p><p>'generateResponseForMethods' and 'generateResponseIfHeadersSet' -
from 2.7.12/3.0.0, 'validate' - from 2.7.13/3.2.0/3.1.0, 'javaDocs' - from
3.1.4, 'authorization' - from 3.1.13</p><p>The options are reviewed in the
following table.</p><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>Option</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Interpretation</p></th></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>-?</code>,<code>-h</code>,<code>-help</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Displays the online help for
this utility and exits.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>-p PackageName</code></p></td><td colspa
n="1" rowspan="1" class="confluenceTd"><p>Specifies the package name of root
resource classes</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>-sp [ schema-namespace= ]
PackageName</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Specifies one or more package names corresponding to
individual schema namespaces</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>-resource RootResourceName</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies a full name of root
resource class if WADL contains a single resource</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>-interface</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Default option unless -impl option is used
- Java interfaces with JAX-RS annotations are generated</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>-impl</code></p></td><td
colspan="1" rowspan="1" class="confluenc
eTd"><p>Generates starting implementation code. Can also be used with
-interface option</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>-noTypes</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Requests that no schema generation is
needed. Can also be used with -tMap option</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>-tMap
schema-type=java-type</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Provides mapping between schema elements and java
types</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>-repMap media-type=java-type</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Provides mapping between media
types and java types</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>-b binding-name</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies JAXB binding files. Use multiple
-b flags to specify multipl
e entries.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>-catalog catalog-file-name</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies catalog file to map
referenced wadl/schemas</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>-d output-directory</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the directory into
which the generated code files are written.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>-compile</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Compiles generated Java
files.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>-classdir compile-class-dir</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the directory into
which the compiled class files are written.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>-noVoidForEmptyResponses</co
de></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Generate
JAX-RS Response instead of 'void' for methods with no response
representations.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>-inheritResourceParams</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Get current resource-level path
or matrix parameters added to generated methods for all descendant
resources.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>-generateEnums</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Generates Java enums for parameters with
options.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>-supportMultipleXmlReps</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Generates separate method for
every XML representation in a single WADL request element.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">-javaDocs</td><td colspan="1"
rowspan="1"
class="confluenceTd">Converts WADL doc elements into
JavaDocs</td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd">-generateResponseIfHeadersSet</td><td colspan="1"
rowspan="1" class="confluenceTd">Generates JAX-RS Response method response type
if  WADL response element for a given method has 'header'
parameters</td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd">-generateResponseForMethods methodNames</td><td
colspan="1" rowspan="1" class="confluenceTd">Generates JAX-RS Response method
response type, methodNames is a comma-separated list of WADL method name or id
attributes</td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>-async methodNames</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Adds JAX-RS 2.0 AsyncResponse parameter to
generated methods, methodNames is a comma-separated list of WADL method name or
id attributes</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd">-authorization</td><td colspan
="1" rowspan="1" class="confluenceTd"><p>Specifies a colon separated user name
and password for retrieving the remote WADL content from the servers requiring
Basic authentication</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>-xjc<xjc args></code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies a comma separated
list of arguments that are passed directly to the XJC processor, example
-xjc-Xts.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd">-validate</td><td colspan="1" rowspan="1"
class="confluenceTd">Validate a WADL document against the WADL
schema</td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><em>wadlurl</em></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>The path and name of the WADL file to use in generating
the code.</p></td></tr></tbody></table></div><p>You must specify the absolute
or relative path to the WADL document as the last argument.<br clear="none">
OASIS catalog
files can be used to help the tool resolve referenced WADL and schema
documents.</p><p>Note 'tMap' option can be used to map between schema element
references and java types and can be used to customize the default schema to
Java type mapping. For example, in order to override a default parameter
'xs:date' to java.util.Date mapping one can do '-tMap {<a shape="rect"
class="external-link" href="http://www.w3.org/2001/XMLSchema"
rel="nofollow">http://www.w3.org/2001/XMLSchema</a>}date=javax.xml.datatype.XMLGregorianCalendar'
- this can affect the "<wadl:param type='xs:date'>" declarations.<br
clear="none"> Alternatively, in combination with a '-noTypes' switch, this
option can be used to request that a custom Java type reference should be
generated. For example, if one prefers to use 'javax.xml.transform.Source' for
handling a given XML payload, one can do <br clear="none"> '-tMap {<a
shape="rect" class="external-link" href="http://book"
rel="nofollow">http://book</a>}Book=java
x.xml.transform.Source', this will affect "<wadl:representation
element='ns:Book'>" declarations where 'ns' prefix is bound to the
'http://book' namespace. Similarly, a schema reference to Atom Feed element can
be mapped to say Abdera Feed class.</p><p>The 'repMap' option is similar and
provides a mapping between the representations of a given media type and Java
type. For example, if one has to process different XML representations in one
method, a mapping like '-repMap application/xml=javax.xml.transform.Source'
will work, affecting declarations like "<wadl:representation
mediaTpe='application/xml'". Similarly CXF
org.apache.cxf.jaxrs.ext.multipart.MultipartBody class can be linked to
'multipart/form-data' representations, etc.</p><p>The
'generateResponseForMethods' and 'async' options accept a comma separated list
of method names, providing a single '*' (no quotes) as a method name will get
these options affecting all of the generated methods.</p><p>In some cases,
exampl
e when describing JSON arrays, you may want to have an explicit collection of
types defined in schema generated. In this case use -tMap or -repMap option
with a value such as "List..MyType".</p><p> </p><h4
id="JAXRSServicesDescription-JAXBcustomizations">JAXB customizations</h4><p>At
the moment it is possible to apply external JAXB customizations to WADL
grammars however it is not possible yet to restrict a given customization to a
specific WADL document or explicitly inlined schema. Linking binding to
external schemas works, for example, the following bindings file can be
used:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><jaxb:bindings version="2.0"
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><jaxb:bindings version="2.0"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
schemaLocation="schemas/book.xsd"
@@ -271,12 +271,12 @@ div.rbtoc1505311223690 li {margin-left:
</jaxb:bindings>
</pre>
</div></div><h3 id="JAXRSServicesDescription-wadl2javaMavenplugin">wadl2java
Maven plugin</h3><p>If you need the code generated during Maven build then the
following plugin can be used:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><groupId>org.apache.cxf</groupId>
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><groupId>org.apache.cxf</groupId>
<artifactId>cxf-wadl2java-plugin</artifactId>
<version>2.4.1</version>
</pre>
</div></div><p>Add this plugin to the build section of your project's pom and
specify a 'wadl2java' goal, for example:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><build>
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
@@ -311,7 +311,7 @@ div.rbtoc1505311223690 li {margin-left:
</build>
</pre>
</div></div><p>Note that the minimum and maximum memory limits may need to be
increased when using the plugin to process large WADL documents, for example,
add "-Xms512M -Xmx1024M" to the list of Maven options.</p><p>CXF will generate
artifacts in the <sourceRoot> directory. Configuration arguments which
are included inside the <wadlOption> element are used to pass arguments
to the tooling and correspond to the options outlined in the wadltojava
section, they can be specified explicitly, as above, or using an "extraargs"
wrapper, for example:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><wadlOptions>
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><wadlOptions>
<wadlOption>
<wadl>$\{basedir}/src/main/wadl/bookStore.wadl</wsdl>
<extraargs>
@@ -322,26 +322,26 @@ div.rbtoc1505311223690 li {margin-left:
</wadlOptions>
</pre>
</div></div><h3
id="JAXRSServicesDescription-Integration">Integration</h3><p>Two options are
available to developers who wish to integrate CXF JAX-RS WADLToJava code
generator.<br clear="none"> First option is to pass the collected options
directly to a wadltojava process.</p><p>Another approach is to use
org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer class shipped with the
cxf-tools-wadlto-jaxrs module:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><groupId>org.apache.cxf</groupId>
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><groupId>org.apache.cxf</groupId>
<artifactId>cxf-tools-wadlto-jaxrs</artifactId>
<version>2.4.1</version>
</pre>
</div></div><p>Please see CXF source for more details and
org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainerTest in particular.</p><h3
id="JAXRSServicesDescription-ExternalWADLdocumentsandJAXRSendpoints.">External
WADL documents and JAXRS endpoints.</h3><p>External WADL documents can be
linked to from jaxrs:server endpoints using newly introduced "docLocation"
attribute, for example:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><jaxrs:server address="/rest"
docLocation="wadl/bookStore.wadl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><jaxrs:server address="/rest"
docLocation="wadl/bookStore.wadl">
<jaxrs:serviceBeans>
<bean class="org.bar.generated.BookStore"/>
</jaxrs:serviceBeans>
</jaxrs:server>
</pre>
</div></div><p>If external WADL documents include external schemas and jaxrs
endpoints need to have the schema validation enabled, then those schemas can be
referenced in the jaxrs:schemaLocations section as well.</p><h2
id="JAXRSServicesDescription-WADLAutoGenerationatRuntime">WADL Auto Generation
at Runtime</h2><p>Note that in CXF 3.0.0 WADL Generator code has been moved
to</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><dependency>
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description</artifactId>
<version>3.0.0-milestone1</version>
</dependency>
</pre>
</div></div><p>CXF JAX-RS supports the auto-generation of WADL for JAX-RS
endpoints. <br clear="none"> Note that JAX-RS subresources are late-resolved by
default, so using annotated interfaces for subresources and a
staticSubresourceResolution=true property will let the whole resource
tree/graph be described in a generated instance. Schemas will be generated for
JAXB-annotated types. See below for the information on how to get
auto-generated WADL instances reference existing schemas.</p><p><strong>CXF
2.4.0</strong>: org.apache.cxf.jaxrs.ext.Description and
org.apache.cxf.jaxrs.ext.xml.XMLName have been moved to
org.apache.cxf.jaxrs.model.wadl package given that their purpose is to improve
the WADL generation. Also, org.apache.cxf.jaxrs.model.wadl.WadlElement has been
renamed to 'ElementClass'.</p><h3
id="JAXRSServicesDescription-DocumentingresourceclassesandmethodsingeneratedWADL">Documenting
resource classes and methods in generated WADL</h3><p>WADL documents can
include <a shape=
"rect" class="external-link"
href="http://www.w3.org/Submission/wadl/#x3-80002.3" rel="nofollow">doc</a>
fragments.</p><p>Users may want to use <a shape="rect" class="external-link"
href="https://github.com/apache/cxf/tree/master/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/Description.java"
rel="nofollow">Description</a> annotations which can be attached to resource
classes and methods.</p><p>Note that starting from CXF 2.4.0, Description
annotations can be applied to input parameters. Additionally, a method-level <a
shape="rect" class="external-link"
href="https://github.com/apache/cxf/tree/master/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/Descriptions.java"
rel="nofollow">Descriptions</a> annotation can have a collection of
categorized Description annotations, with each Description targeting a specific
WADL element by setting its 'target' property to one of the <a shape="rect"
class="external-link" href="https://github.com/apache/cxf/tree/m
aster/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/DocTarget.java"
rel="nofollow">DocTarget</a> values. For example, one can use a Descriptions
annotation to document the response representation of a particular resource
method, as well as add documentation fragments to WADL wadl:method/wadl:request
and wadl:method/wadl:response elements:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">@POST
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@POST
@Path("books/{bookid}")
@Descriptions({
@Description(value = "Adds a new book", target = DocTarget.METHOD),
@@ -353,7 +353,7 @@ div.rbtoc1505311223690 li {margin-left:
public Book addBook(@Description("book id") @PathParam("id") Long id,
@Description("New Book") Book book) {...}
</pre>
</div></div><p>Every unique @Path value adds a new 'resource' element to the
generated WADL, thus the last Description annotation in the @Descriptions array
ensures the doc extension is also added to the 'resource' element. Note that
multiple resource methods having different HTTP methods but sharing the same
@Path value will have the same parent 'resource' element representing this
shared path fragment, in this case a Description with the DocTarget.RESOURCE
target will be ignored unless it is added to the first resource method with
this shared @Path:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">@POST
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@POST
@Path("books/{bookid}")
@Description(value = "Resource", target = DocTarget.RESOURCE),
public Book addBook(@Description("book id") @PathParam("id") Long id,
@Description("New Book") Book book) {...}
@@ -363,34 +363,34 @@ public Book addBook(@Description("book i
public Book addBook(@Description("book id") @PathParam("id") Long id) {...}
</pre>
</div></div><h4 id="JAXRSServicesDescription-SupportforJavadoc">Support for
Javadoc</h4><p>In CXF 3.0.0 one can get the Javadoc documentation copied to
WADL being auto-generated at
runtime.</p><p>org.apache.cxf.jaxrs.model.wadl.JavaDocProvider implements
org.apache.cxf.jaxrs.model.wadl.DocumentationProvider and can be set as
WADLGenerator "documentationProvider" property.</p><p>JavaDocProvider can be
customized with URL or relative String path pointing to the generated Javadoc
jar, so this jar can be shipped in the application war or located
elsewhere.</p><p>JavaDocProvider parses the generated Javadoc HTML pages and
scrapes the documentation. See Java to Wadl section on the alternative approach
for supporting Javadoc.</p><h3
id="JAXRSServicesDescription-CustomizingWADLGeneration">Customizing WADL
Generation</h3><p>One can register a custom WadlGenerator as a jaxrs:provider.
The custom generator can extend the default <br clear="none">
org.apache.cxf.jaxrs.model.wadl.WadlGenerator o
r register a default one with one of the following properties set.</p><ul
class="alternate"><li>wadlNamespace: default is
"http://wadl.dev.java.net/2009/02", the earlier one is
"http://research.sun.com/wadl/2006/10".</li><li>singleResourceMultipleMethods:
default is 'true', for example, if a resource class has multiple methods
supported at the same path such as "/" (GET, POST, etc) then WADL will list
them all as the child nodes of a single resource
element.</li><li>useSingleSlashResource: default is false, for example, if you
have a root resource class with a path "root" and a resource method with a path
"" or "/" then a WADL resource representing the root will not have a child
resource representing this resource method (it would do if a resource method
had a more specific path such as "bar").</li></ul><p>Starting from CXF 2.4.1
and 2.3.5 the following properties are also supported:</p><ul
class="alternate"><li>applicationTitle: can be used to create an application
title.</li><li>n
amespacePrefix: defaut is 'prefix', it can be set to other value such as
'ns'.</li><li>ignoreForwardSlash: can be used to enforce that resource path
values do not start from '/'</li><li>addResourceAndMethodIds: WadlGenerator
will add "id" attributes to wadl:resource and wadl:method
elements</li></ul><p>An <a shape="rect" class="external-link"
href="https://github.com/apache/cxf/tree/master/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/xml/ElementClass.java"
rel="nofollow">ElementClass</a> annotation can help with representing JAX-RS
Response elements in the generated WADL.</p><h4
id="JAXRSServicesDescription-RepresentingexplicitJAXBcollections">Representing
explicit JAXB collections</h4><p>Starting from CXF 2.5.5 and 2.6.2 it is
possible to get explicit collections represented in generated WADL grammar
sections and have WADL representations linking to these schema elements. Note
it is only possible for JAXB collections, for example:</p><div class="code
panel pdl" style=
"border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">@GET
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@GET
@Path("books")
@org.apache.cxf.jaxrs.model.xml.XMLName("{http://books}books")
public List<Book> getBooks() {...}
</pre>
</div></div><p>Given the above example, WADLGenerator will attempt to add a
'books' element to the generated schema with the targetNamespace set to
"http://books". This 'books' element will have a sequence of elements linking
to a type representing the "Book" class.</p><h4
id="JAXRSServicesDescription-RepresentingexternalschemasandnonJAXBtypes">Representing
external schemas and non JAXB types</h4><p>By default, the WADL grammar
section will be properly generated if resource methods accept or return JAXB
types.</p><p>Even when you do use JAXB, the JAXB types may have been generated
from the external schema so having WadlGenerator attempting to recreate the
original schema may not work well. To have a generated WADL referencing the
original schema(s) please set a 'schemaLocations' list property
(programmatically or from Spring) :</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">WadlGenerator wg = new WadlGenerator();
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">WadlGenerator wg = new WadlGenerator();
wg.setSchemaLocations(Collections.singletonList("classpath:/book.xsd"));
</pre>
</div></div><p>In this case the grammar section will have the 'book.xsd'
schema inlined. If this schema imports other schemas then the imports with
relative URIs will be replaced by the absolute URIs based on the current
endpoint's base address. For example, if the endpoint address is
"http://somehost/bar" and the 'book.xsd' imports "foo/book1.xsd" then the
published WADL will contain an "http://somehost/bar/foo/book1.xsd". At the
moment a custom RequestHandler filter will have to be registered to serve
resources such as "http://somehost/bar/foo/book1.xsd" which can 'calculate'
which resource is required get the absolute request URI and comparing it with
the base URI, possibly with the help of the injected JAXRS UriInfo context.
Alternatively, resources such as book1.xsd may be served by CXFServlet itself
(see the Redirection with CXFServlet)</p><p>TODO : add ignoreImports flag so
that users can list root and imported schemas in "schemaLocations" and have
them all inlined.</p><p>Not
e that the root schema such as "book.xsd" is inlined - you can have it
referenced only by setting an 'externalLinks' list property. This will work
very well when the "book.xsd" is indeed available at the external URI, but this
property can also be used to avoid the local schemas being inlined. Moreover,
the use of JAXB will not be required. The result will look like this:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><wadl:grammars>
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><wadl:grammars>
<wadl:include href="http://books.xsd"/>
</wadl:grammars>
</pre>
</div></div><p>Note that "schemaLocations" and "externalLinks" properties
differ in that the schemas referenced by the former one are inlined.</p><p>You
can also customize the way schema elements are referenced. When WadlGenerator
creates WADL representation elements (representing resource method input or
output types) it will be able to link to schema elements provided a given type
is actually a JAXB one, so the result may look like this :</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><!--
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><!--
thebook2 element is declared in a schema inlined in or referenced from the
grammar section
prefix1 is bound to that schema's target namespace and is declared at the
wadl:application element
-->
<representation mediaType="application/xml" element="prefix1:thebook2"/>
</pre>
</div></div><p>If no JAXB is used then you can attach an <a shape="rect"
class="external-link"
href="https://github.com/apache/cxf/tree/master/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/xml/XMLName.java"
rel="nofollow">XMLName</a> annotation to method input or output types.
Alternatively, you can register an instance of <a shape="rect"
class="external-link"
href="https://github.com/apache/cxf/tree/master/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/ElementQNameResolver.java"
rel="nofollow">ElementQNameResolver</a> with the WadlGenerator which will be
used for creating wadl:representation/@element values.</p><h4
id="JAXRSServicesDescription-Changingthebaseaddress">Changing the base
address</h4><p>Starting from CXF 2.6.2 it is possible to affect the base
address specified in the auto-generated WADL (in wadl:resources/@base
attribute).<br clear="none"> WADLGenerator can be indirectly configured by
setting a jaxrs:server/@publishedEndpointUrl attribute
, similarly to the way CXF WSDL generator can be configured by setting a
jaxws:endpoint/@publishedEndpointUrl attribute.</p><p> </p><h2
id="JAXRSServicesDescription-java2wadlMavenplugin">java2wadl Maven
plugin</h2><p>CXF 3.0.0 and 2.7.11 introduce java2wadl plugin for generating
WADL at the build time:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><groupId>org.apache.cxf</groupId>
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><groupId>org.apache.cxf</groupId>
<artifactId>cxf-java2wadl-plugin</artifactId>
<version>3.0.0</version>
</pre>
</div></div><p>Add this plugin to the build section of your project's pom, for
example:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;"><build>
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><build>
<plugins>
<plugin>
@@ -431,13 +431,13 @@ wg.setSchemaLocations(Collections.single
</build>
</pre>
</div></div><p>Note that Javadoc can be properly supported by enabling the
"parsejavadoc" execution and a docProvider property.</p><h2
id="JAXRSServicesDescription-WADLTransformations">WADL
Transformations</h2><p>Starting from CXF 3.0.4 it is possible to configure
WADLGenerator with a 'stylesheetReference' property pointing to a local XSLT
template. </p><p>If an 'applyStylesheetLocally' property is disabled
(default) then a generated WADL XML representation will include an XML XSLT
processing instruction pointing to a template with the browser downloading it
in the next step and doing the transformation itself. Otherwise WADLGenerator
will attempt to do a local transformation before returning a response to the
browser.</p><p>This feature can help with further enhancing the generated WADL
XML with some simple transformations (example, adding some information to WADL
XML that is not possible to get from the annotated JAX-RS resources) or convert
it to HTML.</p><h2 id="JAXRSServic
esDescription-ServicelistingsandWADLqueries">Service listings and WADL
queries</h2><p>Links to WADL instances for RESTful endpoints are available from
{base endpointaddress}/services, in addition to SOAP endpoints if
any.</p><p>For example, given</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">Base address : 'http://localhost:8080'
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">Base address : 'http://localhost:8080'
WAR name : 'store'
CXFServlet : '/books/*'
jaxrs:server/@address = '/orders'
</pre>
</div></div><p>and visiting</p><p>> <a shape="rect" class="external-link"
href="http://localhost:8080/store/books"
rel="nofollow">http://localhost:8080/store/books</a> <br clear="none"> > <a
shape="rect" class="external-link"
href="http://localhost:8080/store/books/services"
rel="nofollow">http://localhost:8080/store/books/services</a></p><p>will let
you see all the WADL links.</p><p>Note that you can override the location at
which listings are provided (in case you would like '/services' be available to
your resources) using 'service-list-path' CXFServlet parameter,
example:</p><p>> 'service-list-path' = '/listings'</p><p>Going to the
service listings page is not the only way to see WADL instances, one can also
get it using a ?_wadl query.</p><p>> <a shape="rect" class="external-link"
href="http://localhost:8080/store/books/orders?_wadl"
rel="nofollow">http://localhost:8080/store/books/orders?_wadl</a></p><p>will
give you the description of all the root resource classes
registered<br clear="none"> with a given jaxrs:server endpoint.</p><p>For
example, if the following 2 root resource classes has been registered with this
endpoint:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">@Path("/fiction")
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@Path("/fiction")
public class FictionBookOrders {
}
@Path("/sport")
Modified: websites/production/cxf/content/docs/jaxrs-testing.html
==============================================================================
--- websites/production/cxf/content/docs/jaxrs-testing.html (original)
+++ websites/production/cxf/content/docs/jaxrs-testing.html Wed Sep 13 15:05:52
2017
@@ -32,9 +32,9 @@
<link type="text/css" rel="stylesheet"
href="/resources/highlighter/styles/shThemeCXF.css">
<script src='/resources/highlighter/scripts/shCore.js'></script>
-<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
-<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
<script src='/resources/highlighter/scripts/shBrushBash.js'></script>
+<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
+<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
@@ -122,22 +122,22 @@ Apache CXF -- JAXRS Testing
 </p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1505311213624 {padding: 0px;}
-div.rbtoc1505311213624 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1505311213624 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1505314974713 {padding: 0px;}
+div.rbtoc1505314974713 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1505314974713 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1505311213624">
+/*]]>*/</style></p><div class="toc-macro rbtoc1505314974713">
<ul class="toc-indentation"><li><a shape="rect"
href="#JAXRSTesting-EmbeddedJetty">Embedded Jetty</a></li><li><a shape="rect"
href="#JAXRSTesting-LocalTransport">Local Transport</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#JAXRSTesting-MockingHTTPcontexts">Mocking HTTP contexts</a></li></ul>
</li></ul>
</div><p>JAX-RS endpoints can be easily tested using the embedded Jetty or CXF
Local Transport.</p><h1 id="JAXRSTesting-EmbeddedJetty">Embedded Jetty</h1><div
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>Maven
Dependency</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Confluence"
style="font-size:12px;"><dependency>
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>3.0.0</version>
</dependency></pre>
</div></div><p> </p><p> </p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>Example</b></div><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">import javax.ws.rs.core.Response;
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">import javax.ws.rs.core.Response;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
@@ -219,13 +219,13 @@ public void testGetBookWithProxy() {
}
</pre>
</div></div><p>It is quite easy to setup a server and start testing it. The
advantage of using the embedded Jetty is that a complete end-to-end round-trip
can be exercised, thus stressing all the CXF runtime which comes at the cost of
some added complexity to do with setting up the server.</p><h1
id="JAXRSTesting-LocalTransport">Local Transport</h1><p>Starting from CXF 2.6.2
it is possible to use CXF Local Transport for testing the JAX-RS endpoints and
clients.<br clear="none"> This avoids the need to start an embedded servlet
container and the tests will run faster.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>Maven Dependency</b></div><div
class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Confluence"
style="font-size:12px;"><dependency>
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-local</artifactId>
<version>3.0.0</version>
</dependency></pre>
</div></div><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>Example</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">import org.apache.cxf.endpoint.Server;
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">import org.apache.cxf.endpoint.Server;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
@@ -303,7 +303,7 @@ public void testAddBookWithProxyDirectDi
}
</pre>
</div></div><p>Note that setting a LocalConduit.DIRECT_DISPATCH property to
'true' ensures that the invocation goes immediately into the service chain
after the client out chain has completed. <br clear="none"> If this property is
not set then CXF LocalConduit sets up a pipe which is initiated via an initial
write on the client side.</p><p>In the above code example Local transport is
activated by using a URI "local:" scheme, for example,
"local://books".</p><p>Alternatively, the address can be set as a relative
value such as "/books", with the server and client transportId attribute set
to<br clear="none"> "http://cxf.apache.org/transports/local". In this case,
when creating the clients, use JAXRSClientFactoryBean:</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">private static void startServer() throws Exception {
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">private static void startServer() throws Exception {
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setTransportId(LocalTransportFactory.TRANSPORT_ID);
sf.setAddress("/books");
@@ -324,7 +324,7 @@ public void testAddBookWithProxyDirectDi
}
</pre>
</div></div><p> </p><h2 id="JAXRSTesting-MockingHTTPcontexts">Mocking
HTTP contexts</h2><p>If you test a code which depends on the injected HTTP
contexts such as HttpServletRequest then these contexts will have to be
mocked.</p><p>For example:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">JAXRSServerFactoryBean sf = new
JAXRSServerFactoryBean();
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">JAXRSServerFactoryBean sf = new
JAXRSServerFactoryBean();
sf.setInvoker(new Invoker() {
Invoker jarsInvoker = new JAXRSInvoker();
Modified: websites/production/cxf/content/docs/jaxrsclientspringboot.html
==============================================================================
--- websites/production/cxf/content/docs/jaxrsclientspringboot.html (original)
+++ websites/production/cxf/content/docs/jaxrsclientspringboot.html Wed Sep 13
15:05:52 2017
@@ -32,8 +32,8 @@
<link type="text/css" rel="stylesheet"
href="/resources/highlighter/styles/shThemeCXF.css">
<script src='/resources/highlighter/scripts/shCore.js'></script>
-<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
+<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
@@ -118,14 +118,14 @@ Apache CXF -- JAXRSClientSpringBoot
<!-- Content -->
<div class="wiki-content">
<div id="ConfluenceContent"><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1505311199472 {padding: 0px;}
-div.rbtoc1505311199472 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1505311199472 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1505314870967 {padding: 0px;}
+div.rbtoc1505314870967 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1505314870967 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1505311199472">
+/*]]>*/</style></p><div class="toc-macro rbtoc1505314870967">
<ul class="toc-indentation"><li><a shape="rect"
href="#JAXRSClientSpringBoot-Introduction">Introduction</a></li><li><a
shape="rect" href="#JAXRSClientSpringBoot-Setup">Setup</a></li><li><a
shape="rect" href="#JAXRSClientSpringBoot-EnablingWebClients">Enabling
WebClients</a></li><li><a shape="rect"
href="#JAXRSClientSpringBoot-EnablingProxyClients">Enabling
ProxyClients</a></li><li><a shape="rect"
href="#JAXRSClientSpringBoot-DiscoveryofServiceEndpoints">Discovery of Service
Endpoints</a></li><li><a shape="rect"
href="#JAXRSClientSpringBoot-Configuration">Configuration</a></li></ul>
</div><h1 id="JAXRSClientSpringBoot-Introduction">Introduction</h1><p>This
page describes how <a shape="rect" href="jax-rs-client-api.html">CXF JAX-RS
Client</a> code can be used inside SpringBoot applications.</p><p>Please see
a <a shape="rect"
href="http://cxf.apache.org/docs/springboot.html#SpringBoot-SpringBootCXFJAX-RSStarter">CXF
JAX-RS starter</a> section on how to enable JAX-RS endpoints.</p><h1
id="JAXRSClientSpringBoot-Setup">Setup</h1><p>If your SpringBoot Application
depends on a <a shape="rect"
href="http://cxf.apache.org/docs/springboot.html#SpringBoot-SpringBootCXFJAX-RSStarter">CXF
JAX-RS starter</a> then no more dependencies are required.</p><p>If you'd like
to run JAX-RS clients in a pure client-side SpringBoot Application then
the following Maven pom should suffice in many cases:</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Confluence"
style="font-size:12px;"><?xml version="1.0" encoding="UTF-8"?>
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
@@ -167,7 +167,7 @@ div.rbtoc1505311199472 li {margin-left:
</project>
</pre>
</div></div><h1 id="JAXRSClientSpringBoot-EnablingWebClients">Enabling
WebClients</h1><p><a shape="rect"
href="http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-CXFWebClientAPI">WebClient</a>
can be auto-wired with the help of <strong>EnableJaxRsWebClient</strong>
annotation.</p><p>JAX-RS providers (annotated with @Provider) and marked as
Spring Components are added to WebClient. The providers which are not marked as
Spring Components can also be optionally auto-discovered. WebClient can also be
configured with optional headers such as Accept and Content-Type and made
thread-safe.</p><p> </p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Confluence"
style="font-size:12px;">package sample.rs.client;
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">package sample.rs.client;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.jaxrs.client.spring.EnableJaxRsWebClient;
@@ -198,7 +198,7 @@ public class SpringBootClientApplication
}</pre>
</div></div><p> </p><h1
id="JAXRSClientSpringBoot-EnablingProxyClients">Enabling ProxyClients</h1><p><a
shape="rect"
href="http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-Proxy-basedAPI">Proxy
Clients</a> can be auto-wired with the help of
<strong>EnableJaxRsProxyClient</strong> annotation.</p><p>It creates a proxy
from the auto-discovered service class interface.</p><p>JAX-RS providers
(annotated with @Provider) and marked as Spring Components are added to proxy
clients. The providers which are not marked as Spring Components can also be
optionally auto-discovered. Proxy can also be configured with optional headers
such as Accept and Content-Type (if JAX-RS @Produces and/or @Consumes are
missing or need to be overridden) and made thread-safe.</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Confluence"
style="font-size:12px;">package sample.rs.client;
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">package sample.rs.client;
import org.apache.cxf.jaxrs.client.spring.EnableJaxRsProxyClient;
import org.springframework.boot.CommandLineRunner;
@@ -230,7 +230,7 @@ public class SpringBootClientApplication
}
</pre>
</div></div><p> </p><p>If you prefer to specify a proxy service interface
directly in the client code you can drop EnableJaxRsProxyClient annotation and
provide a simple JaxRsProxyClientConfiguration extension instead:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Confluence"
style="font-size:12px;">package sample.rs.client;
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">package sample.rs.client;
import org.apache.cxf.jaxrs.client.spring.JaxRsProxyClientConfiguration;
Modified: websites/production/cxf/content/docs/jetty-configuration.html
==============================================================================
--- websites/production/cxf/content/docs/jetty-configuration.html (original)
+++ websites/production/cxf/content/docs/jetty-configuration.html Wed Sep 13
15:05:52 2017
@@ -127,7 +127,7 @@ Apache CXF -- Jetty Configuration
<p>The elements used to configure the Jetty runtime are defined in the
namespace <code><a shape="rect"
href="http://cxf.apache.org/transports/http-jetty/configuration">http://cxf.apache.org/transports/http-jetty/configuration</a></code>.
It is commonly referred to using the prefix <code>httpj</code>. In order to
use the Jetty configuration elements you will need to add the lines shown below
to the <code>beans</code> element of your endpoint's configuration file. In
addition, you will need to add the configuration elements' namespace to the
<code>xsi:schemaLocation</code> attribute.</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
<beans ...
xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration
...
@@ -173,7 +173,7 @@ The <code>threadingParameters</code> has
<p>The example below shows a configuration fragment that configures a Jetty
instance on port number 9001.</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Modified: websites/production/cxf/content/docs/jms-performance-and-pooling.html
==============================================================================
--- websites/production/cxf/content/docs/jms-performance-and-pooling.html
(original)
+++ websites/production/cxf/content/docs/jms-performance-and-pooling.html Wed
Sep 13 15:05:52 2017
@@ -117,7 +117,7 @@ Apache CXF -- JMS performance and poolin
<!-- Content -->
<div class="wiki-content">
<div id="ConfluenceContent"><p>CXF JMS should be very fast if configured
correctly. There are two major settings that affect performance: pooling and
synchronous receives on client side.</p><h2
id="JMSperformanceandpooling-Pooling">Pooling</h2><p>On the client side CXF
creates a new JMS Session and Producer for each message. This is necessary as
these JMS objects are not thread safe. Especially creating a Producer is very
time intensive though as a communication with the server is
necessary.</p><p>Connection Factory pools help to improve perfomance by caching
the Connection, Session and Producer.</p><p>For ActiveMQ configuring pooling is
quite simple:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Pooling
for ActiveMQ</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Confluence"
style="font-size:12px;">import org.apache.activemq.ActiveMQConnectionFactory;
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.pool.PooledConnectionFactory;
ConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616");
Modified: websites/production/cxf/content/docs/jms-transactions.html
==============================================================================
--- websites/production/cxf/content/docs/jms-transactions.html (original)
+++ websites/production/cxf/content/docs/jms-transactions.html Wed Sep 13
15:05:52 2017
@@ -32,8 +32,8 @@
<link type="text/css" rel="stylesheet"
href="/resources/highlighter/styles/shThemeCXF.css">
<script src='/resources/highlighter/scripts/shCore.js'></script>
-<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
+<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script src='/resources/highlighter/scripts/shBrushPlain.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
@@ -119,14 +119,14 @@ Apache CXF -- JMS transactions
<!-- Content -->
<div class="wiki-content">
<div id="ConfluenceContent"><p>CXF supports resource local jms transactions
and JTA transactions on CXF endpoints when using one way messages.</p><h2
id="JMStransactions-ResourcelocalJMStransactions">Resource local JMS
transactions</h2><p>This kind of transaction is easy to configure but will only
roll back the JMS message. It will not directly coordinate other resources like
a database transaction.</p><p>Simply configure the endpoint normally and set
the propety "sessionTransacted" to true. CXF will then roll back the message on
if any exception happens.</p><h2 id="JMStransactions-JTAtransactions">JTA
transactions</h2><p>JTA transactions allow to coordinate any number of XA
resources. If a CXF endpoint is configured for JTA transactions it will start a
JTA transaction before calling the service impl. If no exceptions happen the
transaction will be committed in case of any exception the transaction will be
rolled back. This allows to e.g. transactionally consume a JMS message and wr
ite the data into a database. In case of an exception both resources will be
rolled back. So either the message is consumed AND the database record is
written or the message is rolled back AND the database record is not
written.</p><h3
id="JMStransactions-ThefirstconfigneededforJTAisatransactionmanager:">The first
config needed for JTA is a transaction manager:</h3><p>Either create a
transaction manager in a bean using:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>Define transaction manager</b></div><div
class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Confluence"
style="font-size:12px;"><bean id ="transactionManager"
class="org.apache.geronimo.transaction.manager.GeronimoTransactionManager"/></pre>
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><bean id ="transactionManager"
class="org.apache.geronimo.transaction.manager.GeronimoTransactionManager"/></pre>
</div></div><p>as an OSGi service reference. (This search filter can vary
between application servers).</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>Lookup transaction manager as OSGi service
using blueprint</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Confluence"
style="font-size:12px;"><reference id="TransactionManager"
interface="javax.transaction.TransactionManager"/></pre>
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><reference id="TransactionManager"
interface="javax.transaction.TransactionManager"/></pre>
</div></div><p>Then the name of the TransactionManager can be set in the JMS
URI</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>JMS URI
with transaction manager</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: text; gutter: false; theme: Confluence"
style="font-size:12px;">jms:queue:myqueue?jndiTransactionManager=TransactionManager
+<pre class="brush: text; gutter: false; theme: Default"
style="font-size:12px;">jms:queue:myqueue?jndiTransactionManager=TransactionManager
jms:jndi:myqueue?jndiTransactionManager=java:comp/env/TransactionManager</pre>
</div></div><p>The first would find a bean with id "TransactionManager" the
second would look up the transaction manager in JNDI.</p><h3
id="JMStransactions-ThesecondconfigisaJCApoolingconnectionfactory">The second
config is a JCA pooling connection factory</h3><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>JCA pooling connection factory defined
using spring</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Confluence"
style="font-size:12px;"><bean id="xacf"
class="org.apache.activemq.ActiveMQXAConnectionFactory">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><bean id="xacf"
class="org.apache.activemq.ActiveMQXAConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616"/>
</bean>
<bean id="ConnectionFactory"
class="org.apache.activemq.jms.pool.JcaPooledConnectionFactory">
Modified: websites/production/cxf/content/docs/jmx-management.html
==============================================================================
--- websites/production/cxf/content/docs/jmx-management.html (original)
+++ websites/production/cxf/content/docs/jmx-management.html Wed Sep 13
15:05:52 2017
@@ -32,9 +32,9 @@
<link type="text/css" rel="stylesheet"
href="/resources/highlighter/styles/shThemeCXF.css">
<script src='/resources/highlighter/scripts/shCore.js'></script>
-<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
-<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
<script src='/resources/highlighter/scripts/shBrushBash.js'></script>
+<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
+<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
@@ -123,7 +123,7 @@ Apache CXF -- JMX Management
<p>To enable JMX integration, register an InstrumentationManager extension
with the CXF bus. Using Spring XML on Tomcat, the following minimal XML
snippet will enable JMX integration.</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
...
@@ -146,7 +146,7 @@ Apache CXF -- JMX Management
<p>If you're using Maven, make sure you have the following dependency added to
the pom.xml for the web service provider:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-management</artifactId>
@@ -161,7 +161,7 @@ Apache CXF -- JMX Management
<p>Enable JMX integration by adding the following XML to your CXF Spring
context.</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
<bean id="org.apache.cxf.management.InstrumentationManager"
class="org.apache.cxf.management.jmx.InstrumentationManagerImpl">
<property name="bus" ref="cxf" />
@@ -174,7 +174,7 @@ Apache CXF -- JMX Management
<p>Starting from 2.5.2, an equivalent configuration of the above
instrumentation manager can be directly made within the bus configuration using
the corresponding property names having the "bus.jmx" prefix, as in</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
<cxf:bus bus="cxf">
<cxf:properties>
<entry key="bus.jmx.enabled" value="true"/>
@@ -205,7 +205,7 @@ Then you can browse to your endpoint:<br
<p>If you are embedding a CXF service in a ServiceMix 4 container, the
configuration is slightly different from above. You don't want to start a new
MBeanServer and you probably don't want to create additional connectors as the
container manages both of these for you. You can get a reference to the
container's MBeanServer through the OSGi framework and inject this reference
into the JMX integration extension. Don't forget to add the Spring OSGI
namespace and schemaLocation to your CXF configuration file if they are not
already present.</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
<!-- OSGi namespace and schemaLocation required -->
<beans ...
xmlns:osgi="http://www.springframework.org/schema/osgi"
@@ -240,7 +240,7 @@ Then you can browse to your endpoint:<br
<p>Here is the configuration snippet that you should add to your Spring
context file to be able to view this information:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
<!-- Wiring the counter repository -->
<bean id="CounterRepository"
class="org.apache.cxf.management.counters.CounterRepository">
<property name="bus" ref="cxf" />
Modified: websites/production/cxf/content/docs/json-support.html
==============================================================================
--- websites/production/cxf/content/docs/json-support.html (original)
+++ websites/production/cxf/content/docs/json-support.html Wed Sep 13 15:05:52
2017
@@ -32,8 +32,8 @@
<link type="text/css" rel="stylesheet"
href="/resources/highlighter/styles/shThemeCXF.css">
<script src='/resources/highlighter/scripts/shCore.js'></script>
-<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script src='/resources/highlighter/scripts/shBrushBash.js'></script>
+<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
@@ -120,7 +120,7 @@ Apache CXF -- JSON Support
<div id="ConfluenceContent"><h1 id="JSONSupport-JSONOverview">JSON
Overview</h1>
<p>JSON is a textual data format for data exchange. JSON stands for Javascript
Object Notation and, as the name implies, is itself Javascript. Here is a small
sample:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
{
"customer" : {
"name" : "Jane Doe",
@@ -140,7 +140,7 @@ Apache CXF -- JSON Support
1. The "mapped" convention. In this convention namespaces are mapped to json
prefixes. For instance, if you have a namespace "http://acme.com" you could map
it to the "acme" prefix. This means that the element <customer
xmlns="http://acme.com"> would be mapped to the "acme.customer" JSON tag.<br
clear="none">
2. The <a shape="rect" class="external-link" href="http://badgerfish.ning.com"
rel="nofollow">BadgerFish</a> convention. This convention provides a mapping of
the full XML infoset to JSON. Attributes are represented with an @ sign - i.e.
"@attributeName" : "value". Textual data is represented with the "$" as the
tag. Example:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
{ "customer" : { "name" : { "$" : "Jane Doe" } } }
</pre>
</div></div>
@@ -151,7 +151,7 @@ Apache CXF -- JSON Support
<h2 id="JSONSupport-UsingServerFactoryBeans">Using ServerFactoryBeans</h2>
<p>This example shows how to set up Jettison using a ServerFactoryBean, such
as the JaxWsServerFactoryBean. First you must create a properties HashMap and
set the StAX XMLInputFactory and XMLOutputFactory:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
Map<String,Object> properties = new HashMap<String,Object>();
// Create a mapping between the XML namespaces and the JSON prefixes.
@@ -168,7 +168,7 @@ properties.put(XMLOutputFactory.class.ge
</div></div>
<p>You must also tell CXF which Content-Type you wish to serve:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
// Tell CXF to use a different Content-Type for the JSON endpoint
// This should probably be application/json, but text/plain allows
// us to view easily in a web browser.
@@ -177,7 +177,7 @@ properties.put("Content-Type", "text/pla
</div></div>
<p>Last, you'll want to actually create your service:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
// Build up the server factory bean
JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
sf.setServiceClass(CustomerService.class);
Modified: websites/production/cxf/content/docs/local-transport.html
==============================================================================
--- websites/production/cxf/content/docs/local-transport.html (original)
+++ websites/production/cxf/content/docs/local-transport.html Wed Sep 13
15:05:52 2017
@@ -32,8 +32,8 @@
<link type="text/css" rel="stylesheet"
href="/resources/highlighter/styles/shThemeCXF.css">
<script src='/resources/highlighter/scripts/shCore.js'></script>
-<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
+<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
@@ -126,7 +126,7 @@ Apache CXF -- Local Transport
<h2 id="LocalTransport-JAX-WS">JAX-WS</h2>
<p>This code shows how to publish on a local endpoint:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
import javax.xml.ws.Endpoint;
HelloServiceImpl serverImpl = new HelloServiceImpl();
@@ -136,7 +136,7 @@ Endpoint.publish("local://hello", server
<p>Or with XML:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:simple="http://cxf.apache.org/simple"
@@ -170,7 +170,7 @@ http://cxf.apache.org/simple http://cxf.
<p>Before you use the local transport , you need to register the default soap
transportURI with the local transport factory in the bus</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
Bus bus = BusFactory.getDefaultBus();
LocalTransportFactory localTransport = new LocalTransportFactory();
@@ -190,7 +190,7 @@ extension.registerConduitInitiator("http
<p>You can also pass in a local://address to the server and client factory
beans:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
import org.apache.cxf.frontend.ServerFactoryBean;
ServerFactoryBean sf = new ServerFactoryBean();
@@ -202,7 +202,7 @@ sf.create();
</div></div>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
import org.apache.cxf.frontend.ClientProxyFactoryBean;
ClientProxyFactoryBean cf = new ClientProxyFactoryBean();
Modified: websites/production/cxf/content/docs/logbrowser-configuration.html
==============================================================================
--- websites/production/cxf/content/docs/logbrowser-configuration.html
(original)
+++ websites/production/cxf/content/docs/logbrowser-configuration.html Wed Sep
13 15:05:52 2017
@@ -32,8 +32,8 @@
<link type="text/css" rel="stylesheet"
href="/resources/highlighter/styles/shThemeCXF.css">
<script src='/resources/highlighter/scripts/shCore.js'></script>
-<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
+<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script src='/resources/highlighter/scripts/shBrushPlain.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
@@ -138,7 +138,7 @@ Apache CXF -- LogBrowser - Configuration
<p>Add <code>cxf-rt-management-web</code> dependency to your Maven project (if
you don't use Maven as management tool, omit this step and add
<code>cxf-rt-management-web</code> library manually):</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>pom.xml</b></div><div
class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: true; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: true; theme: Default" style="font-size:12px;">
<project>
[...]
@@ -168,7 +168,7 @@ Apache CXF -- LogBrowser - Configuration
<p>Add new class to your project, <code>LogBrowserApp</code>. Add content from
sample below.</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width:
1px;"><b>LogBrowserApp.java</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: true; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: true; theme: Default" style="font-size:12px;">
package yourpackage;
import java.util.Collections;
@@ -229,7 +229,7 @@ public class LogBrowserApp extends Appli
<p>Add new servlet definition to your <code>web.xml</code> file, like in
sample below: </p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>web.xml</b></div><div
class="codeContent panelContent pdl">
-<pre class="brush: bash; gutter: true; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: true; theme: Default" style="font-size:12px;">
<web-app>
[...]
@@ -268,14 +268,14 @@ public class LogBrowserApp extends Appli
<p>Open browser and go to URL: </p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">http://localhost:9002/log/bootstrapstorage/resources/LogBrowser.html</pre>
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">http://localhost:9002/log/bootstrapstorage/resources/LogBrowser.html</pre>
</div></div>
<h5 id="LogBrowser-Configuration-Step6">Step 6</h5>
<p>Add new endpoint with URL: </p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">http://localhost:9002/log/logs</pre>
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">http://localhost:9002/log/logs</pre>
</div></div>
<p>Congratulation. Now you can easily view log enties using LogBrowser. </p>
Modified:
websites/production/cxf/content/docs/logbrowser-system-architectural-design.html
==============================================================================
---
websites/production/cxf/content/docs/logbrowser-system-architectural-design.html
(original)
+++
websites/production/cxf/content/docs/logbrowser-system-architectural-design.html
Wed Sep 13 15:05:52 2017
@@ -32,8 +32,8 @@
<link type="text/css" rel="stylesheet"
href="/resources/highlighter/styles/shThemeCXF.css">
<script src='/resources/highlighter/scripts/shCore.js'></script>
-<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script src='/resources/highlighter/scripts/shBrushBash.js'></script>
+<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
@@ -232,7 +232,7 @@ Apache CXF -- LogBrowser - System archit
<p>Data required for authorization will be send through <a shape="rect"
class="external-link" href="http://www.xml.com/pub/a/2003/12/17/dive.html"
rel="nofollow">HTTP header</a>, for example:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
POST /atom.cgi HTTP/1.1
Host: bob.example.com
Content-Type: application/atom+xml
@@ -245,7 +245,7 @@ Nonce="d36e316282959a9ed4c89851497a717f"
<p>When authorization fail, web service will response like this:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: bash; gutter: false; theme: Confluence"
style="font-size:12px;">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
HTTP/1.1 401 Unauthorized
WWW-Authenticate: WSSE realm="foo", profile="UsernameToken"
</pre>