Code: Select all
<servlet>
<servlet-name>RESTApiServlet</servlet-name>
<servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.mycompany.api</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>RESTApiServlet</servlet-name>
<url-pattern>/api/v1/*</url-pattern>
</servlet-mapping>
I am able to access the endpoints defined by the broadleaf like..
Code: Select all
http://localhost:9009/api/v1/catalog/search/products?q=go
I haven't created any new endpoints, but I have added some methods to the com.mycompany.api.endpoint.catalog.CatalogEndpoint and I have created a wrapper class in the same package.
The method looks something like this..
Code: Select all
public List<MyEntityWrapper> findMyEntitys(@Context HttpServletRequest request,
@PathParam("id") Long id) {
myDao.setEntityManager(em);
List<MyEntity> MyEntitys=myDao.findAllMyEntitysOrderByRating(id);
if(MyEntitys==null || MyEntitys.size()>0)
{
ArrayList<MyEntityWrapper> wrappers=new ArrayList<MyEntityWrapper>();
for(MyEntity MyEntity:MyEntitys)
{
MyEntityWrapper sw=new MyEntityWrapper(myDao.findMyEntityProductFor(id, MyEntity.getMyEntityId()));
sw.wrapSummary(MyEntity, request);
wrappers.add(sw);
}
return wrappers;
}
return null;
}
I am getting the following exception when accessing the endpoint..
Code: Select all
javax.ws.rs.WebApplicationException: javax.xml.bind.MarshalException
- with linked exception:
[com.sun.istack.internal.SAXException2: unable to marshal type "com.mycompany.api.endpoint.catalog.MyEntityWrapper" as an element because it is not known to this context.]