Package railo.runtime

Examples of railo.runtime.PageSource


        return size;
    }
    private void removeOldest(PageSourcePool[] pools) {
        PageSourcePool pool=null;
        Object key=null;
        PageSource ps=null;
       
        long date=-1;
        for(int i=0;i<pools.length;i++) {
          try {
              Object[] keys=pools[i].keys();
              for(int y=0;y<keys.length;y++) {
                  ps = pools[i].getPageSource(keys[y],false);
                  if(date==-1 || date>ps.getLastAccessTime()) {
                      pool=pools[i];
                      key=keys[y];
                      date=ps.getLastAccessTime();
                  }
              }
          }
          catch(Throwable t) {
            pools[i].clear();
View Full Code Here


      attributesScope.removeEL(KeyConstants._template);
        String template=objTemplate.toString();

            if(StringUtil.startsWith(template,'/'))  {
              PageSource[] sources = ((PageContextImpl)pageContext).getPageSources(template);
              PageSource ps = MappingImpl.isOK(sources);
             
              if(ps==null)
          throw new MissingIncludeException(sources[0],"could not find template ["+template+"], file ["+sources[0].getDisplayPath()+"] doesn't exist");
              source=new InitFile(ps,template,template.endsWith('.'+pageContext.getConfig().getCFCExtension()));
            }
View Full Code Here

    int line=0;
    String template="",tlast;
    Struct item;
    StackTraceElement trace=null;
    int index=-1;
    PageSource ps;
    for(int i=0;i<traces.length;i++) {
      trace=traces[i];
      tlast=template;
      template=trace.getFileName();
      if(trace.getLineNumber()<=0 || template==null || ResourceUtil.getExtension(template,"").equals("java")) continue;
      // content
      if(!StringUtil.emptyIfNull(tlast).equals(template))index++;
     
      String[] content=null;
      try {
       
        Resource res = config.getResource(template);
       
        // never happens i think
        if(!res.exists()) {
          res = ResourceUtil.toResourceNotExisting(ThreadLocalPageContext.get(), template);
        }
        
        if(res.exists()) 
          content=IOUtil.toStringArray(IOUtil.getReader(res,CharsetUtil.toCharset(config.getTemplateCharset())));
        else {
          if(sources.size()>index)ps = sources.get(index);
          else ps=null;
          if(ps!=null && trace.getClassName().equals(ps.getFullClassName())) {
            if(ps.physcalExists())
              content=IOUtil.toStringArray(IOUtil.getReader(ps.getPhyscalFile(), CharsetUtil.toCharset(config.getTemplateCharset())));
            template=ps.getDisplayPath();
          }
        } 
      }
      catch (Throwable th) {
        //th.printStackTrace();
View Full Code Here

  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);
      }
      else {
        Resource res = ps.getResource();
        if(res==null) {
          rsp.sendError(404);
        }
        else {
          ReqRspUtil.setContentLength(rsp,res.length());
View Full Code Here

      String[] filenames=getFileNames(config, name);
      boolean doCache=config.useCTPathCache();
     
     
      boolean doCustomTagDeepSearch = config.doCustomTagDeepSearch();
        PageSource ps=null;
      InitFile initFile;
   
   // CACHE
      // check local
      String localCacheName=null;   
      Mapping[] actms = pc.getApplicationContext().getCustomTagMappings();
      Mapping[] cctms = config.getCustomTagMappings();
       
      if(doCache) {
        if(pc.getConfig().doLocalCustomTag()){
          localCacheName=pc.getCurrentPageSource().getDisplayPath().replace('\\', '/');
          localCacheName="local:"+localCacheName.substring(0,localCacheName.lastIndexOf('/')+1).concat(name);
          initFile=config.getCTInitFile(pc, localCacheName);
          if(initFile!=null) return initFile;
        }
         
        // cache application mapping
          if(actms!=null)for(int i=0;i<actms.length;i++){
            initFile=config.getCTInitFile(pc,"application:"+actms[i].hashCode()+"/"+name);
            if(initFile!=null)return initFile;
          }
         
        // cache config mapping
          if(cctms!=null)for(int i=0;i<cctms.length;i++){
            initFile=config.getCTInitFile(pc,"config:"+cctms[i].hashCode()+"/"+name);
            if(initFile!=null)return initFile;
          }
      }
       
     // SEARCH
        // search local
        if(pc.getConfig().doLocalCustomTag()){
        for(int i=0;i<filenames.length;i++){
              PageSource[] arr = ((PageContextImpl)pc).getRelativePageSources(filenames[i]);
          //ps=pc.getRelativePageSource(filenames[i]);
              ps=MappingImpl.isOK(arr);
        if(ps !=null) {
          initFile= new InitFile(ps,filenames[i],filenames[i].endsWith('.'+config.getCFCExtension()));
          if(doCache)config.putCTInitFile(localCacheName, initFile);
              return initFile;
        }
          }
        }
     
        // search application custom tag mapping
        if(actms!=null){
          for(int i=0;i<filenames.length;i++){
              ps=getMapping(actms, filenames[i],doCustomTagDeepSearch);
              if(ps!=null) {
                initFile=new InitFile(ps,filenames[i],filenames[i].endsWith('.'+config.getCFCExtension()));
                if(doCache)config.putCTInitFile("application:"+ps.getMapping().hashCode()+"/"+name, initFile);
                return initFile;
              }
            }
        }
     
        // search custom tag mappings
        for(int i=0;i<filenames.length;i++){
          ps=getMapping(cctms, filenames[i], doCustomTagDeepSearch);
          if(ps!=null) {
            initFile=new InitFile(ps,filenames[i],filenames[i].endsWith('.'+config.getCFCExtension()));
            if(doCache)config.putCTInitFile("config:"+ps.getMapping().hashCode()+"/"+name, initFile);
            return initFile;
          }
        }
       
        return defaultValue;
View Full Code Here

      }
      return fileNames;
  }
 
   private static PageSource getMapping(Mapping[] ctms, String filename, boolean doCustomTagDeepSearch) {
        PageSource ps;
        for(int i=0;i<ctms.length;i++){
          ps = ((MappingImpl) ctms[i]).getCustomTagPath(filename, doCustomTagDeepSearch);
        if(ps!=null) return ps;
          }
      return null;
View Full Code Here

TOP

Related Classes of railo.runtime.PageSource

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.