Examples of CFMLFactory


Examples of railo.runtime.CFMLFactory

    pci.copyStateTo(dest);
    return dest;
  }

  public static  PageContextImpl createPageContext(ConfigWeb config,OutputStream os,String serverName,String requestURI,String queryString,Cookie[] cookies,Pair[] headers,Pair[] parameters,Struct attributes)  {
    CFMLFactory factory = config.getFactory();
        HttpServletRequest  req = new HttpServletRequestDummy(
        config.getRootDirectory(),
        serverName,
        requestURI,
        queryString,
        cookies,
        headers,
        parameters,
        attributes,
        null
      );
   
   
    req=new HTTPServletRequestWrap(req);
        HttpServletResponse  rsp=createHttpServletResponse(os);
       
        return (PageContextImpl) factory.getRailoPageContext(
            factory.getServlet(),
            req, rsp, null, false, -1, false);
   
  }
View Full Code Here

Examples of railo.runtime.CFMLFactory

    try {
      ThreadLocalPageContext.register(pc);
      return getCFC(pc,requestURI);
    }
    finally{
      CFMLFactory f = config.getFactory();
      f.releasePageContext(pc);
      ThreadLocalPageContext.register(oldPC);
    }
  }
View Full Code Here

Examples of railo.runtime.CFMLFactory

        // Result
        return pc.variablesScope().get(AMF_FORWARD,null);
      }
    }
    finally{
      CFMLFactory f = config.getFactory();
      f.releasePageContext(pc);
      ThreadLocalPageContext.register(oldPC);
    }
    return defaultValue;
  }
View Full Code Here

Examples of railo.runtime.CFMLFactory

   
    //try {
     
     
        // Forward
        CFMLFactory factory = CFMLEngineImpl.getInstance().getCFMLFactory(context, config, req);
        PageContext pc=null;

        // CFC Files
        String cfc;
        Object parameters=null;
        try {
            cfc="/"+serviceName.replace('.','/')+".cfc";
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            pc=createPageContext(factory,cfc,"method="+serviceMethodName,baos,req);
            PageSource source = ((PageContextImpl)pc).getPageSourceExisting(cfc);

            if(caster==null)caster=((ConfigImpl)pc.getConfig()).getAMFCaster(configMap);
            parameters=caster.toCFMLObject(rawParams);
          if(source!=null) {
            print(pc,cfc+"?method="+serviceMethodName);
              // Map
              //print.err(parameters);
            if(parameters instanceof Map){
              //print.err("map");
                pc.getHttpServletRequest().setAttribute("argumentCollection", parameters);
              }
            // List
              else if(parameters instanceof List){
                //print.err("list");
                pc.getHttpServletRequest().setAttribute("argumentCollection", parameters);
              }
              else {
                ArrayList list = new ArrayList();
                list.add(parameters);
                pc.getHttpServletRequest().setAttribute("argumentCollection", list);
               
              }
             
                // Execute
                pc.execute(cfc,true);

                // write back response
                writeBackResponse(pc,rsp);
               
                // After
              return caster.toAMFObject(pc.variablesScope().get(AMF_FORWARD,null));
             
            }
        }
        finally {
            if(pc!=null)factory.releaseRailoPageContext(pc);
        }   
       
     // CFML Files
        String cfml;
        try {
            cfml="/"+(serviceName.replace('.','/')+'/'+serviceMethodName.replace('.','/'))+".cfm";
            pc=createPageContext(factory,cfml,"",null,req);
            PageSource source = ((PageContextImpl)pc).getPageSourceExisting(cfml);
           
            if(source!=null) {
              print(pc,cfml);
              // Before
                Struct params=new StructImpl();
                pc.variablesScope().setEL(FLASH,params);
                params.setEL(PARAMS,parameters);
               
                // Execute
                pc.execute(cfml,true);
               
                // write back response
                writeBackResponse(pc,rsp);
               
                // After
                Object flash=pc.variablesScope().get(FLASH,null);
                if(flash instanceof Struct) {
                  return caster.toAMFObject(((Struct)flash).get(RESULT,null));
                }
                return null;
            }
        }
        finally {
            if(pc!=null)factory.releaseRailoPageContext(pc);
        }
       
        throw new AMFException("can't find cfml ("+cfml+") or cfc ("+cfc+") matching the request");
    }
