Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @GET
- //@Path("{id}")
- @Produces({"text/html", "application/json"})
- public Response getNoticia(@QueryParam("id")Long id){ //@PathParam("id")Long id@QueryParam("id") String id, @QueryParam("formato")String formato
- dao.open();
- dao.begin();
- Noticia n = dao.find(Noticia.class,id);
- if(n.getAutor() != null){
- dao.close();
- return Response.ok("<html>\n" +
- "<head>\n" +
- " <title> Noticias </title>\n" +
- "</head>\n" +
- "<body>\n" +
- " <ul>\n" +
- " <li>Título: " + n.getTitulo() + ". Autor: " + n.getAutor() + ". Conteúdo: " + n.getConteudo() + ". Id: " + n.getId() + ". Data: " + n.getData() + "</li>\n" +
- " </ul>\n" +
- "</body>\n" +
- "</html>").build();
- }else{
- dao.close();
- return Response.status(Status.NOT_FOUND).build();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement