1 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 import javax.servlet.jsp.JspFactory ; 29 30 import org.apache.jasper.compiler.Localizer; 31 32 37 public abstract class HttpJspBase 38 extends HttpServlet 39 implements HttpJspPage 40 41 42 { 43 44 static { 45 if( JspFactory.getDefaultFactory() == null ) { 46 JspFactoryImpl factory = new JspFactoryImpl(); 47 if( System.getSecurityManager() != null ) { 48 String basePackage = "org.apache.jasper."; 49 try { 50 factory.getClass().getClassLoader().loadClass( basePackage + 51 "runtime.JspFactoryImpl$PrivilegedGetPageContext"); 52 factory.getClass().getClassLoader().loadClass( basePackage + 53 "runtime.JspFactoryImpl$PrivilegedReleasePageContext"); 54 factory.getClass().getClassLoader().loadClass( basePackage + 55 "runtime.JspRuntimeLibrary"); 56 factory.getClass().getClassLoader().loadClass( basePackage + 57 "runtime.JspRuntimeLibrary$PrivilegedIntrospectHelper"); 58 factory.getClass().getClassLoader().loadClass( basePackage + 59 "runtime.ServletResponseWrapperInclude"); 60 factory.getClass().getClassLoader().loadClass( basePackage + 61 "servlet.JspServletWrapper"); 62 } catch (ClassNotFoundException ex) { 63 org.apache.commons.logging.LogFactory.getLog( HttpJspBase.class ) 64 .error("Jasper JspRuntimeContext preload of class failed: " + 65 ex.getMessage(), ex); 66 } 67 } 68 JspFactory.setDefaultFactory(factory); 69 } 70 } 71 72 protected HttpJspBase() { 73 } 74 75 public final void init(ServletConfig config) 76 throws ServletException 77 { 78 super.init(config); 79 jspInit(); 80 _jspInit(); 81 } 82 83 public String getServletInfo() { 84 return Localizer.getMessage("jsp.engine.info"); 85 } 86 87 public final void destroy() { 88 jspDestroy(); 89 _jspDestroy(); 90 } 91 92 95 public final void service(HttpServletRequest request, HttpServletResponse response) 96 throws ServletException , IOException 97 { 98 _jspService(request, response); 99 } 100 101 public void jspInit() { 102 } 103 104 public void _jspInit() { 105 } 106 107 public void jspDestroy() { 108 } 109 110 protected void _jspDestroy() { 111 } 112 113 public abstract void _jspService(HttpServletRequest request, 114 HttpServletResponse response) 115 throws ServletException , IOException ; 116 } 117 | Popular Tags |