Package railo.runtime.listener

Examples of railo.runtime.listener.ApplicationContext


    return components;
  }
 
  private static void loadComponents(PageContext pc, HibernateORMEngine engine,List<Component> components,Resource[] reses,ExtensionResourceFilter filter,ORMConfiguration ormConf) throws PageException {
    Mapping[] mappings = createMappings(pc, reses);
    ApplicationContext ac=pc.getApplicationContext();
    Mapping[] existing = ac.getComponentMappings();
    if(existing==null) existing=new Mapping[0];
    try{
      Mapping[] tmp = new Mapping[existing.length+1];
      for(int i=1;i<tmp.length;i++){
        tmp[i]=existing[i-1];
      }
      ac.setComponentMappings(tmp);
      for(int i=0;i<reses.length;i++){
        if(reses[i]!=null && reses[i].isDirectory()){
          tmp[0] = mappings[i];
          ac.setComponentMappings(tmp);
          loadComponents(pc,engine,mappings[i],components,reses[i], filter,ormConf);
        }
      }
    }
    finally {
      ac.setComponentMappings(existing);
    }
  }
View Full Code Here


 
 

  @Override
  public ORMConfiguration getConfiguration(PageContext pc) {
    ApplicationContext ac = pc.getApplicationContext();
    if(!ac.isORMEnabled())
      return null;
    return  ac.getORMConfiguration();
  }
View Full Code Here

 
 


  private boolean needId() {
    ApplicationContext ac = pageContext.getApplicationContext();
    return ac.isSetClientManagement() || ac.isSetSessionManagement();
  }
View Full Code Here

    touchBeforeRequest(pc);
   
  }
 
  void setTimeSpan(PageContext pc) {
    ApplicationContext ac=pc.getApplicationContext();
    this.timeSpan=getType()==SCOPE_SESSION?
        ac.getSessionTimeout().getMillis():
        ac.getClientTimeout().getMillis();
  }
View Full Code Here

  public void touchAfterRequest(PageContext pc) {
    boolean _isInit=isinit;
    super.touchAfterRequest(pc);
    if(!_isInit) return;
   
    ApplicationContext ac=pc.getApplicationContext();
    TimeSpan timespan=(getType()==SCOPE_CLIENT)?ac.getClientTimeout():ac.getSessionTimeout();
    Cookie cookie = pc.cookieScope();
   
   
    Date exp = new DateTimeImpl(pc,System.currentTimeMillis()+timespan.getMillis(),true);
    try {
View Full Code Here

     
      Tag parent=getParent();
    while(parent!=null && !(parent instanceof Login)) {
      parent=parent.getParent();
    }
    ApplicationContext appContext = pageContext.getApplicationContext();
    if(parent!=null) {
        int loginStorage = appContext.getLoginStorage();
        String name=Login.getApplicationName(appContext);
       
        if(loginStorage==Scope.SCOPE_SESSION && pageContext.getApplicationContext().isSetSessionManagement())
            pageContext.sessionScope().set(KeyImpl.init(name),login.encode());
        else  {//if(loginStorage==Scope.SCOPE_COOKIE)
View Full Code Here

   

    @Override
    public int doStartTag() throws PageException  {
     
      ApplicationContext ac=pageContext.getApplicationContext();
      ac.setSecuritySettings(applicationtoken,cookiedomain,idletimeout);
     
        Credential remoteUser = pageContext.getRemoteUser();
        if(remoteUser==null) {
           
            // Form
View Full Code Here

      return timeSpan;
  }

  @Override
  public void touchBeforeRequest(PageContext pc){
      ApplicationContext appContext = pc.getApplicationContext();
      setEL(APPLICATION_NAME,appContext.getName());
      timeSpan=appContext.getApplicationTimeout().getMillis();
    lastAccess=System.currentTimeMillis();
  }
View Full Code Here

  static String getPassword(PageContext pc,String password) throws SecurityException {
    if(!StringUtil.isEmpty(password, true)) {
      password=password.trim();
    }
    else {
      ApplicationContext ac = pc.getApplicationContext();
      if(ac instanceof ModernApplicationContext) {
        ModernApplicationContext mac=(ModernApplicationContext) ac;
        password = Caster.toString(mac.getCustom(KeyImpl.init("webAdminPassword")),null);
      }
    }
View Full Code Here

  }
 
 
  public Client getClientScope(PageContext pc) throws PageException {
    Client client=null;
    ApplicationContext appContext = pc.getApplicationContext();
    // get Context
      Map<String, Scope> context = getSubMap(cfClientContextes,appContext.getName());
     
    // get Client
      boolean isMemory=false;
      String storage = appContext.getClientstorage();
      if(StringUtil.isEmpty(storage,true)){
        storage=ConfigImpl.DEFAULT_STORAGE_CLIENT;
      }
      else if("ram".equalsIgnoreCase(storage)) {
        storage="memory";
        isMemory=true;
      }
      else if("registry".equalsIgnoreCase(storage)) {
        storage="file";
      }
      else {
        storage=storage.toLowerCase();
        if("memory".equals(storage))isMemory=true;
      }
     
      final boolean doMemory=isMemory || !appContext.getClientCluster();
      client=doMemory?(Client) context.get(pc.getCFID()):null;
      if(client==null || client.isExpired() || !client.getStorage().equalsIgnoreCase(storage)) {
        if("file".equals(storage)){
          client=ClientFile.getInstance(appContext.getName(),pc,getLog());
        }
        else if("cookie".equals(storage))
          client=ClientCookie.getInstance(appContext.getName(),pc,getLog());
        else if("memory".equals(storage)){
          client=ClientMemory.getInstance(pc,getLog());
        }
        else{
          DataSource ds = ((PageContextImpl)pc).getDataSource(storage,null);
          if(ds!=null)client=ClientDatasource.getInstance(storage,pc,getLog());
          else client=ClientCache.getInstance(storage,appContext.getName(),pc,getLog(),null);
         
          if(client==null){
            // datasource not enabled for storage
            if(ds!=null)
              throw new ApplicationException("datasource ["+storage+"] is not enabled to be used as session/client storage, you have to enable it in the railo administrator.");
           
            CacheConnection cc = Util.getCacheConnection(pc.getConfig(),storage,null);
            if(cc!=null)
              throw new ApplicationException("cache ["+storage+"] is not enabled to be used  as a session/client storage, you have to enable it in the railo administrator.");
           
            throw new ApplicationException("there is no cache or datasource with name ["+storage+"] defined.");
          }
         
        }
        client.setStorage(storage);
        if(doMemory)context.put(pc.getCFID(),client);
      }
      else
        getLog().info("scope-context", "use existing client scope for "+appContext.getName()+"/"+pc.getCFID()+" from storage "+storage);
     
      client.touchBeforeRequest(pc);
      return client;
  }
View Full Code Here

TOP

Related Classes of railo.runtime.listener.ApplicationContext

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.