View Javadoc

1   package org.apache.turbine.services.jsp;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.turbine.services.Service;
23  
24  import org.apache.turbine.util.RunData;
25  import org.apache.turbine.util.TurbineException;
26  
27  
28  /***
29   * Implementations of the JspService interface.
30   *
31   * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
32   * @version $Id: JspService.java 534527 2007-05-02 16:10:59Z tv $
33   */
34  public interface JspService
35      extends Service
36  {
37      /*** The name used to specify this service in Turbine.properties */
38      String SERVICE_NAME = "JspService";
39  
40      /*** The key used to store an instance of RunData in the request */
41      String RUNDATA = "rundata";
42  
43      /*** The key used to store an instance of JspLink in the request */
44      String LINK = "link";
45  
46      /*** The default extension of JSPs */
47      String JSP_EXTENSION = "jsp";
48  
49      /*** Property key for Template Pathes */
50      String TEMPLATE_PATH_KEY = "templates";
51  
52      /*** Property for Jsp Page Buffer Size */
53      String BUFFER_SIZE_KEY = "buffer.size";
54  
55      /*** Default Value for Jsp Page Buffer Size */
56      int BUFFER_SIZE_DEFAULT = 8192;
57  
58      /***
59       * Adds some convenience objects to the request.  For example an instance
60       * of JspLink which can be used to generate links to other templates.
61       *
62       * @param data the turbine rundata object
63       */
64      void addDefaultObjects(RunData data);
65  
66      /***
67       * executes the JSP given by templateName.
68       *
69       * @param data A RunData Object
70       * @param templateName The template to execute
71       * @param isForward whether to perform a forward or include.
72       *
73       * @throws TurbineException If a problem occured while executing the JSP
74       */
75      void handleRequest(RunData data, String templateName, boolean isForward)
76          throws TurbineException;
77  
78      /***
79       * executes the JSP given by templateName.
80       *
81       * @param data A RunData Object
82       * @param templateName The template to execute
83       *
84       * @throws TurbineException If a problem occured while executing the JSP
85       */
86      void handleRequest(RunData data, String templateName)
87          throws TurbineException;
88  
89      /***
90       * Returns the default buffer size of the JspService
91       *
92       * @return The default buffer size.
93       */
94      int getDefaultBufferSize();
95  
96      /***
97       * Searchs for a template in the default.template path[s] and
98       * returns the template name with a relative path which is required
99       * by <a href="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletContext.html#getRequestDispatcher(java.lang.String)">javax.servlet.RequestDispatcher</a>
100      *
101      * @param template The name of the template to search for.
102      *
103      * @return the template with a relative path
104      */
105     String getRelativeTemplateName(String template);
106 
107 }