Package org.apache.tomcat.core

Examples of org.apache.tomcat.core.Container


      if( cm==null )
    throw new JspException( "Can't find context manager" );

      Context ctx=(Context)pageContext.getAttribute("ctx");

      Container ct=(ctx==null)? cm.getContainer():ctx.getContainer();
      BaseInterceptor bi[]=ct.getInterceptors();
      BaseInterceptor found=null;
      for( int i=0; i<bi.length; i++ ) {
    String cn=bi[i].getClass().getName();
    if( cn.equals( moduleName )) {
        found=bi[i];
View Full Code Here


        }
    }

    public int requestMap(Request req) {
  // If we have an explicit mapper - return
  Container ct=req.getContainer();

  //   log( "Ct: " + ct.getHandler() + " " +
  //        ct.getPath() + " " + ct.getMapType());
 
  ifreq.getHandler()!=null &&
       ct!=null &&
       ct.getMapType() != Container.DEFAULT_MAP )
      return 0;
 
  // default servlet / container
 
  // if doesn't starts with /servlet - return
View Full Code Here

  // XXX we need to better collect all mappings
  addMapping( ctxPath + "/servlet/*", objfile );
     
  Enumeration servletMaps=context.getContainers();
  while( servletMaps.hasMoreElements() ) {
      Container ct=(Container)servletMaps.nextElement();
      addMapping( context, ct , objfile );
  }

        // XXX ErrorDocument
        // Security and filter mappings
View Full Code Here

      break;
  case Container.DEFAULT_MAP:
      // This will be used if no other map match.
      // AVOID USING IT - STATIC FILES SHOULD BE HANDLED BY
      // APACHE ( or tomcat )
      Container defMapC=ct.getContext().getContainer();

      defMapC.setNote( defaultMapNOTE, ct );
      if( debug>0 )
    log("SM: default map " + vhost + ":" +  ctxP +
        path + " -> " + ct + " " );
      break;
  case Container.EXTENSION_MAP:
      // Add it per/defaultContainer - as spec require ( it may also be
      // possible to support type maps per/Container, i.e. /foo/*.jsp -
      // but that would require changes in the spec.
      Context mapCtx=ct.getContext();
      Container defC=mapCtx.getContainer();
     
      SimpleHashtable eM=(SimpleHashtable) defC.getNote( ctExtMapNote );
      if( eM==null ) {
    eM=new SimpleHashtable();
    defC.setNote( ctExtMapNote, eM );
      }
      // add it to the Container local maps
      if( ignoreCase )
    eM.put( path.substring( 1 ).toLowerCase() , ct );
      else
View Full Code Here

      //      host=req.serverName().toString();

      if(debug>0) cm.log("Host = " + hostMB.toString());

      Container container =(Container)map.
    getLongestPrefixMatchhostMB, pathMB);
     
      if( container == null ) {
    // It is too easy to configure Tomcat w/o a default context
    // Add this back in when we do better checking
    //throw new RuntimeException( "Assertion failed: " +
    //          "container==null");
    cm.log("Assertion failed: " +
           "container==null (no Default Context?)");
    return 404;
      }

      if(debug>0)
    cm.log("SM: Prefix match " + pathMB.toString() + " -> " +
           container.getPath() + " " + container.getHandler()  +
           " " + container.getRoles());

      // Once - adjust for prefix and context path
      // If cached - we don't need to do it again ( since it is the
      // final Container,
      // either prefix or extension )
      fixRequestPaths( pathMB.toString() /*XXX*/, req, container );
 

      // if it's default container - try extension match
      //      if (  container.getMapType() == Container.DEFAULT_MAP ) {
      if container.getHandler() == null ) {
    Container extC = matchExtension( req );
 
    if( extC != null ) {
        // change the handler
        if( extC.getHandler() != null ) {
      fixRequestPaths( pathMB.toString(), req, extC );
      container=extC;
        }
        if( debug > 0 )
      log("SM: Found extension mapping " +
          extC.getHandler());
        // change security roles
    }
      }
     
      // Default map - if present
      if( container.getHandler() == null ) {
    Container ctxDef=req.getContext().getContainer();
    Container defC=(Container)ctxDef.getNote( defaultMapNOTE );
    if( defC != null && defC.getHandler() !=null ) {
        fixRequestPaths( pathMB.toString(), req, defC );

        if( debug > 0 )
      log("SM: Found default mapping " +
          defC.getHandler() + " " + defC.getPath() +
           " " + defC.getMapType());
    }
      }

      if(debug>0) log("SM: After mapping " + req + " " +
          req.getHandler());
