I'm not able to reproduce a case where a pre-existing WADL document with
a relative base "/" value is replaced only be a portion of the actual
absolute address such as "/myservice".
WADlGenerator does set a 'base' of the imported root WADL document to
UriInfo.getBaseUri() result.
Any chance you can put a breakpoint in WADLGenerator.handleExistingWadl
? There's a code line there where a base attribute is reset...Or provide
a test case
Cheers, Sergey
On 23/01/15 11:00, Sergey Beryozkin wrote:
Hi
On 23/01/15 09:01, MayBee wrote:
Hi all,
I currently try to generate the WADL specification for my web application
using
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-java2wadl-plugin</artifactId>
<version>3.0.3</version>
My web application has three differen jaxrs:server declarations with
different address values. According to
JAXRSServicesDescription-Changingthebaseaddress
<http://cxf.apache.org/docs/jaxrs-services-description.html#JAXRSServicesDescription-Changingthebaseaddress>
I also added the jaxrs:server/@publishedEndpointUrl with the same
value of
jaxrs:server/@address to my three server specifications.
All addresses are different and are non-overlapping.
Each jaxrs:server points to a single serviceBean, which specifies a REST
service using Java Annotations.
*With this I am getting the following results:*
The WADL generated at build-time includes the conjunction of all
servers in
one resources node with the base="/".
1. Why are the jaxrs:server@address values not taken into account in this
case?
The build plugin does not introspect the actual Spring or Blueprint XML
context. Besides, a @base is a common value for all of the resources
described by a given WADL document.
jaxrs:server@address needs to make it into a @base at the run time. If
you had a single jaxrs:server with all the service beans from all the
endpoints used by this single server bean then it would be simpler. But
you have multiple endpoints so it is not really possible to have a
single @base that can adequately represent the bases of all of those
endpoints.
I think it might make sense to configure a plugin to optionally generate
a separate WADL per every available service class which can help in
cases where each service is at a different base.
Besides: at run-time I can access one WADL per server with the correct
@base
for each server, but only with the relative path. So the resource@base
looks
like "/myService" rather than "http://host:port/servlet/myService"
I think the WADLGenerator is not recognizing the fact the base is "/"
when dealing with the pre-generated documents.
2. Any suggestions why this is the case?
The build plugin has an address property. Can you try and set it to
"http://host:port/servlet", and see if it helps ?
Sergey
Kind Regards,
Malte
--
View this message in context:
http://cxf.547215.n5.nabble.com/wadl-generation-at-build-time-including-resources-base-from-jaxrs-server-address-tp5753439.html
Sent from the cxf-user mailing list archive at Nabble.com.
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com