cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF Documentation > JAXRS Services Description
Date Fri, 17 Jun 2011 11:30:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JAXRS+Services+Description">JAXRS
Services Description</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~sergey_beryozkin">Sergey
Beryozkin</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h1. WADL-first Development <br>
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h2.
wadl2java command line tool <br>h2. wadl2java Maven plugin <br> <br>If you
need the code generated during the Maven build then the following plugin can be used: <br>
<br>{code:xml} <br>&lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
<br>&lt;artifactId&gt;cxf-wadl2java-plugin&lt;/artifactId&gt; <br>&lt;version&gt;2.4.1&lt;/version&gt;
<br>{code} <br> <br>Add this plugin to the build section of your project&#39;s
pom and specify a &#39;wadl2java&#39; goal, for example: <br> <br>{code:xml}
<br>&lt;build&gt; <br>        &lt;plugins&gt; <br>     
      &lt;plugin&gt; <br>                &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
<br>                &lt;artifactId&gt;cxf-wadl2java-plugin&lt;/artifactId&gt;
<br>                &lt;version&gt;2.4.1&lt;/version&gt; <br>
               &lt;executions&gt; <br>                    &lt;execution&gt;
<br>                        &lt;id&gt;generate-sources&lt;/id&gt; <br>
                       &lt;phase&gt;generate-sources&lt;/phase&gt; <br>
                       &lt;configuration&gt; <br>                          
 &lt;sourceRoot&gt;${basedir}/target/generated/src/main/java&lt;/sourceRoot&gt;
<br>                            &lt;wadlOptions&gt; <br>             
                  &lt;wadlOption&gt; <br>                                  
 &lt;wadl&gt;${basedir}/src/test/resources/wadl/bookstoreImport.xml&lt;/wadl&gt;
<br>                                    &lt;impl&gt;true&lt;/impl&gt;
<br> <br>                                    &lt;packagename&gt;org.apache.cxf.systest.jaxrs.codegen.service&lt;/packagename&gt;
<br>                                    &lt;schemaPackagenames&gt; <br>
                                      &lt;schemaPackagename&gt;http://superbooks=org.apache.cxf.systest.jaxrs.codegen.schema&lt;/schemaPackagename&gt;
<br>                                    &lt;/schemaPackagenames&gt; <br>
<br>                                &lt;/wadlOption&gt; <br>         
                  &lt;/wadlOptions&gt; <br>                        &lt;/configuration&gt;
<br>                        &lt;goals&gt; <br>                       
    &lt;goal&gt;wadl2java&lt;/goal&gt; <br>                        &lt;/goals&gt;
<br>                    &lt;/execution&gt; <br>                &lt;/executions&gt;
<br>            &lt;/plugin&gt; <br>        &lt;/plugins&gt; <br>
   &lt;/build&gt; <br>{code} <br>h2. Integration <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h1. WADL Generation <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p><span style="font-size:2em;font-weight:bold"> JAX-RS Services Description
</span></p>

<div>
<ul>
    <li><a href='#JAXRSServicesDescription-WADLfirstDevelopment'>WADL-first Development</a></li>
<ul>
    <li><a href='#JAXRSServicesDescription-wadl2javacommandlinetool'>wadl2java
command line tool</a></li>
    <li><a href='#JAXRSServicesDescription-wadl2javaMavenplugin'>wadl2java Maven
plugin</a></li>
    <li><a href='#JAXRSServicesDescription-Integration'>Integration</a></li>
</ul>
    <li><a href='#JAXRSServicesDescription-WADLGeneration'>WADL Generation</a></li>
<ul>
    <li><a href='#JAXRSServicesDescription-DocumentingresourceclassesandmethodsinWADL'>Documenting
resource classes and methods in WADL</a></li>
    <li><a href='#JAXRSServicesDescription-CustomWADLproviders'>Custom WADL providers</a></li>
<ul>
    <li><a href='#JAXRSServicesDescription-RepresentingexternalschemasandnonJAXBtypes'>Representing
external schemas and non JAXB types</a></li>
</ul>
</ul>
    <li><a href='#JAXRSServicesDescription-GeneratingtheclientcodefromWADLatruntime'>Generating
the client code from WADL at runtime</a></li>
    <li><a href='#JAXRSServicesDescription-HidinglinkstoJAXRSendpointsfromtheservicespage'>Hiding
links to JAXRS endpoints from the services page</a></li>
</ul></div>

<p>CXF JAX-RS supports <a href="http://www.w3.org/Submission/wadl" class="external-link"
rel="nofollow">WADL</a>. <br/>
Users can use WADL documents to generate the initial code and have WADL auto-generated on
demand. </p>


