Skip to content

Package: JspPage

JspPage

Coverage

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