Package com.caucho.jsp

Examples of com.caucho.jsp.Page


      ServletConfigImpl jspConfig = _servletManager.getServlet("resin-jsp");

      QServlet jsp = (QServlet) jspConfig.createServlet(false);

      // server/105o
      Page page = jsp.getPage(servletName, jspFile, this);

      return page;
    } catch (ServletException e) {
      throw e;
    } catch (Exception e) {
View Full Code Here


  {
    HttpServletRequest req = (HttpServletRequest) request;
    HttpServletResponse res = (HttpServletResponse) response;
   
    try {
      Page page = _servlet.getPage(req, res);

      if (page == null) {
        res.sendError(res.SC_NOT_FOUND);
        return;
      }
View Full Code Here

    HttpServletResponse res = (HttpServletResponse) response;
    FileNotFoundException notFound = null;

    SoftReference<Page> pageRef = _pageRef;

    Page page;

    if (pageRef != null)
      page = pageRef.get();
    else
      page = null;

    if (page == null || page._caucho_isModified()) {
      try {
        _pageRef = null;

        page = compilePage(page, req, res);

        if (page != null) {
          _pageRef = new SoftReference<Page>(page);
     
          _isSingleThread = page instanceof SingleThreadModel;
        }
      } catch (FileNotFoundException e) {
        page = null;

        notFound = e;
      }
    }

    if (page == null) {
      // jsp/01cg
      if (notFound == null)
        return;
     
      String errorUri = (String) req.getAttribute(RequestDispatcher.ERROR_REQUEST_URI);
      String uri = (String) req.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI);
      String forward = (String) req.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI);

      // jsp/01ch
      if (uri != null) {
        //throw new FileNotFoundException(uri);
        throw notFound;
      }
      else if (forward != null) {
        //throw new FileNotFoundException(req.getRequestURI());
        throw notFound;
      }
      else if (errorUri != null) {
        //throw new FileNotFoundException(errorUri);
        throw notFound;
      }
      else {
        log.log(Level.FINER, notFound.toString(), notFound);
      }

      ((HttpServletResponse) res).sendError(HttpServletResponse.SC_NOT_FOUND);
    }
    else if (req instanceof HttpServletRequest) {
      try {
        if (_isSingleThread) {
          synchronized (page) {
            page.pageservice(req, res);
          }
        }
        else
          page.pageservice(req, res);
      } catch (ServletException e) {
        request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, e);
        if (_config != null)
          request.setAttribute(RequestDispatcher.ERROR_SERVLET_NAME,
                               _config.getServletName());
View Full Code Here

  private Page compilePage(Page oldPage,
                           HttpServletRequest req,
                           HttpServletResponse res)
    throws ServletException, FileNotFoundException
  {
    Page newPage = null;

    if (oldPage != null && ! oldPage.startRecompiling()) {
      return oldPage;
    }

    try {
      if (_jspFile != null) {
        req.setAttribute("caucho.jsp.jsp-file", _jspFile);
        req.setAttribute("caucho.jsp.servlet-config", _config);
      }

      if (_config != null)
        newPage = (Page) _config.createServlet(false);
      else {
        newPage = _servlet.getPage(req, res);

        if (newPage != null && ! newPage.isInit()) {
          ServletConfigImpl config = new ServletConfigImpl();
          config.setServletContext(_application);
          config.setServletName(req.getServletPath());
          newPage.caucho_init(config);
        }
      }

      // XXX: In theory, should let the requests drain.  In practice,
      // the JSP destroy() method doesn't do anything.
      if (oldPage != null && ! oldPage.isDead())
        oldPage.destroy();

      if (newPage != null)
        newPage._caucho_use();

      return newPage;
    } catch (ServletException e) {
      throw e;
    } catch (RuntimeException e) {
View Full Code Here

    HttpServletResponse res = (HttpServletResponse) response;
    FileNotFoundException notFound = null;

    SoftReference<Page> pageRef = _pageRef;

    Page page;

    if (pageRef != null)
      page = pageRef.get();
    else
      page = null;

    if (page == null || page._caucho_isModified()) {
      try {
  _pageRef = null;
 
  page = compilePage(page, req, res);

  if (page != null) {
    _pageRef = new SoftReference<Page>(page);
     
    _isSingleThread = page instanceof SingleThreadModel;
  }
      } catch (FileNotFoundException e) {
  page = null;

  notFound = e;
      }
    }

    if (page == null) {
      // jsp/01cg
      if (notFound == null)
  return;
     
      String errorUri = (String) req.getAttribute("javax.servlet.error.request_uri");
      String uri = (String) req.getAttribute("javax.servlet.include.request_uri");
      String forward = (String) req.getAttribute("javax.servlet.forward.request_uri");

      // jsp/01ch
      if (uri != null) {
  //throw new FileNotFoundException(uri);
  throw notFound;
      }
      else if (forward != null) {
  //throw new FileNotFoundException(req.getRequestURI());
  throw notFound;
      }
      else if (errorUri != null) {
  //throw new FileNotFoundException(errorUri);
  throw notFound;
      }
      else {
  log.log(Level.FINER, notFound.toString(), notFound);
      }
 
      ((HttpServletResponse) res).sendError(HttpServletResponse.SC_NOT_FOUND);
    }
    else if (req instanceof HttpServletRequest) {
      try {
  if (_isSingleThread) {
    synchronized (page) {
      page.pageservice(req, res);
    }
  }
  else
    page.pageservice(req, res);
      } catch (ServletException e) {
  request.setAttribute(SERVLET_EXN, e);
  if (_config != null)
    request.setAttribute(SERVLET_NAME, _config.getServletName());
  throw e;
View Full Code Here

  private Page compilePage(Page oldPage,
         HttpServletRequest req,
         HttpServletResponse res)
    throws ServletException, FileNotFoundException
  {
    Page newPage = null;
 
    if (oldPage != null && ! oldPage.startRecompiling()) {
      return oldPage;
    }

    try {
      if (_jspFile != null) {
  req.setAttribute("caucho.jsp.jsp-file", _jspFile);
  req.setAttribute("caucho.jsp.servlet-config", _config);
      }

      if (_config != null)
  newPage = (Page) _config.createServlet(false);
      else {
  newPage = _servlet.getPage(req, res);

  if (newPage != null && ! newPage.isInit()) {
    ServletConfigImpl config = new ServletConfigImpl();
    config.setServletContext(_application);
    config.setServletName(req.getServletPath());
    newPage.caucho_init(config);
  }
      }

      // XXX: In theory, should let the requests drain.  In practice,
      // the JSP destroy() method doesn't do anything.
      if (oldPage != null && ! oldPage.isDead())
  oldPage.destroy();

      if (newPage != null)
  newPage._caucho_use();

      return newPage;
    } catch (ServletException e) {
      throw e;
    } catch (RuntimeException e) {
View Full Code Here

      ServletConfigImpl jspConfig = _servletManager.getServlet("resin-jsp");

      QServlet jsp = (QServlet) jspConfig.createServlet(false);

      // server/105o
      Page page = jsp.getPage(servletName, jspFile, this);

      return page;
    } catch (ServletException e) {
      throw e;
    } catch (Exception e) {
View Full Code Here

  {
    HttpServletRequest req = (HttpServletRequest) request;
    HttpServletResponse res = (HttpServletResponse) response;
   
    try {
      Page page = _servlet.getPage(req, res);

      if (page == null) {
        res.sendError(res.SC_NOT_FOUND);
        return;
      }
View Full Code Here

TOP

Related Classes of com.caucho.jsp.Page

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.