KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > turbine > services > jsp > TurbineJsp


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

18
19 import java.io.OutputStream JavaDoc;
20 import java.io.Writer JavaDoc;
21 import org.apache.turbine.services.TurbineServices;
22 import org.apache.turbine.util.RunData;
23 import org.apache.velocity.context.Context;
24
25 /**
26  * This is a simple static accessor to common Jsp tasks such as
27  * getting an instance of a context as well as handling a request for
28  * processing a template.
29  *
30  * @author <a HREF="mailto:john.mcnally@clearink.com">John D. McNally</a>
31  * @author <a HREF="mailto:jon@latchkey.com">Jon S. Stevens</a>
32  * @author <a HREF="mailto:jvanzyl@periapt.com.com">Jason van Zyl</a>
33  * @author <a HREF="mailto:gabrielm@itcsoluciones.com">Gabriel A. Moreno</a>
34  * @version $Id: TurbineJsp.java,v 1.1.2.2 2004/05/20 03:03:07 seade Exp $
35  */

36 public abstract class TurbineJsp
37 {
38     /**
39      * Utility method for accessing the service
40      * implementation
41      *
42      * @return a JspService implementation instance
43      */

44     protected static JspService getService()
45     {
46         return (JspService)TurbineServices
47             .getInstance().getService(JspService.SERVICE_NAME);
48     }
49
50     /**
51      * This returns a Context that can be used in the Jsp template
52      * once you have populated it with information that the template
53      * will know about.
54      *
55      * @param data A Turbine RunData.
56      * @return A Context.
57      */

58     public static Context getContext(RunData data)
59     {
60         return getService().getContext(data);
61     }
62
63     /**
64      * This method returns a blank Context object.
65      *
66      * @return A WebContext.
67      */

68     public static Context getContext()
69     {
70         return getService().getContext();
71     }
72
73 }
74
75
Popular Tags