⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch13s16.html

📁 详细介绍了jboss3.0的配置等
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   <title>How to Integrate a Web Container into JBoss</title><link rel="stylesheet" href="styles.css" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/styles.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets Vimages/callouts/"><link rel="home" href="index.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/index.html" title="JBoss 3.0 Documentation"><link rel="up" href="ch13.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13.html" title="Chapter 13. HOWTO"><link rel="previous" href="ch13.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13.html" title="Chapter 13. HOWTO"><link rel="next" href="ch13s21.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s21.html" title="How to use Applets to access EJBs in JBoss"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table border="0" cellpadding="0" cellspacing="0" height="65"><tr height="65"><td rowspan="2"><img src="jboss.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/jboss.gif" border="0"></td><td rowspan="2" background="gbar.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/gbar.gif" width="100%" align="right" valign="top"><a href="index.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/index.html"><img src="doc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/doc.gif" border="0"></a><a href="ch13.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13.html"><img src="toc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/toc.gif" border="0"></a><a href="ch13.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13.html"><img src="prev.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/prev.gif" border="0"></a><a href="ch13s21.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s21.html"><img src="next.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/next.gif" border="0"></a></td></tr><tr></tr></table><div class="section"><a name="howto.webcontainer"></a><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="howto.webcontainer"></a>How to Integrate a Web Container into JBoss</h2></div></div><p>Author:<span class="author">Scott Stark</span> 
		<tt>&lt;<a href="mailto:Scott_Stark@displayscape.com">Scott_Stark@displayscape.com</a>&gt;</tt>
	</p><div class="section"><a name="d0e9320"></a><div class="titlepage"><div><h3 class="title"><a name="d0e9320"></a>Introduction</h3></div></div><p>This HowTo describes the steps for integrating a third party web container into the JBoss application server framework. A web container is a J2EE server component that enables access to servlets and JSP pages. Example servlet containers include Tomcat and Jetty. Integrating a servlet container into JBoss consists of mapping web-app.xml JNDI information into the JBoss JNDI namespace using an optional jboss-web.xml descriptor as well as delegating authentication and authorization to the JBoss security layer. These tasks are simplified by the org.jboss.web.AbstractWebContainer class. The remainder of this HowTo describes howto integrate a web container using the AbstractWebContainer class.</p></div><div class="section"><a name="d0e9325"></a><div class="titlepage"><div><h3 class="title"><a name="d0e9325"></a>AbstractWebContainer Overview</h3></div></div><p>The org.jboss.web.AbstractWebContainer class is an implementation of a template pattern for web container integration into JBoss. This class should be subclassed by web container providers wishing to integrate their container into a JBoss server. AbstractWebContainer provides support for parsing the standard J2EE web-app.xml web application deployment descriptor JNDI and security elements as well as support for parsing the JBoss specific jboss-web.xml descriptor. The AbstractWebContainer is an abstract class that implements the AbstractWebContainerMBean JMX mbean interface used by the JBoss deployer when war files need to be deployed. <a href="ch13s16.html#howto.webcontainer.AbstractWebContainer" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s16.html#howto.webcontainer.AbstractWebContainer" title="Figure 13.1. Key AbstractWebContainer Class Methods">Figure 13.1</a> presents some of the key AbstractWebContainer methods.</p><div class="figure"><p><a name="howto.webcontainer.AbstractWebContainer"></a><b>Figure 13.1. Key AbstractWebContainer Class Methods</b></p><pre class="programlisting">
package org.jboss.web;
...

public abstract class AbstractWebContainer extends ServiceMBeanSupport implements AbstractWebContainerMBean
{
<a name="howto.webcontainer.deploy"></a><img src="1.png" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/1.png" alt="1" border="0">
    public synchronized void deploy(String ctxPath, String warUrl) throws DeploymentException
    {
            WebApplication warInfo = performDeploy(ctxPath, warUrl);
            ClassLoader loader = warInfo.getClassLoader();
            Element webApp = warInfo.getWebApp();
            Element jbossWeb = warInfo.getJbossWeb();
            parseWebAppDescriptors(loader, webApp, jbossWeb);
            deploymentMap.put(warUrl, warInfo);
    }
<a name="howto.webcontainer.performDeploy"></a><img src="2.png" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/2.png" alt="2" border="0">
    protected abstract WebApplication performDeploy(String ctxPath, String warUrl) throws Exception;

<a name="howto.webcontainer.undeploy"></a><img src="3.png" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/3.png" alt="3" border="0">
    public synchronized void undeploy(String warUrl) throws DeploymentException
    {
            performUndeploy(warUrl);
            // Remove the web application ENC...
            deploymentMap.remove(warUrl);
    }
<a name="howto.webcontainer.performUndeploy"></a><img src="4.png" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/4.png" alt="4" border="0">
    protected abstract void performUndeploy(String warUrl) throws Exception;

    public boolean isDeployed(String warUrl)
    {
        return deploymentMap.containsKey(warUrl);
    }

    public WebApplication getDeployedApp(String warUrl)
    {
        WebApplication appInfo = (WebApplication) deploymentMap.get(warUrl);
        return appInfo;
    }

<a name="howto.webcontainer.parseWebAppDescriptors"></a><img src="5.png" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/5.png" alt="5" border="0">
    private void parseWebAppDescriptors(ClassLoader loader, Element webApp, Element jbossWeb) throws Exception
    {
        WebMetaData metaData = new WebMetaData();
        metaData.importXml(webApp);
        if( jbossWeb != null )
            metaData.importXml(jbossWeb);
        ...
        addEnvEntries(envEntries, envCtx);
        Iterator resourceRefs = metaData.getResourceReferences();
        linkResourceRefs(resourceRefs, envCtx);
        Iterator ejbRefs = metaData.getEjbReferences();
        linkEjbRefs(ejbRefs, envCtx);
        String securityDomain = metaData.getSecurityDomain();
        linkSecurityDomain(securityDomain, envCtx);
    }

<a name="howto.webcontainer.addEnvEntries"></a><img src="6.png" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/6.png" alt="6" border="0">
    protected void addEnvEntries(Iterator envEntries, Context envCtx)
        throws ClassNotFoundException, NamingException
    {
        ...
    }

<a name="howto.webcontainer.linkResourceRefs"></a><img src="7.png" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/7.png" alt="7" border="0">
    protected void linkResourceRefs(Iterator resourceRefs, Context envCtx)
        throws NamingException
    {
        ...
    }

<a name="howto.webcontainer.linkEjbRefs"></a><img src="8.png" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/8.png" alt="8" border="0">
    protected void linkEjbRefs(Iterator ejbRefs, Context envCtx)
        throws NamingException
    {
        ...
    }

<a name="howto.webcontainer.linkSecurityDomain"></a><img src="9.png" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/9.png" alt="9" border="0">
    protected void linkSecurityDomain(String securityDomain, Context envCtx)
        throws NamingException
    {
        ...
    }

}

</pre><pre class="programlisting">public class WebApplication
{
    /** Class loader of this application */
    ClassLoader classLoader = null;
    /** name of this application */
    String name = "";
    /** URL where this application was deployed from */
    URL url;
    /** The root element of thw web-app.xml descriptor. */
    Element webApp;
    /** The root element of thw jboss-web.xml descriptor. */
    Element jbossWeb;
    /** Arbitary data object for storing application specific data */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -