Coding a JAXRS service using jersey and deployed on tomcat. Application subclass
@ApplicationPath("/rest")
public class RestApplication extends Application {
public RestApplication() {
// TODO Auto-generated constructor stub
System.out.println("Inside RestApplication Constructor");
}
@Override
public Set<Class<?>> getClasses() {
// TODO Auto-generated method stub
System.out.println("Get Class");
Set<Class<?>> s=new HashSet<Class<?>>();
s.add(SupportDataService.class);
return s;
}
}
Resource class
@Path("/supportdata")
public class SupportDataService {
public SupportDataService() {
// TODO Auto-generated constructor stub
System.out.println("Inside SupportDataService Constructor");
}
@Path("/support")
@GET
@Produces(MediaType.TEXT_XML)
public String getSupportData(){
String xmlSupport=null;
xmlSupport="<SupportData><Support><key>path1</key><value>value1</value></Support><Support><key>path2</key><value>value2</value></Support></SupportData>";
return xmlSupport;
}
}
Added all jersey jar in WEB-INF/lib except javax.servlet-api-3.0.1.jar and hitting url
http://localhost:8080/RestConfigurator/rest/supportdata/support
but getting 404 error. Not specified any web.xml as subclassed Application.
RestConfigurator- Paul Samsotha