View Full Code Here

      getContainer().getNote( ctExtMapNote );
  if( extM==null ) return null;

  // Find the container associated with that extension
  if( ignoreCase ) extension=extension.toLowerCase();
  Container container= (Container)extM.get(extension);

  if (container == null)
      return null;

  // This container doesn't change the mappings - it only
  // has "other" properties ( in the current code security
  // constraints
  if( container.getHandler() == null) return container;

  return container;
    }
View Full Code Here

     */
    public void addContainer( Container ct )
  throws TomcatException
    {
  Context ctx=ct.getContext();
  Container ctxCt=ctx.getContainer();
  // XXX add the note only if we have a security constraint
  SecurityConstraints ctxSecurityC=(SecurityConstraints)ctxCt.
      getNote( secMapNote );
  if( ctxSecurityC==null) {
      ctxSecurityC= new SecurityConstraints();
      ctxCt.setNote( secMapNote, ctxSecurityC );
  }

  if( ct.getRoles()!=null || ct.getTransport()!=null ) {
      if( debug > 0 )
    log( "addContainer() " + ctx.getHost() + " " +
View Full Code Here

  String method=req.method().toString();
 
  if( debug > 1 ) log( "checking " + path );

  for( int i=0; i< ctxSec.patterns ; i++ ) {
      Container ct=ctxSec.securityPatterns[i];
      if( match( ct, path, method ) ) {
    req.setSecurityContext( ct );
   
    // Backward compat
    String roles[]=ct.getRoles();
    String methods[]=ct.getMethods();
    String transport=ct.getTransport();
    if( debug>0) {
        StringBuffer sb=new StringBuffer("matched ");
        sb.append(ct.getPath()).append(" ");
        if(methods!=null)
      for( int j=0; j< methods.length; j++ )
          sb.append(methods[j]).append(" ");
        sb.append(transport).append(" ");
        if( roles!=null)
View Full Code Here

 
  // remove all paths starting with path
  Enumeration en=vmap.prefixMappedServlets.keys();
  while( en.hasMoreElements() ) {
      String s=(String)en.nextElement();
      Container ct=(Container)vmap.prefixMappedServlets.get( s );
      if( ct!=null && ct.getContext() == ctx ) {
    if(debug > 0 )
        ctx.log( "Remove mapping " + s );
    vmap.prefixMappedServlets.remove( s );
      }
  }
 
  en=vmap.exactMappedServlets.keys();
  while( en.hasMoreElements() ) {
      String s=(String)en.nextElement();
      Container ct=(Container)vmap.exactMappedServlets.get( s );
      if( ct.getContext() == ctx ) {
    if(debug > 0 )
        ctx.log( "Remove mapping " + s );
    vmap.exactMappedServlets.remove( s );
      }
  }
View Full Code Here

        // XXX we need to better collect all mappings
        addMapping( ctxPath + "/servlet/*", ctxPath, pw );
           
        Enumeration servletMaps=context.getContainers();
        while( servletMaps.hasMoreElements() ) {
            Container ct=(Container)servletMaps.nextElement();
            addMapping( context, ct , pw );
        }
       
        // There is a big problem with this one - it is
        // equivalent with JkMount path/*...
 
View Full Code Here

TOP

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

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.