KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > excalibur > instrument > manager > http > server > AbstractHTTPURLPrintWriterHandler


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

19
20 package org.apache.excalibur.instrument.manager.http.server;
21
22 import java.io.IOException JavaDoc;
23 import java.io.OutputStream JavaDoc;
24 import java.io.OutputStreamWriter JavaDoc;
25 import java.io.PrintWriter JavaDoc;
26 import java.util.Map JavaDoc;
27
28 /**
29  *
30  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
31  * @version CVS $Revision: 1.1 $ $Date: 2004/03/06 14:01:28 $
32  * @since 4.1
33  */

34 public abstract class AbstractHTTPURLPrintWriterHandler
35     extends AbstractHTTPURLHandler
36 {
37     /*---------------------------------------------------------------
38      * Constructors
39      *-------------------------------------------------------------*/

40     /**
41      * Creates a new AbstractHTTPURLPrintWriterHandler.
42      *
43      * @param path The path handled by this handler.
44      * @param contentType The content type.
45      * @param encoding The encoding to use when writing servlet results.
46      */

47     public AbstractHTTPURLPrintWriterHandler( String JavaDoc path, String JavaDoc contentType, String JavaDoc encoding )
48     {
49         super( path, contentType + "; charset=" + encoding, encoding );
50     }
51     
52     /*---------------------------------------------------------------
53      * AbstractHTTPURLHandler Methods
54      *-------------------------------------------------------------*/

55     /**
56      * Handles the specified request.
57      *
58      * @param The full path being handled.
59      * @param parameters A Map of the parameters in the request.
60      * @param os The OutputStream to write the result to.
61      */

62     public final void doGet( String JavaDoc path, Map JavaDoc parameters, OutputStream JavaDoc os )
63         throws IOException JavaDoc
64     {
65         PrintWriter JavaDoc out = new PrintWriter JavaDoc( new OutputStreamWriter JavaDoc( os, getEncoding() ) );
66         doGet( path, parameters, out );
67         out.flush();
68     }
69             
70     /*---------------------------------------------------------------
71      * Methods
72      *-------------------------------------------------------------*/

73     /**
74      * Handles the specified request.
75      *
76      * @param The full path being handled.
77      * @param parameters A Map of the parameters in the request.
78      * @param os The PrintWriter to write the result to.
79      */

80     public abstract void doGet( String JavaDoc path, Map JavaDoc parameters, PrintWriter JavaDoc out )
81         throws IOException JavaDoc;
82 }
83
84
Popular Tags