Hi, i have a servlet in GAE :

    public void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException {

        String titulo = req.getParameter("titulo");
        String json = "";

        PersistenceManager pm = PMF.get().getPersistenceManager();
        Query query = pm.newQuery("select from "+Video.class.getName()+ "
where titulo.startsWith('"+titulo+"')");
        List<Video> video = (List<Video>) pm.newQuery(query).execute();

        Gson gson = new Gson();

        json = gson.toJson(video, new TypeToken<List<Video>>(){}.getType());
        System.out.println("SERIALIZED >> " + json);

        res.setContentType("application/json");
        res.setCharacterEncoding("UTF-8");
        res.getWriter().write(json);

    }

So i'm trying to deserialize with GSON too :

    public void receberMetaDados(String titulo) throws IOException,
Exception{
        InputStream input = new URL("http://localhost:8888/serve?titulo=
"+titulo).openStream();
        Reader reader = new InputStreamReader(input, "UTF-8");

        List<Video> results = new Gson().fromJson(reader, new
TypeToken<List<Video>>(){}.getType());

    }

But isn't working, any help ?

Best regards,
Valter Henrique.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to