Hi,
On 17/10/17 15:28, Eyal Weingart wrote:
Thanks Sergey for the quick response.

1. Regarding the customization option, one example i can think of (and it 
relates to issue#2 below) is that we want to use multiple DocTarget.RESPONSE in 
order to display multiple error codes and since the generic code does not 
support it then this logic could have been applied in the customization class.

Well, there are so many possible customization points that one can think of, some parts like the docs can be easier customized than others, but FYI, nearly all of if not all of methods in WADLGenerator are protected. Create MyWadlGenerator extending WADLGenerator, override whatever is needed, and register MyWadlGenerator as a jaxrs:provider

3. Sorry, but did not understand the answer regarding generating 1 WADL per 1 
Rest API class.
        Each Rest API class is a different service so don't you think it should 
have the option to have its own WADL file?
        
It depends. They can be part of the composite service, and quite often, they can share the same (XML) schema types. It's not something WADLGenerator should be concerned about, trying to push each service docs into a separate file, and thinking of how to avoid the schema duplication.

If, in your case, each class does indeed represent a standalone service, then IMHO it would be better to create N jaxrs:endpoints, one per each class, as opposed to having 1 endpoint with N classes

Sergey


Thanks,
Eyal

-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]]
Sent: 17 October, 2017 00:06
To: users <[email protected]>
Cc: Eyal Weingart <[email protected]>
Subject: Re: cxf-java2wadl-plugin java2wadl questions

Hi
On 16/10/17 12:35, Eyal Weingart wrote:
Hi,



Not sure to whom i need to send my Questions so hopefully one of you can help 
me.

Forwarding to the CXF users list

I want to use the maven plugin cxf-java2wadl-plugin in order to generate WADL 
from Java rest APIs in build time but i found few issues with that:



1.      Is there a way to custom the generator class so i can apply some 
business code during the build? (is it the 
org.apache.cxf.jaxrs.model.wadl.WadlGenerator that generates it?)

What do you need to customize in the generated WADL ?



2.      When i use multiple DocTarget.RESPONSE in the rest API annotations then 
it generates only the first one it finds

Right, because WADLGenerator only creates a single wadl:response per a given 
operation

3.      If i define more than 1 classResourceNames in the configuration in the 
pom.xml then it generates all services under 1 application.wadl file so if i want 1 
WADL file per 1 rest API class then i need to define multiple <execution> (1 
execution per 1 Rest class) - is there a nicer way of doing it?

There's no way to auto-gen 1 wadl per 1 class resource - it would be hard to 
achieve because most likely these class resources will share the schema

Sergey




Example of how i configured it in the pom.xml:

<plugin>

               <groupId>org.apache.cxf</groupId>

               <artifactId>cxf-java2wadl-plugin</artifactId>

              <version>3.1.4</version>

                          <executions>

                                      <execution>

<id>process-classes1</id>

<phase>process-classes</phase>

                                                  <goals>

<goal>java2wadl</goal>

                                      </goals>

                                                  <configuration>

                                                  <classResourceNames>

<classResourceName>com.exlibris.primo.webservices.rest.EShelfRestApi</
classResourceName>

                                                  </classResourceNames>

<applicationTitle>Primo</applicationTitle>

<attachWadl>true</attachWadl>

                                       </configuration>

                          </execution>

                  </executions>

              </plugin>





Thanks in advance

Eyal



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Reply via email to