Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.sonatype.sisu.jetty.mangler;
 
Abstract base class for manglers working with contexts.

Author(s):
cstamas
public abstract class AbstractContextMangler
    private final String contextPath;
    protected AbstractContextManglerfinal String contextPath )
    {
        this. = contextPath;
    }
    protected ContextHandler getContextfinal Server server )
    {
        Handler[] handlers = server.getHandlers();
        if ( handlers == null )
        {
            handlers = new Handler[] { server.getHandler() };
        }
        return getContextHandlerOnPathhandlers );
    }
    // ==
    protected ContextHandler getContextHandlerOnPathfinal String contextPathfinal Handler[] handlers )
    {
        for ( int i = 0; i < handlers.lengthi++ )
        {
            if ( handlers[iinstanceof ContextHandler )
            {
                ContextHandler ctx = (ContextHandlerhandlers[i];
                if ( contextPath.equalsctx.getContextPath() ) )
                {
                    return ctx;
                }
            }
            else if ( handlers[iinstanceof HandlerCollection )
            {
                Handler[] handlerList = ( (HandlerCollectionhandlers[i] ).getHandlers();
                return getContextHandlerOnPathcontextPathhandlerList );
            }
        }
        return null;
    }
New to GrepCode? Check out our FAQ X