001: package de.webman.template.jsp;
002:
003: import javax.servlet.*;
004: import java.io.*;
005: import javax.servlet.http.*;
006:
007: /**
008: * @author $Author: alex $
009: * @version $Revision: 1.2 $
010: */
011: public class WebManResponse implements HttpServletResponse {
012: private PrintWriter writer;
013:
014: public WebManResponse(PrintWriter _writer) {
015: writer = _writer;
016: }
017:
018: /**
019: * Adds the specified cookie to the response. It can be called
020: * multiple times to set more than one cookie.
021: *
022: * @param cookie the Cookie to return to the client
023: */
024: public void addCookie(Cookie cookie) {
025: }
026:
027: /**
028: * Checks whether the response message header has a field with
029: * the specified name.
030: *
031: * @param name the header field name
032: * @return true if the response message header has a field with
033: * the specified name; false otherwise
034: */
035: public boolean containsHeader(String name) {
036: return false;
037: }
038:
039: public void addDateHeader(java.lang.String name, long date) {
040: }
041:
042: public void addHeader(java.lang.String name, java.lang.String value) {
043: }
044:
045: public void addIntHeader(java.lang.String name, int value) {
046: }
047:
048: public java.lang.String encodeRedirectURL(java.lang.String url) {
049: return url;
050: }
051:
052: public java.lang.String encodeURL(java.lang.String url) {
053: return url;
054: }
055:
056: public void flushBuffer() {
057: }
058:
059: /**
060: 2.3
061: */
062: public void resetBuffer() {
063: }
064:
065: public int getBufferSize() {
066: return 0;
067: }
068:
069: public java.util.Locale getLocale() {
070: return null;
071: }
072:
073: public boolean isCommitted() {
074: return false;
075: }
076:
077: public void reset() {
078: }
079:
080: public void setBufferSize(int size) {
081: }
082:
083: public void setLocale(java.util.Locale loc) {
084: }
085:
086: /**
087: * Sets the status code and message for this response. If the
088: * field had already been set, the new value overwrites the
089: * previous one. The message is sent as the body of an HTML
090: * page, which is returned to the user to describe the problem.
091: * The page is sent with a default HTML header; the message
092: * is enclosed in simple body tags (<body></body>).
093: *
094: * @param sc the status code
095: * @param sm the status message
096: @deprecated
097: */
098: public void setStatus(int sc, String sm) {
099: }
100:
101: /**
102: * Sets the status code for this response. This method is used to
103: * set the return status code when there is no error (for example,
104: * for the status codes SC_OK or SC_MOVED_TEMPORARILY). If there
105: * is an error, the <code>sendError</code> method should be used
106: * instead.
107: *
108: * @param sc the status code
109: *
110: * @see #sendError
111: @deprecated
112: */
113: public void setStatus(int sc) {
114: }
115:
116: /**
117: *
118: * Adds a field to the response header with the given name and value.
119: * If the field had already been set, the new value overwrites the
120: * previous one. The <code>containsHeader</code> method can be
121: * used to test for the presence of a header before setting its
122: * value.
123: *
124: * @param name the name of the header field
125: * @param value the header field's value
126: *
127: * @see #containsHeader
128: */
129: public void setHeader(String name, String value) {
130: }
131:
132: /**
133: * Adds a field to the response header with the given name and
134: * integer value. If the field had already been set, the new value
135: * overwrites the previous one. The <code>containsHeader</code>
136: * method can be used to test for the presence of a header before
137: * setting its value.
138: *
139: * @param name the name of the header field
140: * @param value the header field's integer value
141: *
142: * @see #containsHeader
143: */
144: public void setIntHeader(String name, int value) {
145: }
146:
147: /**
148: *
149: * Adds a field to the response header with the given name and
150: * date-valued field. The date is specified in terms of
151: * milliseconds since the epoch. If the date field had already
152: * been set, the new value overwrites the previous one. The
153: * <code>containsHeader</code> method can be used to test for the
154: * presence of a header before setting its value.
155: *
156: * @param name the name of the header field
157: * @param value the header field's date value
158: *
159: * @see #containsHeader
160: */
161: public void setDateHeader(String name, long date) {
162: }
163:
164: /**
165: * Sends an error response to the client using the specified status
166: * code and descriptive message. If setStatus has previously been
167: * called, it is reset to the error status code. The message is
168: * sent as the body of an HTML page, which is returned to the user
169: * to describe the problem. The page is sent with a default HTML
170: * header; the message is enclosed in simple body tags
171: * (<body></body>).
172: *
173: * @param sc the status code
174: * @param msg the detail message
175: * @exception IOException If an I/O error has occurred. */
176: public void sendError(int sc, String msg) throws IOException {
177: // ausfuellen !!!
178: }
179:
180: /**
181: * Sends an error response to the client using the specified
182: * status code and a default message.
183: * @param sc the status code
184: * @exception IOException If an I/O error has occurred.
185: */
186: public void sendError(int sc) throws IOException {
187: // ausfuellen !!!
188: }
189:
190: /**
191: * Sends a temporary redirect response to the client using the
192: * specified redirect location URL. The URL must be absolute (for
193: * example, <code><em>https://hostname/path/file.html</em></code>).
194: * Relative URLs are not permitted here.
195: *
196: * @param location the redirect location URL
197: * @exception IOException If an I/O error has occurred.
198: */
199: public void sendRedirect(String location) throws IOException {
200: // brauchen wir
201: }
202:
203: /**
204: * Encodes the specified URL by including the session ID in it,
205: * or, if encoding is not needed, returns the URL unchanged.
206: * The implementation of this method should include the logic to
207: * determine whether the session ID needs to be encoded in the URL.
208: * For example, if the browser supports cookies, or session
209: * tracking is turned off, URL encoding is unnecessary.
210: *
211: * <p>All URLs emitted by a Servlet should be run through this
212: * method. Otherwise, URL rewriting cannot be used with browsers
213: * which do not support cookies.
214: *
215: * @param url the url to be encoded.
216: * @return the encoded URL if encoding is needed; the unchanged URL
217: * otherwise.
218: @deprecated
219: */
220: public String encodeUrl(String url) {
221: return url;
222: }
223:
224: /**
225: * Encodes the specified URL for use in the
226: * <code>sendRedirect</code> method or, if encoding is not needed,
227: * returns the URL unchanged. The implementation of this method
228: * should include the logic to determine whether the session ID
229: * needs to be encoded in the URL. Because the rules for making
230: * this determination differ from those used to decide whether to
231: * encode a normal link, this method is seperate from the
232: * <code>encodeUrl</code> method.
233: *
234: * <p>All URLs sent to the HttpServletResponse.sendRedirect
235: * method should be run through this method. Otherwise, URL
236: * rewriting canont be used with browsers which do not support
237: * cookies.
238: *
239: * @param url the url to be encoded.
240: * @return the encoded URL if encoding is needed; the unchanged URL
241: * otherwise.
242: *
243: * @see #sendRedirect
244: * @see #encodeUrl
245: @deprecated
246: */
247: public String encodeRedirectUrl(String url) {
248: return url;
249: }
250:
251: /**
252: * Sets the content length for this response.
253: *
254: * @param len the content length
255: */
256: public void setContentLength(int len) {
257: }
258:
259: /**
260: * Sets the content type for this response. This type may later
261: * be implicitly modified by addition of properties such as the MIME
262: * <em>charset=<value></em> if the service finds it necessary,
263: * and the appropriate media type property has not been set.
264: *
265: * <p>This response property may only be assigned one time. If a
266: * writer is to be used to write a text response, this method must
267: * be called before the method <code>getWriter</code>. If an
268: * output stream will be used to write a response, this method must
269: * be called before the output stream is used to write response
270: * data.
271: *
272: * @param type the content's MIME type
273: * @see getOutputStream
274: * @see getWriter */
275: public void setContentType(String type) {
276: }
277:
278: /**
279: * Returns an output stream for writing binary response data.
280: *
281: * @see getWriter
282: * @exception IllegalStateException if getWriter has been
283: * called on this same request.
284: * @exception IOException if an I/O exception has occurred
285: */
286: public ServletOutputStream getOutputStream() throws IOException {
287: // ausfuellen
288: return null;
289: }
290:
291: /**
292: * Returns a print writer for writing formatted text responses. The
293: * MIME type of the response will be modified, if necessary, to reflect
294: * the character encoding used, through the <em>charset=...</em>
295: * property. This means that the content type must be set before
296: * calling this method.
297: *
298: * @see getOutputStream
299: * @see setContentType
300: *
301: * @exception UnsupportedEncodingException if no such encoding can
302: * be provided
303: * @exception IllegalStateException if getOutputStream has been
304: * called on this same request.
305: * @exception IOException on other errors.
306: */
307: public PrintWriter getWriter() throws IOException {
308: return writer;
309: }
310:
311: /**
312: * Returns the character set encoding used for this MIME body.
313: * The character encoding is either the one specified in the
314: * assigned content type, or one which the client understands.
315: * If no content type has yet been assigned, it is implicitly
316: * set to <em>text/plain</em>
317: */
318: public String getCharacterEncoding() {
319: return null;
320: }
321:
322: }
|