KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > template > jsp > WebManResponse


1 package de.webman.template.jsp;
2
3 import javax.servlet.*;
4 import java.io.*;
5 import javax.servlet.http.*;
6
7 /**
8  * @author $Author: alex $
9  * @version $Revision: 1.2 $
10  */

11 public class WebManResponse implements HttpServletResponse
12 {
13     private PrintWriter writer;
14     
15     public WebManResponse(PrintWriter _writer)
16     {
17         writer = _writer;
18     }
19     
20     /**
21      * Adds the specified cookie to the response. It can be called
22      * multiple times to set more than one cookie.
23      *
24      * @param cookie the Cookie to return to the client
25      */

26     public void addCookie(Cookie cookie){}
27
28     /**
29      * Checks whether the response message header has a field with
30      * the specified name.
31      *
32      * @param name the header field name
33      * @return true if the response message header has a field with
34      * the specified name; false otherwise
35      */

36     public boolean containsHeader(String JavaDoc name)
37     {
38         return false;
39     }
40         
41     public void addDateHeader(java.lang.String JavaDoc name, long date)
42     {}
43     
44     public void addHeader(java.lang.String JavaDoc name, java.lang.String JavaDoc value)
45     {}
46     
47     public void addIntHeader(java.lang.String JavaDoc name, int value)
48     {}
49     
50     public java.lang.String JavaDoc encodeRedirectURL(java.lang.String JavaDoc url)
51     {
52         return url;
53     }
54     
55     public java.lang.String JavaDoc encodeURL(java.lang.String JavaDoc url)
56     {
57         return url;
58     }
59     
60     public void flushBuffer()
61     {}
62     
63     /**
64         2.3
65     */

66     public void resetBuffer()
67     {
68     }
69
70     public int getBufferSize()
71     {
72         return 0;
73     }
74     
75     public java.util.Locale JavaDoc getLocale()
76     {
77         return null;
78     }
79     
80     public boolean isCommitted()
81     {
82         return false;
83     }
84     
85     public void reset()
86     {}
87     
88     public void setBufferSize(int size)
89     {}
90     
91     public void setLocale(java.util.Locale JavaDoc loc)
92     {}
93     
94     /**
95      * Sets the status code and message for this response. If the
96      * field had already been set, the new value overwrites the
97      * previous one. The message is sent as the body of an HTML
98      * page, which is returned to the user to describe the problem.
99      * The page is sent with a default HTML header; the message
100      * is enclosed in simple body tags (<body></body>).
101      *
102      * @param sc the status code
103      * @param sm the status message
104      @deprecated
105      */

106     public void setStatus(int sc, String JavaDoc sm){}
107
108     /**
109      * Sets the status code for this response. This method is used to
110      * set the return status code when there is no error (for example,
111      * for the status codes SC_OK or SC_MOVED_TEMPORARILY). If there
112      * is an error, the <code>sendError</code> method should be used
113      * instead.
114      *
115      * @param sc the status code
116      *
117      * @see #sendError
118        @deprecated
119      */

120     public void setStatus(int sc){}
121
122     /**
123      *
124      * Adds a field to the response header with the given name and value.
125      * If the field had already been set, the new value overwrites the
126      * previous one. The <code>containsHeader</code> method can be
127      * used to test for the presence of a header before setting its
128      * value.
129      *
130      * @param name the name of the header field
131      * @param value the header field's value
132      *
133      * @see #containsHeader
134      */

135     public void setHeader(String JavaDoc name, String JavaDoc value){}
136
137     /**
138      * Adds a field to the response header with the given name and
139      * integer value. If the field had already been set, the new value
140      * overwrites the previous one. The <code>containsHeader</code>
141      * method can be used to test for the presence of a header before
142      * setting its value.
143      *
144      * @param name the name of the header field
145      * @param value the header field's integer value
146      *
147      * @see #containsHeader
148      */

149     public void setIntHeader(String JavaDoc name, int value){}
150
151     /**
152      *
153      * Adds a field to the response header with the given name and
154      * date-valued field. The date is specified in terms of
155      * milliseconds since the epoch. If the date field had already
156      * been set, the new value overwrites the previous one. The
157      * <code>containsHeader</code> method can be used to test for the
158      * presence of a header before setting its value.
159      *
160      * @param name the name of the header field
161      * @param value the header field's date value
162      *
163      * @see #containsHeader
164      */

165     public void setDateHeader(String JavaDoc name, long date){}
166
167     /**
168      * Sends an error response to the client using the specified status
169      * code and descriptive message. If setStatus has previously been
170      * called, it is reset to the error status code. The message is
171      * sent as the body of an HTML page, which is returned to the user
172      * to describe the problem. The page is sent with a default HTML
173      * header; the message is enclosed in simple body tags
174      * (&lt;body&gt;&lt;/body&gt;).
175      *
176      * @param sc the status code
177      * @param msg the detail message
178      * @exception IOException If an I/O error has occurred. */

179     public void sendError(int sc, String JavaDoc msg) throws IOException
180     {
181         // ausfuellen !!!
182
}
183
184     /**
185      * Sends an error response to the client using the specified
186      * status code and a default message.
187      * @param sc the status code
188      * @exception IOException If an I/O error has occurred.
189      */

190     public void sendError(int sc) throws IOException
191     {
192         // ausfuellen !!!
193
}
194     
195
196     /**
197      * Sends a temporary redirect response to the client using the
198      * specified redirect location URL. The URL must be absolute (for
199      * example, <code><em>https://hostname/path/file.html</em></code>).
200      * Relative URLs are not permitted here.
201      *
202      * @param location the redirect location URL
203      * @exception IOException If an I/O error has occurred.
204      */

205     public void sendRedirect(String JavaDoc location) throws IOException
206     {
207         // brauchen wir
208
}
209
210     /**
211      * Encodes the specified URL by including the session ID in it,
212      * or, if encoding is not needed, returns the URL unchanged.
213      * The implementation of this method should include the logic to
214      * determine whether the session ID needs to be encoded in the URL.
215      * For example, if the browser supports cookies, or session
216      * tracking is turned off, URL encoding is unnecessary.
217      *
218      * <p>All URLs emitted by a Servlet should be run through this
219      * method. Otherwise, URL rewriting cannot be used with browsers
220      * which do not support cookies.
221      *
222      * @param url the url to be encoded.
223      * @return the encoded URL if encoding is needed; the unchanged URL
224      * otherwise.
225      @deprecated
226      */

227     public String JavaDoc encodeUrl (String JavaDoc url){return url;}
228
229     /**
230      * Encodes the specified URL for use in the
231      * <code>sendRedirect</code> method or, if encoding is not needed,
232      * returns the URL unchanged. The implementation of this method
233      * should include the logic to determine whether the session ID
234      * needs to be encoded in the URL. Because the rules for making
235      * this determination differ from those used to decide whether to
236      * encode a normal link, this method is seperate from the
237      * <code>encodeUrl</code> method.
238      *
239      * <p>All URLs sent to the HttpServletResponse.sendRedirect
240      * method should be run through this method. Otherwise, URL
241      * rewriting canont be used with browsers which do not support
242      * cookies.
243      *
244      * @param url the url to be encoded.
245      * @return the encoded URL if encoding is needed; the unchanged URL
246      * otherwise.
247      *
248      * @see #sendRedirect
249      * @see #encodeUrl
250         @deprecated
251      */

252     public String JavaDoc encodeRedirectUrl (String JavaDoc url)
253     {
254         return url;
255     }
256     
257     /**
258      * Sets the content length for this response.
259      *
260      * @param len the content length
261      */

262     public void setContentLength(int len)
263     {}
264
265     /**
266      * Sets the content type for this response. This type may later
267      * be implicitly modified by addition of properties such as the MIME
268      * <em>charset=&lt;value&gt;</em> if the service finds it necessary,
269      * and the appropriate media type property has not been set.
270      *
271      * <p>This response property may only be assigned one time. If a
272      * writer is to be used to write a text response, this method must
273      * be called before the method <code>getWriter</code>. If an
274      * output stream will be used to write a response, this method must
275      * be called before the output stream is used to write response
276      * data.
277      *
278      * @param type the content's MIME type
279      * @see getOutputStream
280      * @see getWriter */

281     public void setContentType(String JavaDoc type)
282     {}
283
284     /**
285      * Returns an output stream for writing binary response data.
286      *
287      * @see getWriter
288      * @exception IllegalStateException if getWriter has been
289      * called on this same request.
290      * @exception IOException if an I/O exception has occurred
291      */

292     public ServletOutputStream getOutputStream() throws IOException
293     {
294         // ausfuellen
295
return null;
296     }
297
298     /**
299      * Returns a print writer for writing formatted text responses. The
300      * MIME type of the response will be modified, if necessary, to reflect
301      * the character encoding used, through the <em>charset=...</em>
302      * property. This means that the content type must be set before
303      * calling this method.
304      *
305      * @see getOutputStream
306      * @see setContentType
307      *
308      * @exception UnsupportedEncodingException if no such encoding can
309      * be provided
310      * @exception IllegalStateException if getOutputStream has been
311      * called on this same request.
312      * @exception IOException on other errors.
313      */

314     public PrintWriter getWriter () throws IOException
315     {
316         return writer;
317     }
318
319     /**
320      * Returns the character set encoding used for this MIME body.
321      * The character encoding is either the one specified in the
322      * assigned content type, or one which the client understands.
323      * If no content type has yet been assigned, it is implicitly
324      * set to <em>text/plain</em>
325      */

326     public String JavaDoc getCharacterEncoding ()
327     {
328         return null;
329     }
330     
331 }
332
Popular Tags