001: /*
002: * GatewayServletResponse.java
003: *
004: * $Author: ss150821 $
005: *
006: * $Date: 2005/11/30 11:27:21 $ $Revision: 1.3 $
007: *
008: * Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved.
009: *
010: * Developed by SunPS and SunIR
011: */
012:
013: package com.sun.portal.rproxy.connectionhandler;
014:
015: import java.io.DataOutputStream;
016: import java.io.IOException;
017: import java.io.PrintWriter;
018: import java.text.SimpleDateFormat;
019: import java.util.Date;
020:
021: import javax.servlet.ServletOutputStream;
022: import javax.servlet.http.Cookie;
023: import javax.servlet.http.HttpServletResponse;
024:
025: public class GatewayServletResponse implements HttpServletResponse {
026: protected final static String crlf = "\r\n";
027:
028: protected static SimpleDateFormat df = new SimpleDateFormat(
029: "EEE, dd MMM yyyy HH:mm:ss zzz");
030:
031: private DataOutputStream dataOS = null;
032:
033: private boolean headersDone = false;
034:
035: public GatewayServletResponse(DataOutputStream dos) {
036: dataOS = dos;
037: }
038:
039: /**
040: * Method from HttpServletResponse
041: */
042:
043: public void addCookie(Cookie cookie) {
044: }
045:
046: public void addDateHeader(String n, long t) {
047: }
048:
049: public void addHeader(String n, String v) {
050: }
051:
052: public void addIntHeader(String n, int i) {
053: }
054:
055: public boolean containsHeader(String name) {
056: return true;
057: }
058:
059: public String encodeRedirectURL(String url) {
060: return null;
061: }
062:
063: /*
064: * @deprecated
065: */
066: public String encodeRedirectUrl(String url) {
067: return null;
068: }
069:
070: public String encodeURL(String url) {
071: return null;
072: }
073:
074: /*
075: * @deprecated
076: */
077: public String encodeUrl(String url) {
078: return null;
079: }
080:
081: public void flushBuffer() {
082: }
083:
084: public int getBufferSize() {
085: return 0;
086: }
087:
088: public String getCharacterEncoding() {
089: return null;
090: }
091:
092: public java.util.Locale getLocale() {
093: return null;
094: }
095:
096: public PrintWriter getWriter() {
097: return null;
098: }
099:
100: public ServletOutputStream getOutputStream() {
101: return (new GatewayServletOutputStream(dataOS, this ));
102: }
103:
104: public boolean isCommitted() {
105: return false;
106: }
107:
108: public void reset() {
109: }
110:
111: public void setContentType(String name) {
112: }
113:
114: public void setContentLength(int length) {
115: }
116:
117: public void setBufferSize(int n) {
118: }
119:
120: public void sendError(int sc) throws IOException {
121: }
122:
123: public void sendError(int sc, String msg) throws IOException {
124: }
125:
126: public void sendRedirect(String location) throws IOException {
127: }
128:
129: public void setDateHeader(String name, long date) {
130: }
131:
132: public void setHeader(String name, String value) {
133: }
134:
135: public void setIntHeader(String name, int value) {
136: }
137:
138: public void setLocale(java.util.Locale l) {
139: }
140:
141: public void setStatus(int sc) {
142: }
143:
144: /*
145: * @deprecated
146: */
147: public void setStatus(int sc, String sm) {
148: }
149:
150: public void emitHeaders() {
151: if (headersDone) {
152: return;
153: }
154:
155: try {
156: dataOS.writeBytes("HTTP/1.1 200 OK" + crlf + "Date: "
157: + df.format(new Date()) + crlf + "Pragma: no-cache"
158: + crlf + "Server: IPS" + crlf
159: + "Content-Type: text" + crlf + crlf);
160: } catch (Exception e) {
161: }
162:
163: headersDone = true;
164: }
165: }
|