<h1><a name="JAXRSServicesDescription-WADLfirstDevelopment"></a>WADL-first
Development</h1>

<h2><a name="JAXRSServicesDescription-wadl2javacommandlinetool"></a>wadl2java
command line tool</h2>
<h2><a name="JAXRSServicesDescription-wadl2javaMavenplugin"></a>wadl2java
Maven plugin</h2>

<p>If you need the code generated during the Maven build then the following plugin can
be used:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;groupId&gt;</span>org.apache.cxf<span class="code-tag">&lt;/groupId&gt;</span>
<span class="code-tag">&lt;artifactId&gt;</span>cxf-wadl2java-plugin<span
class="code-tag">&lt;/artifactId&gt;</span>
<span class="code-tag">&lt;version&gt;</span>2.4.1<span class="code-tag">&lt;/version&gt;</span>
</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" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;build&gt;</span>
        <span class="code-tag">&lt;plugins&gt;</span>
            <span class="code-tag">&lt;plugin&gt;</span>
                <span class="code-tag">&lt;groupId&gt;</span>org.apache.cxf<span
class="code-tag">&lt;/groupId&gt;</span>
                <span class="code-tag">&lt;artifactId&gt;</span>cxf-wadl2java-plugin<span
class="code-tag">&lt;/artifactId&gt;</span>
                <span class="code-tag">&lt;version&gt;</span>2.4.1<span
class="code-tag">&lt;/version&gt;</span>
                <span class="code-tag">&lt;executions&gt;</span>
                    <span class="code-tag">&lt;execution&gt;</span>
                        <span class="code-tag">&lt;id&gt;</span>generate-sources<span
class="code-tag">&lt;/id&gt;</span>
                        <span class="code-tag">&lt;phase&gt;</span>generate-sources<span
class="code-tag">&lt;/phase&gt;</span>
                        <span class="code-tag">&lt;configuration&gt;</span>
                            <span class="code-tag">&lt;sourceRoot&gt;</span>${basedir}/target/generated/src/main/java<span
class="code-tag">&lt;/sourceRoot&gt;</span>
                            <span class="code-tag">&lt;wadlOptions&gt;</span>
                                <span class="code-tag">&lt;wadlOption&gt;</span>
                                    <span class="code-tag">&lt;wadl&gt;</span>${basedir}/src/test/resources/wadl/bookstoreImport.xml<span
class="code-tag">&lt;/wadl&gt;</span>
                                    <span class="code-tag">&lt;impl&gt;</span>true<span
class="code-tag">&lt;/impl&gt;</span>
                                    
                                    <span class="code-tag">&lt;packagename&gt;</span>org.apache.cxf.systest.jaxrs.codegen.service<span
class="code-tag">&lt;/packagename&gt;</span>
                                    <span class="code-tag">&lt;schemaPackagenames&gt;</span>
                                       <span class="code-tag">&lt;schemaPackagename&gt;</span>http://superbooks=org.apache.cxf.systest.jaxrs.codegen.schema<span
class="code-tag">&lt;/schemaPackagename&gt;</span>
                                    <span class="code-tag">&lt;/schemaPackagenames&gt;</span>
                                    
                                <span class="code-tag">&lt;/wadlOption&gt;</span>
                            <span class="code-tag">&lt;/wadlOptions&gt;</span>
                        <span class="code-tag">&lt;/configuration&gt;</span>
                        <span class="code-tag">&lt;goals&gt;</span>
                            <span class="code-tag">&lt;goal&gt;</span>wadl2java<span
class="code-tag">&lt;/goal&gt;</span>
                        <span class="code-tag">&lt;/goals&gt;</span>
                    <span class="code-tag">&lt;/execution&gt;</span>
                <span class="code-tag">&lt;/executions&gt;</span>
            <span class="code-tag">&lt;/plugin&gt;</span>
        <span class="code-tag">&lt;/plugins&gt;</span>
    <span class="code-tag">&lt;/build&gt;</span>
</pre>
</div></div>
<h2><a name="JAXRSServicesDescription-Integration"></a>Integration</h2>

<h1><a name="JAXRSServicesDescription-WADLGeneration"></a>WADL Generation</h1>

<p>CXF JAX-RS supports the auto-generation of WADL for JAX-RS endpoints. <br/>
Note that JAX-RS subresources are supposed to be late-resolved, 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.</p>

<p>WADL instances for RESTful endpoints are available from {base endpointaddress}/services,
in addition to SOAP endpoints if any. Note that you can override the location at which listings
are provided (in case you would like '/services' be available to your resources) using<br/>
'service-list-path' servlet parameter, ex :</p>

