星期二, 三月 16, 2004

[JBoss-user] Virtual Directory creation for Jboss

[JBoss-user] Virtual Directory creation for Jboss

You can add one or more external contexts to wars deployed to
a host by adding a Context element to the corresponding Host
by editing the jbossweb-tomcat41.sar/META-INF/jboss-service.xml
descriptor:

<server >

<mbean code= "org.jboss.web.tomcat.tc4.EmbeddedTomcatService "
name= "jboss.web:service=WebServer " >

<attribute name= "Java2ClassLoadingCompliance " >true </attribute >
<attribute name= "LenientEjbLink " >true </attribute >
<attribute name= "UseJBossWebLoader " >true </attribute >
<attribute name= "SubjectAttributeName " >j_subject </attribute >

<attribute name= "Config " >
<Server >
<Service name= "JBoss-Tomcat " >
<Engine name= "MainEngine " defaultHost= "localhost " >
<Logger className= "org.jboss.web.tomcat.Log4jLogger "
verbosityLevel= "debug "
category= "org.jboss.web.localhost.Engine "/ >
<Host name= "localhost " >
...

<Context path= "/images " docBase= "C:/tmp/images " debug= "1 "
reloadable= "true " crossContext= "true " / >
...

With this you can reference the /images path from any war deployed
to the Host. For example, a test-ex.war index.html page accessible
at http://localhost/test-ex/index.html that includes images from
the external context:

test-ex.war/index.html
<html >

<body >
<h1 >External Images </h1 >
<ul >
<li > <img src= "/images/img1.jpg " alt= "Image1 " > </li >
<li > <img src= "/images/img1.jpg " alt= "Image2 " > </li >
<li > <img src= "/images/img1.jpg " alt= "Image3 " > </li >
</ul >
</body >

</html >