KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > taglibs > standard > examples > util > ServletResponseWrapperForWriter


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.taglibs.standard.examples.util;
18
19 import java.io.PrintWriter JavaDoc;
20
21 import javax.servlet.*;
22 import javax.servlet.http.*;
23 import javax.servlet.jsp.*;
24
25 /**
26  * ServletResponseWrapper used for the the generation of
27  * semi-dynamic pages.
28  * <p>
29  * This 'wrapped' response object is passed as the second argument
30  * to the internal RequestDispatcher.include(). It channels
31  * all output text into the PrintWriter specified in the
32  * constructor (which is associated with the file where the
33  * output of the JSP page has to be saved).
34  *
35  * @author Pierre Delisle
36  * @version $Revision: 1.3 $ $Date: 2004/02/28 01:01:41 $
37  */

38 public class ServletResponseWrapperForWriter
39     extends HttpServletResponseWrapper
40 {
41     /**
42      * The writer that will get all the output of the response.
43      */

44     PrintWriter JavaDoc writer;
45
46     public ServletResponseWrapperForWriter(ServletResponse response,
47                        PrintWriter JavaDoc writer)
48     {
49     super((HttpServletResponse)response);
50     this.writer = writer;
51     }
52
53     /**
54      * Returns the Writer associated with the response.
55      */

56     public java.io.PrintWriter JavaDoc getWriter()
57     throws java.io.IOException JavaDoc
58     {
59     return writer;
60     }
61 }
62
63
Popular Tags