home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-tomcat-addon-1.4.9-installer.exe / include_jsp.class (.txt) < prev    next >
Encoding:
Java Class File  |  2004-05-17  |  4.6 KB  |  79 lines

  1. package org.apache.jsp.include;
  2.  
  3. import java.io.IOException;
  4. import java.util.List;
  5. import java.util.Vector;
  6. import javax.servlet.ServletConfig;
  7. import javax.servlet.ServletContext;
  8. import javax.servlet.ServletException;
  9. import javax.servlet.http.HttpServletRequest;
  10. import javax.servlet.http.HttpServletResponse;
  11. import javax.servlet.http.HttpSession;
  12. import javax.servlet.jsp.JspFactory;
  13. import javax.servlet.jsp.JspWriter;
  14. import javax.servlet.jsp.PageContext;
  15. import javax.servlet.jsp.SkipPageException;
  16. import org.apache.jasper.runtime.HttpJspBase;
  17. import org.apache.jasper.runtime.JspRuntimeLibrary;
  18. import org.apache.jasper.runtime.JspSourceDependent;
  19.  
  20. public final class include_jsp extends HttpJspBase implements JspSourceDependent {
  21.    private static Vector _jspx_dependants = new Vector(1);
  22.  
  23.    public List getDependants() {
  24.       return _jspx_dependants;
  25.    }
  26.  
  27.    public void _jspService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
  28.       JspFactory _jspxFactory = null;
  29.       PageContext pageContext = null;
  30.       HttpSession session = null;
  31.       ServletContext application = null;
  32.       ServletConfig config = null;
  33.       JspWriter out = null;
  34.       JspWriter _jspx_out = null;
  35.       PageContext _jspx_page_context = null;
  36.  
  37.       try {
  38.          _jspxFactory = JspFactory.getDefaultFactory();
  39.          response.setContentType("text/html");
  40.          pageContext = _jspxFactory.getPageContext(this, request, response, (String)null, true, 5120, false);
  41.          _jspx_page_context = pageContext;
  42.          application = pageContext.getServletContext();
  43.          config = pageContext.getServletConfig();
  44.          session = pageContext.getSession();
  45.          out = pageContext.getOut();
  46.          out.write("<html>\r\n<!--\r\n  Copyright 2004 The Apache Software Foundation\r\n\r\n  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n  you may not use this file except in compliance with the License.\r\n  You may obtain a copy of the License at\r\n\r\n      http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n  Unless required by applicable law or agreed to in writing, software\r\n  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n  See the License for the specific language governing permissions and\r\n  limitations under the License.\r\n-->\r\n\r\n<body bgcolor=\"white\">\r\n\r\n<font color=\"red\">\r\n\r\n\r\n\r\n<p>In place evaluation of another JSP which gives you the current time:\r\n\r\n");
  47.          out.write("<!--\r\n  Copyright 2004 The Apache Software Foundation\r\n\r\n  Licensed under the Apache License, Version 2.0 (the \"License\");\r\n  you may not use this file except in compliance with the License.\r\n  You may obtain a copy of the License at\r\n\r\n      http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n  Unless required by applicable law or agreed to in writing, software\r\n  distributed under the License is distributed on an \"AS IS\" BASIS,\r\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n  See the License for the specific language governing permissions and\r\n  limitations under the License.\r\n-->\r\n\r\n<body bgcolor=\"white\">\r\n<font color=\"red\">\r\n\r\n");
  48.          out.print(System.currentTimeMillis());
  49.          out.write(13);
  50.          out.write(10);
  51.          out.write("\r\n\r\n<p> ");
  52.          JspRuntimeLibrary.include(request, response, "/include/foo.html", out, true);
  53.          out.write(" by including the output of another JSP:\r\n\r\n");
  54.          JspRuntimeLibrary.include(request, response, "foo.jsp", out, true);
  55.          out.write("\r\n\r\n:-) \r\n\r\n</html>\r\n");
  56.       } catch (Throwable t) {
  57.          if (!(t instanceof SkipPageException)) {
  58.             if (_jspx_out != null && _jspx_out.getBufferSize() != 0) {
  59.                _jspx_out.clearBuffer();
  60.             }
  61.  
  62.             if (_jspx_page_context != null) {
  63.                _jspx_page_context.handlePageException(t);
  64.             }
  65.          }
  66.       } finally {
  67.          if (_jspxFactory != null) {
  68.             _jspxFactory.releasePageContext(_jspx_page_context);
  69.          }
  70.  
  71.       }
  72.  
  73.    }
  74.  
  75.    static {
  76.       _jspx_dependants.add("/include/foo.jsp");
  77.    }
  78. }
  79.