- 작성시간 : 2012/05/08 20:26
- 퍼머링크 : always19.egloos.com/2864356
- 덧글수 : 0
<dependency>
...
<scope>system</scope>
<systemPath>${basedir}/web/WEB-INF/lib/...
와 같이 경로를 적었다.
이런 거 하지 말라고 하던뎅..
이어지는 내용
<dependency>
...
<scope>system</scope>
<systemPath>${basedir}/web/WEB-INF/lib/...
와 같이 경로를 적었다.
이런 거 하지 말라고 하던뎅..
org.junit.Assert
ByteArrayInputStream bai2 = newByteArrayInputStream(outputStream.toString().getBytes("UTF-8"));
outputStream에서 위와 같이 toString을 쓰면안된다.
stream 안의 내용들이 망가진다.
string으로 출력해봐도 알 수 있다.
outputStream = newByteArrayOutputStream();
ByteArrayInputStream bais = new ByteArrayInputStream(outputStream.toByteArray());
와 같이 toByteArray 로 바꿔야 손실이없다.
Servlet 에서
protected voiddoPost(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException {
…
ServletOutputStream outputStream =res.getOutputStream();
…
d1.setOutputStream(outputStream);
Client에서 쓰는 inputstream 은
InputStream org.apache.commons.httpclient.HttpMethodBase.getResponseBodyAsStream()throws IOException
d2.setInputStream(inputStream);
안에 어떤 내용들이 들어가는지 보려면, FilterOutputStream 을 Decorator로 중간에 끼워 넣는다.
http://devday.tistory.com/entry/OutputStream을-String으로-출력하기
http://www.java2s.com/Code/Java/Development-Class/TraceInputStream.htm
http://www.java2s.com/Code/Java/Development-Class/TraceOutputStream.htm
최근 덧글