01 /*
02 * Copyright 2004 The Apache Software Foundation
03 *
04 * Licensed under the Apache License, Version 2.0 (the "License");
05 * you may not use this file except in compliance with the License.
06 * You may obtain a copy of the License at
07 *
08 * http://www.apache.org/licenses/LICENSE-2.0
09 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package javax.servlet.jsp;
17
18 import javax.servlet.*;
19
20 /**
21 * The JspPage interface describes the generic interaction that a JSP Page
22 * Implementation class must satisfy; pages that use the HTTP protocol
23 * are described by the HttpJspPage interface.
24 *
25 * <p><B>Two plus One Methods</B>
26 * <p>
27 * The interface defines a protocol with 3 methods; only two of
28 * them: jspInit() and jspDestroy() are part of this interface as
29 * the signature of the third method: _jspService() depends on
30 * the specific protocol used and cannot be expressed in a generic
31 * way in Java.
32 * <p>
33 * A class implementing this interface is responsible for invoking
34 * the above methods at the appropriate time based on the
35 * corresponding Servlet-based method invocations.
36 * <p>
37 * The jspInit() and jspDestroy() methods can be defined by a JSP
38 * author, but the _jspService() method is defined automatically
39 * by the JSP processor based on the contents of the JSP page.
40 *
41 * <p><B>_jspService()</B>
42 * <p>
43 * The _jspService()method corresponds to the body of the JSP page. This
44 * method is defined automatically by the JSP container and should never
45 * be defined by the JSP page author.
46 * <p>
47 * If a superclass is specified using the extends attribute, that
48 * superclass may choose to perform some actions in its service() method
49 * before or after calling the _jspService() method. See using the extends
50 * attribute in the JSP_Engine chapter of the JSP specification.
51 * <p>
52 * The specific signature depends on the protocol supported by the JSP page.
53 *
54 * <pre>
55 * public void _jspService(<em>ServletRequestSubtype</em> request,
56 * <em>ServletResponseSubtype</em> response)
57 * throws ServletException, IOException;
58 * </pre>
59 */
60
61 public interface JspPage extends Servlet {
62
63 /**
64 * The jspInit() method is invoked when the JSP page is initialized. It
65 * is the responsibility of the JSP implementation (and of the class
66 * mentioned by the extends attribute, if present) that at this point
67 * invocations to the getServletConfig() method will return the desired
68 * value.
69 *
70 * A JSP page can override this method by including a definition for it
71 * in a declaration element.
72 *
73 * A JSP page should redefine the init() method from Servlet.
74 */
75 public void jspInit();
76
77 /**
78 * The jspDestroy() method is invoked when the JSP page is about to be
79 * destroyed.
80 *
81 * A JSP page can override this method by including a definition for it
82 * in a declaration element.
83 *
84 * A JSP page should redefine the destroy() method from Servlet.
85 */
86 public void jspDestroy();
87
88 }
|