Skip to content

Instantly share code, notes, and snippets.

Created January 9, 2015 09:37
Show Gist options
  • Save anonymous/566c3ce9af6632c3198c to your computer and use it in GitHub Desktop.
Save anonymous/566c3ce9af6632c3198c to your computer and use it in GitHub Desktop.
MessageBodyWriter not found for media type=application/xml, type=class java.util.ArrayList, genericType=java.util.List<java.lang.String>.
@GET
@javax.ws.rs.Path("l")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response Ef_Get_Anula_Documento() throws IOException {
GenericEntity<List<String>> entity = new GenericEntity<List<String>>(getText()) {
};
Response response = Response.ok(entity).build();
return response;
}
public ArrayList<String> getText() throws IOException {
ArrayList<String> a = new ArrayList<>();
//Scanner Example - read file line by line in Java using Scanner
FileInputStream fis = new FileInputStream("C:/new5.log");
Scanner scanner = new Scanner(fis);
while (scanner.hasNextLine()) {
a.add(scanner.nextLine());
}
return a;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment