SHARE
TWEET

JSONApiPersonaRESTClientWeb/PersonaServlet.java/get

apuntesdejava Jun 8th, 2013 2,898 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //...
  2.     @Override
  3.     protected void doGet(HttpServletRequest request, HttpServletResponse response)
  4.             throws ServletException, IOException {
  5.         Client client = ClientBuilder.newClient(); //creamos un nuevo cliente...
  6.         client.register(PersonsReader.class); //... registramos nuestro interprete JSON -> Bean
  7.         WebTarget target = client.target(URL);
  8.         LOGGER.info("Solicitamos al Servicio REST el listado");
  9.         List<Person> lista = target.request().get(List.class);
  10.         LOGGER.log(Level.INFO, "Persona:{0}", lista);
  11.         request.setAttribute("personas", lista);
  12.     }
  13. //...
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top