<p>&gt; 'service-list-path' = '/listings'</p>

<p>Going to the service listings page is not the only way to see the wadl instances,
generally one can get it using a ?_wadl query.</p>

<p>For example, given</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
Base address : 'http://localhost:8080'
WAR name : 'store'
CXFServlet : '/books/*'
jaxrs:server/@address = '/orders'
jaxrs:server/@staticSubresourceResoulution = 'true'
</pre>
</div></div>

<p>and 2 root resource classes registered with this endpoint, say</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
@Path(<span class="code-quote">"/fiction"</span>) 
<span class="code-keyword">public</span> class FictionBookOrders {
}
@Path(<span class="code-quote">"/sport"</span>) 
<span class="code-keyword">public</span> class SportBookOrders {
}
</pre>
</div></div>

<p>then</p>

<p>&gt; <a href="http://localhost:8080/store/books/orders?_wadl" class="external-link"
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/>
with a given jaxrs:server endpoint, including all the subresources. While</p>

<p>&gt; <a href="http://localhost:8080/store/books/orders/fiction?_wadl" class="external-link"
rel="nofollow">http://localhost:8080/store/books/orders/fiction?_wadl</a><br/>
&gt; <a href="http://localhost:8080/store/books/orders/sport?_wadl" class="external-link"
rel="nofollow">http://localhost:8080/store/books/orders/sport?_wadl</a></p>

<p>will give you all the info for FictionBookOrders and SportBookOrders respectively.</p>

<p>If you have many jaxrs:endpoints then visiting</p>

<p>&gt; <a href="http://localhost:8080/store/books" class="external-link" rel="nofollow">http://localhost:8080/store/books</a>
<br/>
&gt; <a href="http://localhost:8080/store/books/services" class="external-link" rel="nofollow">http://localhost:8080/store/books/services</a>
</p>

<p>will let you see all the WADL links.</p>

<p>Note that the media type for a ?_wadl response is set to 'application/vnd.sun.wadl+xml'
which is something Firefox does not really<br/>
like unless some wadl plugin is registered. If an HTTP Accept header is set to 'application/xml'
then Firefox will show it with no problems. Doing<br/>
'?_wadl&amp;_type=xml' will ensure a WADL generator will see Accept being set set to 'application/xml'.</p>

<h2><a name="JAXRSServicesDescription-DocumentingresourceclassesandmethodsinWADL"></a>Documenting
resource classes and methods in WADL</h2>

<p><b>CXF 2.4.0</b>: 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>

<p>WADL documents can include <a href="http://www.w3.org/Submission/wadl/#x3-80002.3"
class="external-link" rel="nofollow">doc</a> fragments. </p>

