Package org.apache.beehive.netui.pageflow

Examples of org.apache.beehive.netui.pageflow.ServletContainerAdapter


        //
        HashMap failoverAttrs = getFailoverAttributesMap( request, false, true );
       
        if ( failoverAttrs != null )
        {
            ServletContainerAdapter sa = AdapterManager.getServletContainerAdapter( getServletContext() );
           
            for ( Iterator i = failoverAttrs.entrySet().iterator(); i.hasNext(); )
            {
                Map.Entry entry = ( Map.Entry ) i.next();
                sa.ensureFailover( ( String ) entry.getKey(), entry.getValue(), request );
            }
        }
    }
View Full Code Here


    private static final String SERVLET_CONTAINER_ADAPTER_ATTR = InternalConstants.ATTR_PREFIX + "servletAdapter";
    private static final String SERVLET_CONTAINER_ADAPTER_PROP = "beehive.servletcontaineradapter";

    public static ServletContainerAdapter getServletContainerAdapter( ServletContext servletContext )
    {
        ServletContainerAdapter adapter =
                ( ServletContainerAdapter ) servletContext.getAttribute( SERVLET_CONTAINER_ADAPTER_ATTR );
       
        if ( adapter == null )
        {
            if ( _log.isErrorEnabled() )
View Full Code Here

        return adapter;
    }
   
    public static ServletContainerAdapter initServletContext( ServletContext servletContext )
    {
        ServletContainerAdapter servletContainerAdapter = createServletContainerAdapter( servletContext );
        servletContext.setAttribute( SERVLET_CONTAINER_ADAPTER_ATTR, servletContainerAdapter );
        return servletContainerAdapter;
    }
View Full Code Here

            Class adapterClass =
                    DiscoveryUtils.loadImplementorClass( adapterClassName, ServletContainerAdapter.class );

            if ( adapterClass != null )
            {
                ServletContainerAdapter sa =
                        ( ServletContainerAdapter ) tryAdapter( adapterClass, servletContext );
                if ( sa != null ) return sa;
            }
        }

        /*
        ClassLoaders loaders = ClassLoaders.getAppLoaders( ServletContainerAdapter.class, AdapterManager.class, true );
        DiscoverServiceNames dsn = new DiscoverServiceNames( loaders );
        ResourceNameIterator i = dsn.findResourceNames( ServletContainerAdapter.class.getName() );
       
        while ( i.hasNext() )
        {
            Class adapterClass = loadClass( loaders, i.nextResourceName(), ServletContainerAdapter.class );
           
            if ( adapterClass != null )
            {
                ServletContainerAdapter sa =
                        ( ServletContainerAdapter ) tryAdapter( adapterClass, servletContext );
                if ( sa != null ) return sa;
            }
        }
       
        */
       
        Class[] classes = DiscoveryUtils.getImplementorClasses( ServletContainerAdapter.class );
       
        for ( int i = 0; i < classes.length; i++ )
        {
            ServletContainerAdapter sa = ( ServletContainerAdapter ) tryAdapter( classes[i], servletContext );
            if ( sa != null ) return sa;
        }
       
        _log.info( "No ServletContainerAdapter specified or discovered; using " + DefaultServletContainerAdapter.class );
        ServletContainerAdapter sa =
                new DefaultServletContainerAdapter()
                {
                    public boolean accept( AdapterContext context )
                    {
                        return true;
                    }
                };
        sa.setContext( new AdapterContext( servletContext ) );
        return sa;
    }
View Full Code Here

            reportErrors();
            return;
        }

        PageContext pageContext = getPageContext();
        ServletContainerAdapter sa = AdapterManager.getServletContainerAdapter(pageContext.getServletContext());
        ServletRequest request = pageContext.getRequest();
        assert(sa != null);

        // check to see if we are supposed to report the error
        boolean prodMode = sa.isInProductionMode();
        if (prodMode && !_alwaysReport)
            return;

        LinkedHashMap map = (LinkedHashMap)
                InternalUtils.getBindingUpdateErrors(request);
