01: /*
02: * JFolder, Copyright 2001-2006 Gary Steinmetz
03: *
04: * Distributable under LGPL license.
05: * See terms of license at gnu.org.
06: */
07:
08: package org.jfolder.console.web.base;
09:
10: //base classes
11: import java.io.IOException;
12: import javax.servlet.ServletException;
13: import javax.servlet.ServletInputStream;
14: import javax.servlet.ServletOutputStream;
15: import javax.servlet.http.HttpServlet;
16: import javax.servlet.http.HttpServletRequest;
17: import javax.servlet.http.HttpServletResponse;
18:
19: //project specific classes
20:
21: //other classes
22:
23: public class DumpServlet extends HttpServlet {
24:
25: public DumpServlet() {
26: }
27:
28: public void service(HttpServletRequest inRequest,
29: HttpServletResponse inResponse) throws IOException,
30: ServletException {
31:
32: inResponse.setContentType("text/plain");
33: ServletInputStream sis = inRequest.getInputStream();
34: ServletOutputStream sos = inResponse.getOutputStream();
35:
36: int nextByte = -1;
37:
38: while ((nextByte = sis.read()) != -1) {
39: sos.write((byte) nextByte);
40: }
41:
42: sos.flush();
43: sos.close();
44: sis.close();
45:
46: }
47: }
|