Hellllloooooooo, where are you RESTLet

We are currently developing a little REST based service for the storage of RDF.  It uses openAnzo (2.5.1) and Restlet (1.0.5).  All was going well until the client calls disappeared into a black hole.  No responses were coming back from the server, in fact nothing seemed to be arriving there.  Turns out that when you get a Response back from Restlet it has a stream which it would like you to either read or close, for example:

response.getEntity().getStream().close();

or

response.getEntity().write(System.out);

Otherwise the client keeps trying to send to the server but can’t get an open socket to get there.  Another problem solved!

Cross platform fun

While debugging some test problems with the T2 code I discovered some issues between OSX and Windows regards file paths and line breaks.  Seems that instead of just

inputs.put(“fileUrl”, LocalworkerTranslator.class.getResource( “/AAC4_HUMAN.sp”).getFile());

you have to ensure that the absolute path is correct by doing

URI uri = LocalworkerTranslator.class.getResource(“/AAC4_HUMAN.sp”) .toURI();

File newFile = new File(uri);

inputs.put(“fileUrl”, newFile.getAbsolutePath());

Also, you can’t expect checks for “\n” style line breaks to work in Windows because they insert things like “\r\n” instead.  So , you should use System.getProperty(“line.separator”) instead.