001 /** 002 * 003 * Copyright 2003-2004 The Apache Software Foundation 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018 // 019 // This source code implements specifications defined by the Java 020 // Community Process. In order to remain compliant with the specification 021 // DO NOT add / change / or delete method signatures! 022 // 023 024 package javax.servlet.jsp; 025 026 import javax.servlet.*; 027 028 /** 029 * The JspPage interface describes the generic interaction that a JSP Page 030 * Implementation class must satisfy; pages that use the HTTP protocol 031 * are described by the HttpJspPage interface. 032 * 033 * <p><B>Two plus One Methods</B> 034 * <p> 035 * The interface defines a protocol with 3 methods; only two of 036 * them: jspInit() and jspDestroy() are part of this interface as 037 * the signature of the third method: _jspService() depends on 038 * the specific protocol used and cannot be expressed in a generic 039 * way in Java. 040 * <p> 041 * A class implementing this interface is responsible for invoking 042 * the above methods at the appropriate time based on the 043 * corresponding Servlet-based method invocations. 044 * <p> 045 * The jspInit() and jspDestroy() methods can be defined by a JSP 046 * author, but the _jspService() method is defined automatically 047 * by the JSP processor based on the contents of the JSP page. 048 * 049 * <p><B>_jspService()</B> 050 * <p> 051 * The _jspService()method corresponds to the body of the JSP page. This 052 * method is defined automatically by the JSP container and should never 053 * be defined by the JSP page author. 054 * <p> 055 * If a superclass is specified using the extends attribute, that 056 * superclass may choose to perform some actions in its service() method 057 * before or after calling the _jspService() method. See using the extends 058 * attribute in the JSP_Engine chapter of the JSP specification. 059 * <p> 060 * The specific signature depends on the protocol supported by the JSP page. 061 * 062 * <pre> 063 * public void _jspService(<em>ServletRequestSubtype</em> request, 064 * <em>ServletResponseSubtype</em> response) 065 * throws ServletException, IOException; 066 * </pre> 067 */ 068 069 070 public interface JspPage extends Servlet { 071 072 /** 073 * The jspInit() method is invoked when the JSP page is initialized. It 074 * is the responsibility of the JSP implementation (and of the class 075 * mentioned by the extends attribute, if present) that at this point 076 * invocations to the getServletConfig() method will return the desired 077 * value. 078 * 079 * A JSP page can override this method by including a definition for it 080 * in a declaration element. 081 * 082 * A JSP page should redefine the init() method from Servlet. 083 */ 084 public void jspInit(); 085 086 /** 087 * The jspDestroy() method is invoked when the JSP page is about to be 088 * destroyed. 089 * 090 * A JSP page can override this method by including a definition for it 091 * in a declaration element. 092 * 093 * A JSP page should redefine the destroy() method from Servlet. 094 */ 095 public void jspDestroy(); 096 097 }