Question
How to get the HttpServletRespnose in ThingWorx extension ?
Hi,
We're going to implement a download function which is triggered from the server side , the code would like:
String headerKey = "Content-Disposition";
String headerValue = String.format("attachment; filename=\"%s\"", downloadFile.getName());
response.setHeader(headerKey, headerValue);
// obtains response's output stream
OutputStream outStream = response.getOutputStream();
byte[] buffer = new byte[4096];
int bytesRead = -1;
while ((bytesRead = inStream.read(buffer)) != -1) {
outStream.write(buffer, 0, bytesRead);
}
inStream.close();
outStream.close();
The question is : how can I get the HttpServletResponse with Java SDK ?
Regards,
Sean
