1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.jasper.runtime;
19
20 import java.io.IOException;
21
22 import javax.servlet.ServletConfig;
23 import javax.servlet.ServletException;
24 import javax.servlet.http.HttpServlet;
25 import javax.servlet.http.HttpServletRequest;
26 import javax.servlet.http.HttpServletResponse;
27 import javax.servlet.jsp.HttpJspPage;
28
29 import org.apache.jasper.Constants;
30 import org.apache.jasper.compiler.Localizer;
31
32 /**
33  * This is the super class of all JSP-generated servlets.
34  *
35  * @author Anil K. Vijendran
36  */

37 public abstract class HttpJspBase extends HttpServlet implements HttpJspPage {
38
39     private static final long serialVersionUID = 1L;
40
41     protected HttpJspBase() {
42     }
43
44     @Override
45     public final void init(ServletConfig config)
46         throws ServletException
47     {
48         super.init(config);
49         jspInit();
50         _jspInit();
51     }
52
53     @Override
54     public String getServletInfo() {
55         return Localizer.getMessage("jsp.engine.info", Constants.SPEC_VERSION);
56     }
57
58     @Override
59     public final void destroy() {
60         jspDestroy();
61         _jspDestroy();
62     }
63
64     /**
65      * Entry point into service.
66      */

67     @Override
68     public final void service(HttpServletRequest request, HttpServletResponse response)
69         throws ServletException, IOException
70     {
71         _jspService(request, response);
72     }
73
74     @Override
75     public void jspInit() {
76     }
77
78     public void _jspInit() {
79     }
80
81     @Override
82     public void jspDestroy() {
83     }
84
85     protected void _jspDestroy() {
86     }
87
88     @Override
89     public abstract void _jspService(HttpServletRequest request,
90                                      HttpServletResponse response)
91         throws ServletException, IOException;
92 }
93