Examples of JasperServletWrapper


Examples of org.emrys.webosgi.core.jsp.JasperServletWrapper

          if (servlet != null)
            servlet.service(req, resp);
          else {
            // Process JSP file.
            Bundle bundle = ctx.getBundle();
            JasperServletWrapper jspServlet = JspServletPool
                .getInstance(ctx);
            BundledHttpServletRequestWrapper wrapper = BundledHttpServletRequestWrapper
                .getHttpServletRequestWrapper(req, bundle);
            wrapper.setServletPath(jspFile);
            wrapper.setPathInfo(null);
            jspServlet.service(wrapper, resp);
          }
          return Status.OK_STATUS;
        } catch (Exception e) {
          // e.printStackTrace();
          return new Status(Status.ERROR, FwkActivator.getInstance()
View Full Code Here

Examples of org.emrys.webosgi.core.jsp.JasperServletWrapper

     * "/")) newResPath = newResPath.replaceFirst("/" +
     * activator.getServiceNSPrefix() + "/", "/");
     */

    // Get a poolled servlet to process jsp file.
    JasperServletWrapper jspServlet = JspServletPool.getInstance(webApp
        .getBundleServletContext());
    // ClassLoader c = jspServlet.getClass().getClassLoader();
    // if newResPath is the same, the jasper may not compile the jsp
    // just use the form class
    // file. here set the servlet name to virtual name to hint that
    // these are different.
    // get the target bundle's servlet config.
    // ServletConfig newConfig = new
    // BundledServletConfig(targetBundle,getJspServletConfig(),
    // virtualPath);
    // jspServlet.init(newConfig);

    BundledHttpServletRequestWrapper topReq = (BundledHttpServletRequestWrapper) webContainer
        .getReqThreadVariants().get(OSGiWebContainer.THREAD_V_REQUEST);

    HttpServletRequest req = (HttpServletRequest) threadScope.get().get(
        RESPONSE_REQ);
    ServletResponse resp = (ServletResponse) threadScope.get().get(
        RESPONSE_RESP);

    BundledHttpServletRequestWrapper wrapper = BundledHttpServletRequestWrapper
        .getHttpServletRequestWrapper(req, targetBundle);

    Bundle oldBundle = topReq.getBundle();
    String oldServletPath = topReq.getServletPath();
    String oldPathInfo = topReq.getPathInfo();
    try {
      // Switch to another bundled servelt request.
      // No need to swith thread context class loader, coz Jsp Servlet's
      // class loader has been changed.
      topReq.setBundle(targetBundle);
      // wrapper.setBundle(targetBundle);
      wrapper.setServletPath(virtualPath);
      wrapper.setPathInfo(null);
      jspServlet.service(wrapper, resp);
      // jspServlet.destroy();
    } finally {
      if (topReq.equals(wrapper)) {
        topReq.setBundle(oldBundle);
        topReq.setServletPath(oldServletPath);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.