Package org.apache.catalina

Examples of org.apache.catalina.Host


     * Adjust docBase.
     */
    protected void fixDocBase()
        throws IOException {

        Host host = (Host) context.getParent();
        File appBase = host.getAppBaseFile();

        String docBase = context.getDocBase();
        if (docBase == null) {
            // Trying to guess the docBase according to the path
            String path = context.getPath();
View Full Code Here


    protected void antiLocking() {

        if ((context instanceof StandardContext)
            && ((StandardContext) context).getAntiResourceLocking()) {

            Host host = (Host) context.getParent();
            String docBase = context.getDocBase();
            if (docBase == null) {
                return;
            }
            originalDocBase = docBase;

            File docBaseFile = new File(docBase);
            if (!docBaseFile.isAbsolute()) {
                docBaseFile = new File(host.getAppBaseFile(), docBase);
            }

            String path = context.getPath();
            if (path == null) {
                return;
View Full Code Here


    private WebXml getDefaultWebXmlFragment() {

        // Host should never be null
        Host host = (Host) context.getParent();

        DefaultWebXmlCacheEntry entry = hostWebXmlCache.get(host);

        InputSource globalWebXml = getGlobalWebXmlSource();
        InputSource hostWebXml = getHostWebXmlSource();

        long globalTimeStamp = 0;
        long hostTimeStamp = 0;

        if (globalWebXml != null) {
            try {
                URL url = new URL(globalWebXml.getSystemId());
                globalTimeStamp = url.openConnection().getLastModified();
            } catch (MalformedURLException e) {
                globalTimeStamp = -1;
            } catch (IOException e) {
                globalTimeStamp = -1;
            }
        }

        if (hostWebXml != null) {
            try {
                URL url = new URL(hostWebXml.getSystemId());
                hostTimeStamp = url.openConnection().getLastModified();
            } catch (MalformedURLException e) {
                hostTimeStamp = -1;
            } catch (IOException e) {
                hostTimeStamp = -1;
            }
        }

        if (entry != null && entry.getGlobalTimeStamp() == globalTimeStamp &&
                entry.getHostTimeStamp() == hostTimeStamp) {
            return entry.getWebXml();
        }

        // Parsing global web.xml is relatively expensive. Use a sync block to
        // make sure it only happens once. Use the pipeline since a lock will
        // already be held on the host by another thread
        synchronized (host.getPipeline()) {
            entry = hostWebXmlCache.get(host);
            if (entry != null && entry.getGlobalTimeStamp() == globalTimeStamp &&
                    entry.getHostTimeStamp() == hostTimeStamp) {
                return entry.getWebXml();
            }
View Full Code Here

        if ((uri == null) || (!uri.startsWith("/")))
            return (null);

        Context child = null;
        try {
            Host host = (Host) context.getParent();
            String mapuri = uri;
            while (true) {
                child = (Context) host.findChild(mapuri);
                if (child != null)
                    break;
                int slash = mapuri.lastIndexOf('/');
                if (slash < 0)
                    break;
View Full Code Here

            // has been deployed
            if (request.getContext() == null) {
                res.setStatus(404);
                res.setMessage("Not found");
                // No context, so use host
                Host host = request.getHost();
                // Make sure there is a host (might not be during shutdown)
                if (host != null) {
                    host.logAccess(request, response, 0, true);
                }
                return false;
            }

            // Now we have the context, we can parse the session ID from the URL
View Full Code Here

            engine.setCluster((Cluster)clusterGBean.getInternalObject());
        }
    }

    private void removeHost(ObjectRetriever objRetriever) {
        Host host = (Host)objRetriever.getInternalObject();
        engine.removeChild(host);
    }
View Full Code Here

        Host host = (Host)objRetriever.getInternalObject();
        engine.removeChild(host);
    }

    private void addHost(ObjectRetriever objRetriever) {
        Host host = (Host)objRetriever.getInternalObject();

        //If we didn't set a realm, then use the default
        if (host.getRealm() == null) {
            host.setRealm(engine.getRealm());
        }
        engine.addChild(host);
    }
View Full Code Here

    throws IOException {
        synchronized (connection.getConnector()) {

        Container container=connection.getConnector().getContainer();

        Host host=(Host)container.findChild(hostName);
        if (host==null) {
            WarpHost whost=new WarpHost();
            whost.setName(hostName);
            whost.setParent(container);
            whost.setAppBase(connection.getConnector().getAppBase());
            whost.setDebug(connection.getConnector().getDebug());
            container.addChild(whost);
            host=whost;
            if (Constants.DEBUG)
                logger.debug("Created new host "+host.getName());
        } else if (Constants.DEBUG) {
            logger.debug("Reusing instance of Host \""+host.getName()+"\"");
        }

        // TODO: Set up mapping mechanism for performance

        if (applPath.endsWith("/"))
            applPath=applPath.substring(0,applPath.length()-1);

        Context appl=(Context)host.findChild(applPath);

        if (appl==null) {

            if (Constants.DEBUG)
                logger.debug("No application for \""+applPath+"\"");

            Deployer deployer=(Deployer)host;
            File file=new File(host.getAppBase()+File.separator+applName);
            if (!file.isAbsolute()) {
                file=new File(System.getProperty("catalina.base"),
                              host.getAppBase()+File.separator+applName);
            }

            if (!file.exists()) {
                logger.log("Cannot find \""+file.getPath()+"\" for appl. \""+
                           applName+"\" host \""+host.getName()+"\"");
                return(null);
            }

            String path=file.getCanonicalPath();
            URL url=new URL("file",null,path);
View Full Code Here

            engine.setCluster((Cluster)clusterGBean.getInternalObject());
        }
    }

    private void removeHost(ObjectRetriever objRetriever) {
        Host host = (Host)objRetriever.getInternalObject();
        engine.removeChild(host);
    }
View Full Code Here

        Host host = (Host)objRetriever.getInternalObject();
        engine.removeChild(host);
    }

    private void addHost(ObjectRetriever objRetriever) {
        Host host = (Host)objRetriever.getInternalObject();

        //If we didn't set a realm, then use the default
        if (host.getRealm() == null) {
            host.setRealm(engine.getRealm());
        }
        engine.addChild(host);
    }
View Full Code Here

TOP

Related Classes of org.apache.catalina.Host

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.