001package org.apache.turbine.services.jsp; 002 003 004/* 005 * Licensed to the Apache Software Foundation (ASF) under one 006 * or more contributor license agreements. See the NOTICE file 007 * distributed with this work for additional information 008 * regarding copyright ownership. The ASF licenses this file 009 * to you under the Apache License, Version 2.0 (the 010 * "License"); you may not use this file except in compliance 011 * with the License. You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, 016 * software distributed under the License is distributed on an 017 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 018 * KIND, either express or implied. See the License for the 019 * specific language governing permissions and limitations 020 * under the License. 021 */ 022 023 024import org.apache.turbine.pipeline.PipelineData; 025import org.apache.turbine.services.Service; 026import org.apache.turbine.util.TurbineException; 027 028 029/** 030 * Implementations of the JspService interface. 031 * 032 * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a> 033 */ 034public interface JspService 035 extends Service 036{ 037 /** The name used to specify this service in Turbine.properties */ 038 String SERVICE_NAME = "JspService"; 039 040 /** The key used to store an instance of PipelineData in the request */ 041 String PIPELINE_DATA = "pdata"; 042 043 /** The key used to store an instance of JspLink in the request */ 044 String LINK = "link"; 045 046 /** The default extension of JSPs */ 047 String JSP_EXTENSION = "jsp"; 048 049 /** Property key for Template Pathes */ 050 String TEMPLATE_PATH_KEY = "templates"; 051 052 /** Property for Jsp Page Buffer Size */ 053 String BUFFER_SIZE_KEY = "buffer.size"; 054 055 /** Default Value for Jsp Page Buffer Size */ 056 int BUFFER_SIZE_DEFAULT = 8192; 057 058 /** 059 * Adds some convenience objects to the request. For example an instance 060 * of JspLink which can be used to generate links to other templates. 061 * 062 * @param pipelineData the Turbine PipelineData object 063 */ 064 void addDefaultObjects(PipelineData pipelineData); 065 066 /** 067 * executes the JSP given by templateName. 068 * 069 * @param pipelineData A PipelineData Object 070 * @param templateName The template to execute 071 * @param isForward whether to perform a forward or include. 072 * 073 * @throws TurbineException If a problem occurred while executing the JSP 074 */ 075 void handleRequest(PipelineData pipelineData, String templateName, boolean isForward) 076 throws TurbineException; 077 078 /** 079 * executes the JSP given by templateName. 080 * 081 * @param pipelineData A PipelineData Object 082 * @param templateName The template to execute 083 * 084 * @throws TurbineException If a problem occurred while executing the JSP 085 */ 086 void handleRequest(PipelineData pipelineData, String templateName) 087 throws TurbineException; 088 089 /** 090 * Returns the default buffer size of the JspService 091 * 092 * @return The default buffer size. 093 */ 094 int getDefaultBufferSize(); 095 096 /** 097 * Searches for a template in the default.template path[s] and 098 * returns the template name with a relative path which is required 099 * 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}