Hi,
My client method looks like this.
Code:
@RequestMapping(value = "/{userId}", method = RequestMethod.GET)
public void testClient(@PathVariable String userId) {
try{
Client c = Client.create();
WebResource r=c.resource("http://localhost:8080/elecpay/user/s984323/pay/3);
ClientResponse response = r.get(ClientResponse.class);
String entity = response.getEntity(String.class);
System.out.println("DONE1 = "+entity.length());
System.out.println("DONE2 = "+entity.getBytes().length);
this.convertByteArrayToPDF(entity.getBytes(), "newname");
}catch(Exception e) {e.printStackTrace();}
}
My server code looks like this.
Code:
@RequestMapping(value = "/{userId}/pay/{pay}", method = RequestMethod.GET)
public @ResponseBody byte[] getPay(@PathVariable String userId,
@PathVariable String pay,
) {
byte[] byteArray = null;
try {
byteArray = loadFile("/justa.pdf");
System.out.println("ORIGINAL size = "+byteArray.length);
} catch (IOException ex) {
Logger.getLogger(ElecPayService.class.getName()).log(Level.SEVERE, null, ex);
}
return byteArray;
}
The ORIGINAL byteArray.length printout comes to 517828
The DONE1 length is 495704 (client string)
The DONE2 length is 495605 (client string.getBytes...)
Cannot really see why the different in length in client/sever.
The servermethod also gets called twice?