View Javadoc

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.Service;
20  
21  import org.apache.turbine.util.RunData;
22  import org.apache.turbine.util.TurbineException;
23  
24  
25  /***
26   * Implementations of the JspService interface.
27   *
28   * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
29   * @version $Id: JspService.java 264148 2005-08-29 14:21:04Z henning $
30   */
31  public interface JspService
32      extends Service
33  {
34      /*** The name used to specify this service in Turbine.properties */
35      String SERVICE_NAME = "JspService";
36  
37      /*** The key used to store an instance of RunData in the request */
38      String RUNDATA = "rundata";
39  
40      /*** The key used to store an instance of JspLink in the request */
41      String LINK = "link";
42  
43      /*** The default extension of JSPs */
44      String JSP_EXTENSION = "jsp";
45  
46      /*** Property key for Template Pathes */
47      String TEMPLATE_PATH_KEY = "templates";
48  
49      /*** Property for Jsp Page Buffer Size */
50      String BUFFER_SIZE_KEY = "buffer.size";
51  
52      /*** Default Value for Jsp Page Buffer Size */
53      int BUFFER_SIZE_DEFAULT = 8192;
54  
55      /***
56       * Adds some convenience objects to the request.  For example an instance
57       * of JspLink which can be used to generate links to other templates.
58       *
59       * @param data the turbine rundata object
60       */
61      void addDefaultObjects(RunData data);
62  
63      /***
64       * executes the JSP given by templateName.
65       *
66       * @param data A RunData Object
67       * @param templateName The template to execute
68       * @param isForward whether to perform a forward or include.
69       *
70       * @throws TurbineException If a problem occured while executing the JSP
71       */
72      void handleRequest(RunData data, String templateName, boolean isForward)
73          throws TurbineException;
74  
75      /***
76       * executes the JSP given by templateName.
77       *
78       * @param data A RunData Object
79       * @param templateName The template to execute
80       *
81       * @throws TurbineException If a problem occured while executing the JSP
82       */
83      void handleRequest(RunData data, String templateName)
84          throws TurbineException;
85  
86      /***
87       * Returns the default buffer size of the JspService
88       *
89       * @return The default buffer size.
90       */
91      int getDefaultBufferSize();
92  
93      /***
94       * Searchs for a template in the default.template path[s] and
95       * returns the template name with a relative path which is required
96       * by <a href="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletContext.html#getRequestDispatcher(java.lang.String)">javax.servlet.RequestDispatcher</a>
97       *
98       * @param template The name of the template to search for.
99       *
100      * @return the template with a relative path
101      */
102     String getRelativeTemplateName(String template);
103 
104 }