View Full Code Here

Examples of railo.runtime.CFMLFactory

    @Override
    public void addServletConfig(ServletConfig config) throws ServletException {
      servletConfigs.add(config);
      String real=ReqRspUtil.getRootPath(config.getServletContext());
        if(!initContextes.containsKey(real)) {            
          CFMLFactory jspFactory = loadJSPFactory(getConfigServerImpl(),config,initContextes.size());
            initContextes.put(real,jspFactory);
        }       
    }
View Full Code Here

Examples of railo.runtime.CFMLFactory

    }
   
    @Override
    public void serviceCFML(HttpServlet servlet, HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException {
     
      CFMLFactory factory=getCFMLFactory(servlet.getServletContext(), servlet.getServletConfig(), req);
     
        PageContext pc = factory.getRailoPageContext(servlet,req,rsp,null,false,-1,false);
        ThreadQueue queue = factory.getConfig().getThreadQueue();
        queue.enter(pc);
        try {
          /*print.out("INCLUDE");
          print.out("servlet_path:"+req.getAttribute("javax.servlet.include.servlet_path"));
          print.out("request_uri:"+req.getAttribute("javax.servlet.include.request_uri"));
          print.out("context_path:"+req.getAttribute("javax.servlet.include.context_path"));
          print.out("path_info:"+req.getAttribute("javax.servlet.include.path_info"));
          print.out("query_string:"+req.getAttribute("javax.servlet.include.query_string"));
          print.out("FORWARD");
          print.out("servlet_path:"+req.getAttribute("javax.servlet.forward.servlet_path"));
          print.out("request_uri:"+req.getAttribute("javax.servlet.forward.request_uri"));
          print.out("context_path:"+req.getAttribute("javax.servlet.forward.context_path"));
          print.out("path_info:"+req.getAttribute("javax.servlet.forward.path_info"));
          print.out("query_string:"+req.getAttribute("javax.servlet.forward.query_string"));
          print.out("---");
          print.out(req.getServletPath());
          print.out(pc.getHttpServletRequest().getServletPath());
          */
         
          pc.execute(pc.getHttpServletRequest().getServletPath(),false);
        }
        catch (PageException pe) {
      throw new PageServletException(pe);
    }
        finally {
          queue.exit(pc);
            factory.releaseRailoPageContext(pc);
            FDControllerFactory.notifyPageComplete();
        }
    }
View Full Code Here

Examples of railo.runtime.CFMLFactory

        }
    }

  public void serviceFile(HttpServlet servlet, HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException {
    req=new HTTPServletRequestWrap(req);
    CFMLFactory factory=getCFMLFactory(servlet.getServletContext(), servlet.getServletConfig(), req);
        ConfigWeb config = factory.getConfig();
        PageSource ps = config.getPageSourceExisting(null, null, req.getServletPath(), false, true, true, false);
        //Resource res = ((ConfigWebImpl)config).getPhysicalResourceExistingX(null, null, req.getServletPath(), false, true, true);
       
    if(ps==null) {
        rsp.sendError(404);
View Full Code Here

Examples of railo.runtime.CFMLFactory

  }
 

  public void serviceRest(HttpServlet servlet, HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException {
    req=new HTTPServletRequestWrap(req);
    CFMLFactory factory=getCFMLFactory(servlet.getServletContext(), servlet.getServletConfig(), req);
       
    PageContext pc = factory.getRailoPageContext(servlet,req,rsp,null,false,-1,false);
        ThreadQueue queue = factory.getConfig().getThreadQueue();
        queue.enter(pc);
        try {
          pc.executeRest(pc.getHttpServletRequest().getServletPath(),false);
        }
        catch (PageException pe) {
      throw new PageServletException(pe);
    }
        finally {
          queue.exit(pc);
            factory.releaseRailoPageContext(pc);
            FDControllerFactory.notifyPageComplete();
        }
   
   
  }
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.