Hi Adam, You should use the get() method which returns immediately (non blocking) when there is a callback specified. Once the HTTP response is available, the callback specified in the onResponse property is called (your MyUniform instance).
Best regards, Jerome 2013/4/27 Adam Mc <[email protected]> > Hi,I am trying to use and understand the asynchronous client callback. > Here is code sections: > > ------------- > //In the main: > ClientResource cr = new ClientResource(myurl); > cr.setOnResponse(new MyUniform()); > //cr.get(); > cr.getOnResponse(); > System.out.println("done with main"); > > > //In the MyUniform class > public void handle(Request request, Response response) { > try { > String text = response.getEntity().getText(); > System.out.println(text); > } catch (Exception e) { > e.printStackTrace(); > } > } > ---------------- > > I am not quite sure if I should use ClientResource.get or getOnResponse. > It seems like I should use getOnResponse, but that is having no effect. > If I use get(), it works, but not asynchronously, as it prints "done with > main" after the response is obtained. > > Any thoughts on how I can set this up? > > Thanks, > -Adam > > ------------------------------------------------------ > > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3054435 > ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3054439

