Examples of InputStreamDownload


Examples of br.com.caelum.vraptor.interceptor.download.InputStreamDownload

    for (Entry<Object, Object> entry : entrySet) {
      sb.append(String.format("%-50s %s\n", entry.getKey(), entry.getValue()));
    }
    sb.append(String.format("%-50s %s\n", "Charset.defaultCharset()", Charset.defaultCharset()));

    return new InputStreamDownload(new ByteArrayInputStream(sb.toString().getBytes()), "text/plain", "log.log");
  }
View Full Code Here

Examples of br.com.caelum.vraptor.interceptor.download.InputStreamDownload

    }
    LOG.debug("accessing file: " + file.getCanonicalPath());
    if (!file.exists()) {
      throw new IllegalStateException("file not found");
    }
    return new InputStreamDownload(new FileInputStream(file), "text/plain", "log.log");
  }
View Full Code Here

Examples of br.com.caelum.vraptor.observer.download.InputStreamDownload

    for (Entry<Object, Object> entry : entrySet) {
      sb.append(String.format("%-50s %s\n", entry.getKey(), entry.getValue()));
    }
    sb.append(String.format("%-50s %s\n", "Charset.defaultCharset()", Charset.defaultCharset()));

    return new InputStreamDownload(new ByteArrayInputStream(sb.toString().getBytes()), "text/plain", "log.log");
  }
View Full Code Here

Examples of br.com.caelum.vraptor.observer.download.InputStreamDownload

    }
    LOG.debug("accessing file: " + file.getCanonicalPath());
    if (!file.exists()) {
      throw new IllegalStateException("file not found");
    }
    return new InputStreamDownload(new FileInputStream(file), "text/plain", "log.log");
  }
View Full Code Here

Examples of br.com.caelum.vraptor.observer.download.InputStreamDownload

    when(response.getOutputStream()).thenReturn(socketStream);
  }

  @Test
  public void shouldFlushWholeStreamToHttpResponse() throws IOException {
    InputStreamDownload fd = new InputStreamDownload(inputStream, "type", "x.txt");
    fd.write(response);
   
    assertArrayEquals(bytes, outputStream.toByteArray());
  }
View Full Code Here

Examples of br.com.caelum.vraptor.observer.download.InputStreamDownload

    assertArrayEquals(bytes, outputStream.toByteArray());
  }

  @Test
  public void shouldUseHeadersToHttpResponse() throws IOException {
    InputStreamDownload fd = new InputStreamDownload(inputStream, "type", "x.txt");
    fd.write(response);

    verify(response).setHeader("Content-type", "type");
    assertArrayEquals(bytes, outputStream.toByteArray());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.