- String filename = reply.get_string("filename", null);
- try {
- File file = new File(filename);
- long length = file.length();
- FileInputStream in = new FileInputStream(file);
- String content_type = reply.get_string("content_type", null);
- System.out.printf("Content-Type: %s\n", content_type);
- System.out.printf("Content-Length: %d\n", file.length());
- System.out.printf("\n");
- byte[] buf = new byte[4096];
- int bytes_read;
- while ((bytes_read = in.read(buf)) > 0)
- System.out.write(buf);
- } catch (IOException ie) {
- fail(404, String.format("IO Exception: %s", ie.toString()));
+ String filename = reply.get_string("filename", null);
+ try {
+ File file = new File(filename);
+ long length = file.length();
+ FileInputStream in = new FileInputStream(file);
+ String content_type = reply.get_string("content_type", null);
+ System.out.printf("Content-Type: %s\n", content_type);
+ System.out.printf("Content-Length: %d\n", file.length());
+ System.out.printf("\n");
+ byte[] buf = new byte[4096];
+ int bytes_read;
+ while ((bytes_read = in.read(buf)) > 0)
+ System.out.write(buf);
+ } catch (IOException ie) {
+ fail(404, String.format("IO Exception: %s", ie.toString()));
+ }
+ } catch (Exception e) {
+ fail(404, String.format("Exception %s", e.toString()));