I can call http://localhost/products and get the desired XML output. If I call http://localhost/facets I get
Mar 24, 2015 3:10:50 PM org.restlet.ext.jaxrs.internal.util.ExceptionHandler noMessageBodyWriter
WARNING: No message body writer found for class com.galexis.search.productsearch.bean.facet.FacetsDTO(generic type is class com.galexis.search.productsearch.bean.facet.FacetsDTO); response media type should be: application/xml; accepted media types are: [[text/html, application/xhtml+xml], [application/xml], [*/*]]
This is my resource:
public class MyResource {
@Path("products")
@GET
@Produces("application/xml")
public ProductsDTO getProductsByFieldNamesAndSearchStrings(somme parameters) {
return getProducts();
}
@Path("facets")
@GET
@Produces("application/xml")
public FacetsDTO getProductsFacetByFieldNamesAndSearchStrings(somme parameters) {
return getFacets();
}
}
ProductsDTO
@XmlRootElement(name = "products")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType
public class ProductsDTO {
...
}
FacetsDTO
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
public class FacetsDTO {
...
}
Any idea what's missing?
After taking the hard tour and debug the restelt jax-rs extenstion I discovered that it checks for a @XmlRootElement
element. If it's absent it refuses to server an application/xml
answer.