001 package 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 024 import org.apache.turbine.services.Service; 025 026 import org.apache.turbine.util.RunData; 027 import org.apache.turbine.util.TurbineException; 028 029 030 /** 031 * Implementations of the JspService interface. 032 * 033 * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a> 034 */ 035 public interface JspService 036 extends Service 037 { 038 /** The name used to specify this service in Turbine.properties */ 039 String SERVICE_NAME = "JspService"; 040 041 /** The key used to store an instance of RunData in the request */ 042 String RUNDATA = "rundata"; 043 044 /** The key used to store an instance of JspLink in the request */ 045 String LINK = "link"; 046 047 /** The default extension of JSPs */ 048 String JSP_EXTENSION = "jsp"; 049 050 /** Property key for Template Pathes */ 051 String TEMPLATE_PATH_KEY = "templates"; 052 053 /** Property for Jsp Page Buffer Size */ 054 String BUFFER_SIZE_KEY = "buffer.size"; 055 056 /** Default Value for Jsp Page Buffer Size */ 057 int BUFFER_SIZE_DEFAULT = 8192; 058 059 /** 060 * Adds some convenience objects to the request. For example an instance 061 * of JspLink which can be used to generate links to other templates. 062 * 063 * @param data the turbine rundata object 064 */ 065 void addDefaultObjects(RunData data); 066 067 /** 068 * executes the JSP given by templateName. 069 * 070 * @param data A RunData Object 071 * @param templateName The template to execute 072 * @param isForward whether to perform a forward or include. 073 * 074 * @throws TurbineException If a problem occured while executing the JSP 075 */ 076 void handleRequest(RunData data, String templateName, boolean isForward) 077 throws TurbineException; 078 079 /** 080 * executes the JSP given by templateName. 081 * 082 * @param data A RunData Object 083 * @param templateName The template to execute 084 * 085 * @throws TurbineException If a problem occured while executing the JSP 086 */ 087 void handleRequest(RunData data, String templateName) 088 throws TurbineException; 089 090 /** 091 * Returns the default buffer size of the JspService 092 * 093 * @return The default buffer size. 094 */ 095 int getDefaultBufferSize(); 096 097 /** 098 * Searchs for a template in the default.template path[s] and 099 * 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 }