Package railo.runtime

Examples of railo.runtime.PageContext


    this.realPath=realPath;
    this.req=req;
  }

  public void forward(ServletRequest req, ServletResponse rsp)throws ServletException, IOException {
    PageContext pc = ThreadLocalPageContext.get();
    req=HTTPUtil.removeWrap(req);
    if(pc==null){
      this.req.getOriginalRequestDispatcher(realPath).forward(req, rsp);
      return;
    }
View Full Code Here


  }*/
 
 

  public void include(ServletRequest req, ServletResponse rsp)throws ServletException, IOException {
    PageContext pc = ThreadLocalPageContext.get();
    if(pc==null){
      this.req.getOriginalRequestDispatcher(realPath).include(req, rsp);
      return;
    }
    //rsp.getWriter().flush();
View Full Code Here

      name=(String) e.nextElement();
      values=req.getParameterValues(name);
      if(values==null && ReqRspUtil.needEncoding(name, true))
        values=req.getParameterValues(ReqRspUtil.encode(name, ReqRspUtil.getCharacterEncoding(null,req)));
      if(values==null) {
        PageContext pc = ThreadLocalPageContext.get();
        if(pc!=null && ReqRspUtil.identical(pc.getHttpServletRequest(),req) ) {
          values=HTTPServletRequestWrap.getParameterValues(ThreadLocalPageContext.get(), name);
        }
      }
      if(values!=null)for(int i=0;i<values.length;i++){
        parameters.add(new Pair<String,String>(name,values[i]));
View Full Code Here

    super();
  }

  public Closure(UDFProperties properties) {
    super(properties);
    PageContext pc = ThreadLocalPageContext.get();
    if(pc.undefinedScope().getCheckArguments())
      this.variables=new ClosureScope(pc,pc.argumentsScope(),pc.localScope(),pc.variablesScope());
    else{
      this.variables=pc.variablesScope();
      variables.setBind(true);
    }
  }
View Full Code Here

    //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;
            }
View Full Code Here

  @Override
  public ServletInputStream getInputStream() throws IOException {
    //if(ba rr!=null) throw new IllegalStateException();
    if(barr==null) {
      if(!firstRead) {
        PageContext pc = ThreadLocalPageContext.get();
        if(pc!=null) {
          return pc.formScope().getInputStream();
        }
        return new ServletInputStreamDummy(new byte[]{})//throw new IllegalStateException();
      }
     
      firstRead=false;
View Full Code Here

    return new ServletInputStreamDummy(barr)
  }
 
  @Override
  public Map<String,String[]> getParameterMap() {
    PageContext pc = ThreadLocalPageContext.get();
    FormImpl form=_form(pc);
    URLImpl url=_url(pc);
   
    return ScopeUtil.getParameterMap(
        new URLItem[][]{form.getRaw(),url.getRaw()},
View Full Code Here

        return MapAsStruct.toStruct(map, false);
    }
 
  protected Object toCFMLObject(ASObject aso) throws PageException {
    if(!StringUtil.isEmpty(aso.getType())){
      PageContext pc = ThreadLocalPageContext.get();
      ConfigWeb config = pc.getConfig();
     
        String name="/"+aso.getType().replace('.', '/')+".cfc";

        Page p = PageSourceImpl.loadPage(pc, ((PageContextImpl)pc).getPageSources(name), null) ;
View Full Code Here

    t.printStackTrace(pw);
    pw.flush();
  }

  public static void printStackTrace(Throwable t) {
    PageContext pc = ThreadLocalPageContext.get();
    if(pc!=null)printStackTrace(pc,t);
    else t.printStackTrace();
  }
View Full Code Here

    @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 {
View Full Code Here

TOP

Related Classes of railo.runtime.PageContext

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.