01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.rproxy.rewriter.test.util;
06:
07: import com.sun.portal.rproxy.connectionhandler.CachedSocket;
08: import com.sun.portal.log.common.PortalLogger;
09: import com.sun.portal.rproxy.connectionhandler.Response;
10:
11: import java.io.BufferedInputStream;
12: import java.io.ByteArrayInputStream;
13:
14: public class MockResponse implements Response {
15: private BufferedInputStream in;
16: private final String headders;
17: private final String mime;
18:
19: public MockResponse(String aContent, String aHeadders, String aMIME) {
20: if (aContent != null) {
21: in = new BufferedInputStream(new ByteArrayInputStream(
22: aContent.getBytes()));
23: }
24:
25: headders = aHeadders;
26: mime = aMIME;
27: }//constructor
28:
29: public MockResponse(BufferedInputStream aInputStream,
30: String aHeadders, String aMIME) {
31:
32: this .in = aInputStream;
33: headders = aHeadders;
34: mime = aMIME;
35: }//constructor
36:
37: public BufferedInputStream getContentStream() {
38: return in;
39: }//getContentStream()
40:
41: public String getContentType() {
42: return headders;
43: }//getContentType()
44:
45: public String getContentEncoding() {
46: return null;
47: }//getContentEncoding()
48:
49: public String getResponseHeader(String s) {
50: return null;
51: }//getResponseHeader()
52:
53: public String getStatusCode() {
54: return null;
55: }//getStatusCode()
56:
57: public String getStatusText() {
58: return null;
59: }//getStatusText()
60:
61: public byte[] getHeaderBytes() {
62: return new byte[0];
63: }//getHeaderBytes()
64:
65: public void setContentLength(int i) {
66: }//setContentLength()
67:
68: public void setConnectionClose() {
69: }
70:
71: public void setConnectionAlive(String s) {
72: }
73:
74: public void setLocation(String s) {
75: }
76:
77: public void setStatusText(String s) {
78: }
79:
80: public void setSocket(CachedSocket cachedSocket) {
81: }
82:
83: public void closeSocket() {
84: }
85:
86: public void setClientCaching() {
87: }
88:
89: public void setResponseHeader(String s, String s1) {
90: }
91: }//class MockResponse
|