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