%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.turbine.services.jsp.TurbineJsp |
|
|
1 | package org.apache.turbine.services.jsp; |
|
2 | ||
3 | /* |
|
4 | * Copyright 2001-2005 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 org.apache.turbine.services.TurbineServices; |
|
20 | ||
21 | import org.apache.turbine.util.RunData; |
|
22 | import org.apache.turbine.util.TurbineException; |
|
23 | ||
24 | /** |
|
25 | * Facade class for the Jsp Service. |
|
26 | * |
|
27 | * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a> |
|
28 | * @version $Id: TurbineJsp.java 264148 2005-08-29 14:21:04Z henning $ |
|
29 | */ |
|
30 | 0 | public abstract class TurbineJsp |
31 | { |
|
32 | /** |
|
33 | * Utility method for accessing the service |
|
34 | * implementation |
|
35 | * |
|
36 | * @return a JspService implementation instance |
|
37 | */ |
|
38 | protected static JspService getService() |
|
39 | { |
|
40 | 0 | return (JspService) TurbineServices |
41 | .getInstance().getService(JspService.SERVICE_NAME); |
|
42 | } |
|
43 | ||
44 | /** |
|
45 | * Adds some convenience objects to the request. For example an instance |
|
46 | * of JspLink which can be used to generate links to other templates. |
|
47 | * |
|
48 | * @param data the turbine rundata object |
|
49 | */ |
|
50 | public static void addDefaultObjects(RunData data) |
|
51 | { |
|
52 | 0 | getService().addDefaultObjects(data); |
53 | 0 | } |
54 | ||
55 | /** |
|
56 | * executes the JSP given by templateName. |
|
57 | * |
|
58 | * @param data A RunData Object |
|
59 | * @param templateName The template to execute |
|
60 | * @param isForward whether to perform a forward or include. |
|
61 | * |
|
62 | * @throws TurbineException If a problem occured while executing the JSP |
|
63 | */ |
|
64 | public static void handleRequest(RunData data, String templateName, boolean isForward) |
|
65 | throws TurbineException |
|
66 | { |
|
67 | 0 | getService().handleRequest(data, templateName, isForward); |
68 | 0 | } |
69 | ||
70 | /** |
|
71 | * executes the JSP given by templateName. |
|
72 | * |
|
73 | * @param data A RunData Object |
|
74 | * @param templateName The template to execute |
|
75 | * |
|
76 | * @throws TurbineException If a problem occured while executing the JSP |
|
77 | */ |
|
78 | public static void handleRequest(RunData data, String templateName) |
|
79 | throws TurbineException |
|
80 | { |
|
81 | 0 | getService().handleRequest(data, templateName); |
82 | 0 | } |
83 | ||
84 | /** |
|
85 | * Returns the default buffer size of the JspService |
|
86 | * |
|
87 | * @return The default buffer size. |
|
88 | */ |
|
89 | public static int getDefaultBufferSize() |
|
90 | { |
|
91 | 0 | return getService().getDefaultBufferSize(); |
92 | } |
|
93 | ||
94 | /** |
|
95 | * Searchs for a template in the default.template path[s] and |
|
96 | * returns the template name with a relative path which is required |
|
97 | * by <a href="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletContext.html#getRequestDispatcher(java.lang.String)">javax.servlet.RequestDispatcher</a> |
|
98 | * |
|
99 | * @param template The name of the template to search for. |
|
100 | * |
|
101 | * @return the template with a relative path |
|
102 | */ |
|
103 | public static String getRelativeTemplateName(String template) |
|
104 | { |
|
105 | 0 | return getService().getRelativeTemplateName(template); |
106 | } |
|
107 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |