001: /*
002: Copyright (C) 2003-2006 Know Gate S.L. All rights reserved.
003: C/Oņa, 107 1š2 28050 Madrid (Spain)
004:
005: Redistribution and use in source and binary forms, with or without
006: modification, are permitted provided that the following conditions
007: are met:
008:
009: 1. Redistributions of source code must retain the above copyright
010: notice, this list of conditions and the following disclaimer.
011:
012: 2. The end-user documentation included with the redistribution,
013: if any, must include the following acknowledgment:
014: "This product includes software parts from hipergate
015: (http://www.hipergate.org/)."
016: Alternately, this acknowledgment may appear in the software itself,
017: if and wherever such third-party acknowledgments normally appear.
018:
019: 3. The name hipergate must not be used to endorse or promote products
020: derived from this software without prior written permission.
021: Products derived from this software may not be called hipergate,
022: nor may hipergate appear in their name, without prior written
023: permission.
024:
025: This library is distributed in the hope that it will be useful,
026: but WITHOUT ANY WARRANTY; without even the implied warranty of
027: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
028:
029: You should have received a copy of hipergate License with this code;
030: if not, visit http://www.hipergate.org or mail to info@hipergate.org
031: */
032:
033: package com.knowgate.http.portlets;
034:
035: import java.util.Hashtable;
036: import java.util.Enumeration;
037: import java.util.Properties;
038: import java.util.Map;
039: import java.util.Locale;
040: import java.util.Locale;
041:
042: import java.io.IOException;
043: import java.io.PrintWriter;
044: import java.io.OutputStream;
045: import java.io.ByteArrayOutputStream;
046:
047: import javax.portlet.PortletURL;
048: import javax.portlet.RenderResponse;
049:
050: import javax.servlet.http.HttpServletResponse;
051:
052: /**
053: * @author Sergio Montoro Ten
054: * @version 1.0
055: */
056:
057: public class HipergateRenderResponse implements RenderResponse {
058:
059: private Properties oProps;
060: private HttpServletResponse oSrvltRes;
061:
062: public HipergateRenderResponse(HttpServletResponse oServletRes) {
063: oProps = new Properties();
064: oSrvltRes = oServletRes;
065: }
066:
067: public void setProperty(String key, String value) {
068: oProps.setProperty(key, value);
069: }
070:
071: public void addProperty(String key, String value) {
072: String sProp = oProps.getProperty(key);
073:
074: if (sProp == null)
075: oProps.setProperty(key, value);
076: else {
077: oProps.remove(key);
078: oProps.setProperty(key, sProp + ";" + value);
079: }
080: }
081:
082: public String encodeURL(String path) {
083: return oSrvltRes.encodeURL(path);
084: }
085:
086: public String getContentType() {
087: throw new UnsupportedOperationException(
088: "getContentType() not implemented HipergateRenderRequest");
089: }
090:
091: public PortletURL createRenderURL() {
092: throw new UnsupportedOperationException(
093: "createRenderURL() not implemented HipergateRenderRequest");
094: }
095:
096: public PortletURL createActionURL() {
097: throw new UnsupportedOperationException(
098: "createActionURL() not implemented HipergateRenderRequest");
099: }
100:
101: public String getNamespace() {
102: throw new UnsupportedOperationException(
103: "getNamespace() not implemented HipergateRenderRequest");
104: }
105:
106: public void setTitle(String title) {
107: throw new UnsupportedOperationException(
108: "setTitle() not implemented HipergateRenderRequest");
109: }
110:
111: public void setContentType(String type) {
112: oSrvltRes.setContentType(type);
113: }
114:
115: public String getCharacterEncoding() {
116: return oSrvltRes.getCharacterEncoding();
117: }
118:
119: public PrintWriter getWriter() throws IOException {
120: return oSrvltRes.getWriter();
121: }
122:
123: public Locale getLocale() {
124: return oSrvltRes.getLocale();
125: }
126:
127: public void setBufferSize(int size) {
128: oSrvltRes.setBufferSize(size);
129: }
130:
131: public int getBufferSize() {
132: return oSrvltRes.getBufferSize();
133: }
134:
135: public void flushBuffer() throws IOException {
136: oSrvltRes.flushBuffer();
137: }
138:
139: public void resetBuffer() {
140: oSrvltRes.resetBuffer();
141: }
142:
143: public boolean isCommitted() {
144: return oSrvltRes.isCommitted();
145: }
146:
147: public void reset() {
148: oSrvltRes.reset();
149: }
150:
151: public OutputStream getPortletOutputStream() throws IOException {
152: return oSrvltRes.getOutputStream();
153: }
154:
155: }
|