View Full Code Here

    }

    public void rewriteURL( ServletContext servletContext, ServletRequest request,
                            ServletResponse response, MutableURI url, URLType type, boolean needsToBeSecure )
    {
        ServletContainerAdapter servletContainerAdapter = AdapterManager.getServletContainerAdapter( servletContext );

        // If url is not absolute, then do default secure/unsecure rewriting
        if ( !url.isAbsolute() )
        {
            if ( needsToBeSecure )
            {
                if ( !request.isSecure() )
                {
                    int securePort = servletContainerAdapter.getSecureListenPort( (HttpServletRequest) request );

                    if (securePort != -1)
                    {
                        internalRewriteUrl( url, "https", securePort, request.getServerName() );
                    }
                    else
                    {
                        if (_log.isWarnEnabled())
                        {
                            _log.warn("Could not rewrite URL " + url.getURIString( null ) + " to be secure because" +
                                      " a secure port was not provided by the ServletContainerAdapter.");
                        }
                    }
                }
            }
            else
            {
                if ( request.isSecure() )
                {
                    int listenPort = servletContainerAdapter.getListenPort((HttpServletRequest) request);

                    if (listenPort != -1 )
                    {
                        internalRewriteUrl( url, "http", listenPort, request.getServerName() );
                    }
View Full Code Here

       
        // This feature is disabled for now.
        if ( false )
        {
            ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
            ServletContainerAdapter servletContainerAdapter = AdapterManager.getServletContainerAdapter( servletContext );
            File[] classDirs = null;
           
            // TODO: make this configurable in netui-config.xml.  You should be able to specify absolute files
            // and also context-relative paths.
            {
                String path = servletContext.getRealPath( "/WEB-INF/classes" );
               
                if ( path != null )
                {
                    File file = new File( path );
                    if ( file.isDirectory() ) classDirs = new File[]{ file };
                }
            }
           
            if ( classDirs != null && ! servletContainerAdapter.isInProductionMode() )
            {
                _pageFlowClassLoader = new BouncyClassLoader( classDirs, contextClassLoader );
            }
        }
    }
View Full Code Here

        }
    }

    private void createClassLoader(ServletContext servletContext)
    {
        ServletContainerAdapter servletContainerAdapter = AdapterManager.getServletContainerAdapter( servletContext );
       
        if (servletContainerAdapter.isInProductionMode()) {
            _log.info("In production mode; reloadable classes disabled.");
            return;
        }
       
        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
View Full Code Here

        //
        HashMap failoverAttrs = getFailoverAttributesMap( request, false, true );

        if ( failoverAttrs != null )
        {
            ServletContainerAdapter sa = AdapterManager.getServletContainerAdapter( getServletContext() );

            for ( Iterator i = failoverAttrs.entrySet().iterator(); i.hasNext(); )
            {
                Map.Entry entry = ( Map.Entry ) i.next();
                if (_log.isTraceEnabled()) {
                    _log.trace("Ensure failover for attribute " + entry.getKey());
                }
                sa.ensureFailover( ( String ) entry.getKey(), entry.getValue(), request );
            }
        }
    }
View Full Code Here

    }

    public void rewriteURL( ServletContext servletContext, ServletRequest request,
                            ServletResponse response, MutableURI url, URLType type, boolean needsToBeSecure )
    {
        ServletContainerAdapter servletContainerAdapter = AdapterManager.getServletContainerAdapter( servletContext );

        // If url is not absolute, then do default secure/unsecure rewriting
        if ( !url.isAbsolute() )
        {
            if ( needsToBeSecure )
            {
                if ( !request.isSecure() )
                {
                    int securePort = servletContainerAdapter.getSecureListenPort( (HttpServletRequest) request );

                    if (securePort != -1)
                    {
                        internalRewriteUrl( url, "https", securePort, request.getServerName() );
                    }
                    else
                    {
                        if (_log.isWarnEnabled())
                        {
                            _log.warn("Could not rewrite URL " + url.getURIString( null ) + " to be secure because" +
                                      " a secure port was not provided by the ServletContainerAdapter.");
                        }
                    }
                }
            }
            else
            {
                if ( request.isSecure() )
                {
                    int listenPort = servletContainerAdapter.getListenPort((HttpServletRequest) request);

                    if (listenPort != -1 )
                    {
                        internalRewriteUrl( url, "http", listenPort, request.getServerName() );
                    }
View Full Code Here

TOP

Related Classes of org.apache.beehive.netui.pageflow.ServletContainerAdapter

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.