I am using JAX-RS web services (Jersey). I have a pojo User.java. This pojo is not generated from XSD. This pojo is handwritten. Can i return such a pojo using REStful web service method? Also, is it mandatory to write XSD while using Restful WEbservices?
@GET
@Produces ("application/xml")
public List<User> getUsersAll() {
List<User> als=null;
try {
als= UserService.getInstance().getUserAll();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return als;
}
Is above code possible without jaxb generated object User,java and only with handwritten User.java? Also, is it good practice to write XSD always? Thanks!