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.pipeline.PipelineData; 25 import org.apache.turbine.services.Service; 26 import org.apache.turbine.util.TurbineException; 27 28 29 /** 30 * Implementations of the JspService interface. 31 * 32 * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a> 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 PipelineData in the request */ 41 String PIPELINE_DATA = "pdata"; 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 pipelineData the Turbine PipelineData object 63 */ 64 void addDefaultObjects(PipelineData pipelineData); 65 66 /** 67 * executes the JSP given by templateName. 68 * 69 * @param pipelineData A PipelineData 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 occurred while executing the JSP 74 */ 75 void handleRequest(PipelineData pipelineData, String templateName, boolean isForward) 76 throws TurbineException; 77 78 /** 79 * executes the JSP given by templateName. 80 * 81 * @param pipelineData A PipelineData Object 82 * @param templateName The template to execute 83 * 84 * @throws TurbineException If a problem occurred while executing the JSP 85 */ 86 void handleRequest(PipelineData pipelineData, 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 * Searches 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 }