<p>Users may want to use <a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/Description.java"
class="external-link" 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 href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/Descriptions.java"
class="external-link" 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 href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/DocTarget.java"
class="external-link" 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" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
@POST
@Path(<span class="code-quote">"books/{bookid}"</span>)
@Descriptions({ 
   @Description(value = <span class="code-quote">"Adds a <span class="code-keyword">new</span>
book"</span>, target = DocTarget.METHOD),
   @Description(value = <span class="code-quote">"Requested Book"</span>, target
= DocTarget.RETURN),
   @Description(value = <span class="code-quote">"Request"</span>, target = DocTarget.REQUEST),
   @Description(value = <span class="code-quote">"Response"</span>, target = DocTarget.RESPONSE),
   @Description(value = <span class="code-quote">"Resource"</span>, target = DocTarget.RESOURCE)
})
<span class="code-keyword">public</span> Book addBook(@Description(<span class="code-quote">"book
id"</span>) @PathParam(<span class="code-quote">"id"</span>) <span class="code-object">Long</span>
id, @Description(<span class="code-quote">"New Book"</span>) 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" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
@POST
@Path(<span class="code-quote">"books/{bookid}"</span>)
@Description(value = <span class="code-quote">"Resource"</span>, target = DocTarget.RESOURCE),
<span class="code-keyword">public</span> Book addBook(@Description(<span class="code-quote">"book
id"</span>) @PathParam(<span class="code-quote">"id"</span>) <span class="code-object">Long</span>
id, @Description(<span class="code-quote">"New Book"</span>) Book book) {...}

@GET
@Path(<span class="code-quote">"books/{bookid}"</span>)
<span class="code-keyword">public</span> Book addBook(@Description(<span class="code-quote">"book
id"</span>) @PathParam(<span class="code-quote">"id"</span>) <span class="code-object">Long</span>
id) {...}
</pre>
</div></div>


<h2><a name="JAXRSServicesDescription-CustomWADLproviders"></a>Custom WADL
providers</h2>

<p>One can register a custom WADLGenerator as a jaxrs:provider. The custom generator
can extend the default <br/>
org.apache.cxf.jaxrs.model.wadl.WADLGenerator or register a default one with one of the following
properties set.</p>

<ul class="alternate" type="square">
	<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" type="square">
	<li>applicationTitle: can be used to create an application title.</li>
	<li>namespacePrefix: 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>
</ul>



<h3><a name="JAXRSServicesDescription-RepresentingexternalschemasandnonJAXBtypes"></a>Representing
external schemas and non JAXB types</h3>

<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" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
WadlGenerator wg = <span class="code-keyword">new</span> WadlGenerator();
wg.setSchemaLocations(Collections.singletonList(<span class="code-quote">"classpath:/book.xsd"</span>));
</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>Note 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" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;wadl:grammars&gt;</span>
<span class="code-tag">&lt;wadl:include href=<span class="code-quote">"http://books.xsd"</span>/&gt;</span>
<span class="code-tag">&lt;/wadl:grammars&gt;</span>
</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" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
&lt;!-- 
  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 
--&gt;
<span class="code-tag">&lt;representation mediaType=<span class="code-quote">"application/xml"</span>
element=<span class="code-quote">"prefix1:thebook2"</span>/&gt;</span>
</pre>
</div></div>

<p>If no JAXB is used then you can attach an <a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/XMLName.java"
class="external-link" rel="nofollow">XMLName</a> annotation to method input or output
types. Alternatively, you can register an instance of <a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/ElementQNameResolver.java"
class="external-link" rel="nofollow">ElementQNameResolver</a> with the WADLGenerator
which will be used for creating wadl:representation/@element values.</p>

<p>An <a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/ElementClass.java"
class="external-link" rel="nofollow">ElementClass</a> annotation can help with representing
JAX-RS Response elements in the generated WADL. </p>

<h1><a name="JAXRSServicesDescription-GeneratingtheclientcodefromWADLatruntime"></a>Generating
the client code from WADL at runtime</h1>

<p>If you register an org.apache.cxf.jaxrs.ext.codegen.CodeGeneratorProvider with a
jaxrs endpoint and issue a '_code' query to it then you will get back an XHTML page containing
the link to a zipped client source code which you can download and start customizing. </p>

<p>Test/development servers can host such a provider to help implementers get started
with working on the client code asap.</p>

<p>Internally, before the code gets generated, WADL will be generated first. The archive
will include JAXB generated classes from a WADL grammar section plus the proxy based client
code for accessing root and sub resources. The WebClient based code can not be generated just
yet but one can request that only a WADL grammar section is processed by adding a '_codeType=grammar'
query and easily adding a WebClient-based code. </p>

<p>Here is how to get the archive programmatically :</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
WebClient wc = WebClient.create(<span class="code-quote">"http:<span class="code-comment">//localhost:9080/petstore"</span>);
</span>XMLSource source = wc.query(<span class="code-quote">"_code"</span>).query(<span
class="code-quote">"_os"</span>, getOs()).get(XMLSource.class);
<span class="code-object">String</span> link = source.getValue(<span class="code-quote">"ns:html/ns:body/ns:ul/ns:a/@href"</span>,
 
              Collections.singletonMap(<span class="code-quote">"ns"</span>,<span
class="code-quote">"http:<span class="code-comment">//www.w3.org/1999/xhtml"</span>));
</span><span class="code-comment">// download a zip file          
</span>WebClient wcZip = WebClient.create(link);
InputStream is = wcZip.accept(<span class="code-quote">"application/zip"</span>).get(InputStream.class);
<span class="code-comment">// unzip and compile it</span>
</pre>
</div></div>

<p>Please see a <a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java"
class="external-link" rel="nofollow">testPetStore</a> test for more details.</p>

<h1><a name="JAXRSServicesDescription-HidinglinkstoJAXRSendpointsfromtheservicespage"></a>Hiding
links to JAXRS endpoints from the services page </h1>

<p>In some cases you may not want the users to see the links to some JAXRS endpoints.
For example, if you have an AtomPullServer endpoint collecting the log entries for a number
of application endpoints, you may not want to see AtomPullServer endpoint being listed among
the endpoints representing the actual application and which users are actually interested
in. If so then adding an "org.apache.cxf.endpoint.private" boolean property with a value "true"
will do the trick; note the same property can be used by jaxws endpoints.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JAXRS+Services+Description">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=24190953&revisedVersion=7&originalVersion=6">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JAXRS+Services+Description?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message