IT-KIMI_SHI\SINOIT.KIMI
2018-06-01 64c40fb427bff513f575f11e4c1e7bd9a1bfe3e3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package org.activiti.explorer.servlet;
 
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
 
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
 
public class GenericResponseWrapper extends HttpServletResponseWrapper { 
  private ByteArrayOutputStream output;
  private int contentLength;
  private String contentType;
 
  public GenericResponseWrapper(HttpServletResponse response) { 
    super(response);
    output=new ByteArrayOutputStream();
  } 
 
  public byte[] getData() { 
    return output.toByteArray(); 
  } 
 
  public ServletOutputStream getOutputStream() { 
    return new FilterServletOutputStream(output); 
  } 
  
  public PrintWriter getWriter() { 
    return new PrintWriter(getOutputStream(),true); 
  } 
 
  public void setContentLength(int length) { 
    this.contentLength = length;
    super.setContentLength(length); 
  } 
 
  public int getContentLength() { 
    return contentLength; 
  } 
 
  public void setContentType(String type) { 
    this.contentType = type;
    super.setContentType(type); 
  } 
 
  public String getContentType() { 
    return contentType; 
  }