Package org.apache.tomcat.core

Examples of org.apache.tomcat.core.ContextManager


    }

    public void contextInit(Context ctx)
        throws TomcatException
    {
        ContextManager cm=ctx.getContextManager();
        if( cm.getState() >= ContextManager.STATE_INIT ) {
            // a context has been added after the server was started.
            // regenerate the config ( XXX send a restart signal to
            // the server )
            // Generate the config only if "regenerate" property is
            // set on the module or if an explicit "jkconf" option has
            // been set on context manager.
            if( regenerate ||
                cm.getProperty("jkconf") !=null) {
                    execute( cm );
            }
        }
    }
View Full Code Here


                    String name=attributes.getValue("name");
                    String value=attributes.getValue("value");
                    if( name==null || value==null ) return;
                    XmlMapper xm=ctx.getMapper();

                    ContextManager cm1=(ContextManager)ctx.currentObject();
                    // replace ${foo} in value
                    value=xm.replaceProperties( value );
                    if( cm1.getDebug() > 0 )
                        cm1.log("Setting " + name + "=" + value);
                    cm1.setProperty( name, value );
                }
            });

        // for backward compatibility, keep old version
  xh.addRule( "ContextManager/property", new XmlAction() {
    public void start(SaxContext ctx ) throws Exception {
        AttributeList attributes = ctx.getCurrentAttributes();
        String name=attributes.getValue("name");
        String value=attributes.getValue("value");
        if( name==null || value==null ) return;
        XmlMapper xm=ctx.getMapper();
       
        ContextManager cm1=(ContextManager)ctx.currentObject();
        // replace ${foo} in value
        value=xm.replaceProperties( value );
        if( cm1.getDebug() > 0 )
      cm1.log("Setting " + name + "=" + value);
        cm1.setProperty( name, value );
    }
      });
    }
View Full Code Here

        Object elem=ctx.currentObject();
        AttributeList attributes = ctx.getCurrentAttributes();
        String name=attributes.getValue("name");
        String classN=attributes.getValue("javaClass");
        if( name==null || classN==null ) return;
        ContextManager cm=(ContextManager)ctx.currentObject();
        Hashtable modules=(Hashtable)cm.getNote("modules");
        modules.put( name, classN );
        addTagRule( ctx.getMapper(), name, classN );
        if( ctx.getDebug() > 0 ) ctx.log("Adding " + name + " " + classN );
    }
      });
View Full Code Here

  ctx.setWorkDir( workDirF );
    }
   
    private void initStandaloneWorkDir( Context ctx ) {
  ContextManager cm=ctx.getContextManager();
  String base=workdirBase;
  // getWorkDir will be deprecated!
  if( base==null )
      base=cm.getWorkDir();

  File workDirF=null;

  StringBuffer sb=new StringBuffer();
  sb.append(cm.getWorkDir());
  sb.append(File.separator);
  String host=ctx.getHost();
  if( host==null )
      sb.append( "DEFAULT" );
  else
View Full Code Here

    // -------------------- Hooks --------------------

    public void contextInit(Context ctx)
  throws TomcatException
    {
  ContextManager cm=ctx.getContextManager();
  if( memoryRealm==null) {
      memoryRealm = new MemoryRealm(filename,
            cm.getHome());
      try {
    memoryRealm.readMemoryRealm();
      } catch(Exception ex ) {
    log("Error loading realm file " + cm.getHome() + "/"  +
        filename, ex);
    memoryRealm=null;
      }
  }
    }
View Full Code Here

            if( ! secret.equals( stopMsg ) ) {
          req.getContextManager().log("Attempt to stop with the wrong secret");
          return;
            }
        }
                                ContextManager cm=req.getContextManager();
        cm.shutdown();
        cm.log("Exiting" );
        // same behavior as in past, because it seems
        // that stopping everything doesn't work -
        // need to figure
        // out what happens with the threads ( XXX )
                                // until we remove the System.exit() call we
View Full Code Here

     *  JspInterceptor can add all taglib descriptors.
     */
    public void contextInit( Context context)
  throws TomcatException
    {
        ContextManager cm = context.getContextManager();
  DependManager dm=(DependManager)context.getContainer().
      getNote("DependManager");

  File inf_xml = new File(context.getAbsolutePath() +
        "/WEB-INF/web.xml");
View Full Code Here

  if( debug> 0 )
      log( "Detected changes in " + ctx.toString());

  try {
      // Reload context. 
      ContextManager cm=ctx.getContextManager();
     
      if( fullReload ) {
    synchronized(ctx) {
        if(ctx.getState() == Context.STATE_NEW)
      return 0; // Already reloaded.
        Vector sI=new Vector()// saved local interceptors
        BaseInterceptor[] eI;    // all exisiting interceptors

        // save the ones with the same context, they are local
        eI=ctx.getContainer().getInterceptors();
        for(int i=0; i < eI.length ; i++)
      if(ctx == eI[i].getContext()) sI.addElement(eI[i]);
       
        Enumeration e;
        // Need to find all the "config" that
        // was read from server.xml.
        // So far we work as if the admin interface was
        // used to remove/add the context.
        // Or like the deploytool in J2EE.
        Context ctx1=cm.createContext();
        ctx1.setContextManager( cm );
        ctx1.setPath(ctx.getPath());
        ctx1.setDocBase(ctx.getDocBase());
        ctx1.setReloadable( ctx.getReloadable());
        ctx1.setDebug( ctx.getDebug());
        ctx1.setHost( ctx.getHost());
        ctx1.setTrusted( ctx.isTrusted());
        e=ctx.getHostAliases();
        while( e.hasMoreElements())
      ctx1.addHostAlias( (String)e.nextElement());

        BaseInterceptor ri[] =
      cm.getContainer().getInterceptors(Container.H_copyContext);
        int i;
        for( i=0; i < ri.length; i++) {
      ri[i].copyContext(request, ctx, ctx1);
        }
        cm.removeContext( ctx );
       
        cm.addContext( ctx1 );

        // put back saved local interceptors
        e=sI.elements();
        while(e.hasMoreElements()){
      BaseInterceptor savedI=(BaseInterceptor)e.nextElement();
     
      ctx1.addInterceptor(savedI);
      savedI.setContext(ctx1);
      savedI.reload(request,ctx1);
        }

        ctx1.init();

        // remap the request
        request.setAttribute("tomcat.ReloadInterceptor", this);
        ri = cm.getContainer().getInterceptors(Container.H_contextMap);
       
        for( i=0; i< ri.length; i++ ) {
      if( ri[i]==this ) break;
      int status=ri[i].contextMap( request );
      if( status!=0 ) return status;
View Full Code Here

    }

    public void contextInit(Context ctx)
  throws TomcatException
    {
  ContextManager cm=ctx.getContextManager();
  if( cm.getState() >= ContextManager.STATE_INIT ) {
          // a context has been added after the server was started.
          // regenerate the config ( XXX send a restart signal to
          // the server )
          execute( cm );
      }
View Full Code Here

  throws TomcatException
    {
  if( ctx.getHost() == null && ctx.getPath().equals(""))
      rootContext = ctx;

  ContextManager cm=ctx.getContextManager();
  String dI=cm.getProperty( "showDebugInfo" );
  if( dI!=null && ( dI.equalsIgnoreCase("no") ||
        dI.equalsIgnoreCase("false"))) {
      showDebugInfo=false;
  }
View Full Code Here

TOP

Related Classes of org.apache.tomcat.core.ContextManager

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.