Register additional classes for WADL
* Register additional classes for WADL
It is useful in case when classes are provided by 3rd party and cannot be annotated by
* Simplify code
* Missprint
@@ -200,6 +200,8 @@ public class WadlGenerator implements ContainerRequestFilter {
private ResourceIdGenerator idGenerator;
private Map<String, Object> jaxbContextProperties;
+ private List<Class<?>> extraClasses = Collections.emptyList();
+
public WadlGenerator() {
}
@@ -208,6 +210,15 @@ public class WadlGenerator implements ContainerRequestFilter {
this.bus.setProperty("wadl.service.description.available", "true");
}
+ /**
+ * The list of classes which should be added to the generated scheme also.
+ */
+ public void setExtraClasses(List<Class<?>> extraClasses) {
+ if (extraClasses != null) {
+ this.extraClasses = extraClasses;
+ }
+ }
+
@Override
public void filter(ContainerRequestContext context) {
Message m = JAXRSUtils.getCurrentMessage();
@@ -491,7 +502,7 @@ public class WadlGenerator implements ContainerRequestFilter {
if (!this.useJaxbContextForQnames) {
return;
}
- List<Class<?>> extraClasses = new LinkedList<>();
+ List<Class<?>> extraClasses = new LinkedList<>(this.extraClasses);
for (Class<?> cls : resourceTypes.getAllTypes().keySet()) {
if (!isXmlRoot(cls) || Modifier.isAbstract(cls.getModifiers())) {
XmlSeeAlso seeAlsoAnn = cls.getAnnotation(XmlSeeAlso.class);
