Scott has put a lot of work into this document, so I'll try and do a mental
brain dump of all the things left out / wrong.

Don't get me wrong - this is an excellent document with a few corrections
(see below).

If people add their thoughts / experiences to it over the next few days,
I'll put up a summary of all the contributions under one doc on
OrionSupport.

Read on...

-mike

> Subject: Understanding XML files
>
> I'm still learning about this, but here's my attempt at a primer
> to understand how the xml files fit together.
>
> Please feel free to correct any omissions or inaccuracies.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Default-web-site.xml / web-site.xml

These are both just web-site.xml files ( see
http://www.orionserver.com/docs/web-site.xml.html ). Default-web-site.xml is
just the 'default' website set up when Orion is installed , the contents of
it's WAR are at ./default-web-app (read on for more details)

> +++++++++++++++
>
> This represents a website.  Because you may be serving multiple
> web sites on one box (either for multiple IP's, or multiple
> domains - ie. orionsupport.com and opensymphony.com could be on
> the same box), you configure a web-site.xml for each of them.
>
> Inside this file you configure a default-web-app & multiple
> web-apps.  The parameters to these tags are as follows:
>
>       <default-web-app application="default" name="defaultWebApp" />
>       <web-app application="EJBDemo" name="ejbdemo-web" root="/ejbdemo" />
>       <web-app application="taglib-test" name="sitemesh-example"
> root="/sitemesh" />
>
> application:  the application as defined in server.xml (tag in
> server.xml is "application", and the parameter is "name").  ie.
> from above I have an application named EJBDemo in server.xml
>
> name: the web application's name as defined in that particular
> application.  ie.  Inside my application.xml for EJBDemo, there
> is a web-application named "ejbdemo-web".
>
> root:  where you web-app is rooted on the tree.  From the above
> "localhost/ejbdemo/" would correspond with the web-app
> "ejbdemo-web" in application "EJBDemo".

Note you cannot have two web-apps with the same root (and you can only have
one default-web-app - this is fairly obvious I guess). I don't know what
happens if you have directories in one web-app (eg WAR A has /foobar) that
overwrite another web-app's root (eg you bind WAR B to /foobar). My guess is
the second web app would work and the first wouldn't (I don't think this is
documented anywhere, shouldn't be too hard to test though)

> Server.xml
> ++++++++++
>
> There is only one of these per server, so it is the root point
> for all the other files.
>
> Of particular note are the lines:
>       <web-site path="./default-web-site.xml" />

This is setup by default in the install, so as to make the default web site
work. (See above). Feel free to remove this for a production machine.

>        <application name="EJBDemo"
>               path="c:\scott\javadev\ejbdemo\build\ejbdemo.ear" />
>
> These lines show me what websites and what applications I have
> running.  You would only need multiple web-site's if you are
> serving multiple domains.

Or multiple IPs. Or SSL and non SSL sites (possibly same IP/domain but two
<web-site> 's)

> On the other hand, you may have many applications.  If you have
> many web-applications you will need to add them into your
> websites as listed above.
>
> Application.xml
> +++++++++++++++

This is a bit of a misnomer (I've complained to the orion guys about this
file, it's misnamed). It's actually not an application.xml file in the J2EE
sense (the descriptor for an EAR), it's an orion-application.xml file (the
app-server specific deployment descriptor for an EAR) - see the tags inside
it to confirm if you want.

> If you are creating a full-blown application, you are best to
> create a separate one of these for each application.  Inside here
> you define modules.  These can be web modules, ejb modules, or
> java modules.

When creating your own applications, you need to create your own
application.xml. Orion will create the orion-application.xml file for you
and you can tweak it from there.

> If they are web modules, you will want to add them to a website
> in order to view them.

True. If you want to deploy a simple WAR file under Orion (using the
default, factory configuration settings) you add it as a <web-module> to
this file (./config/application.xml) and then add a <web-site> to
./default-web-site.xml and you're set. (This is what Scott say's verbosely
below ;))

> Creating a quick and dirty JSP
> ++++++++++++++++++++++++++++++
(this is actually a quick and dirty web app)

> However - many people have asked about quickly deploying a jsp in
> a default way.  In this case you are probably best to modify the
> file application.xml that resides in /config/ with the other xml files.
>
> Simply add a web module to this file, and then add that
> particular web module to your default-web-site.xml
>
> eg. You want to create a web-app called "jsp-test" that will be
> show at "localhost/jsp-test/"
>
> + Create the directory "jsp-test" under orion - ie "orion/jsp-test"

nono don't do this - fugly!

If you do this your Orion directory will get very full very quickly.

I recommend either creating a new directory all together (eg I use
/opt/j2ee) or using the orion/applications directory. Under your choice of
location, I recommend creating a directory to store apps (I use 'ears') and
a directory to store plain web apps ('wars'). (this is largely a personal
preference choice, just don't throw it under /orion or you'll regret it
later ;))

EG For this example I would use /opt/j2ee/wars/jsp-test

> + add the following line to "orion/config/application.xml"
>       <web-module id="jsp-test" path="../jsp-test" />

> + add the following line to "orion/config/default-web-site.xml"
>                       <web-app application="default"
> name="jsp-test" root="/jsp-test" />

> + create the directory "web-inf" under jsp-test - ie
> "orion/jsp-test/web-inf"

> + copy the file "web.xml" from
> "orion/default-web-app/web-inf/web.xml" to
> "orion/jsp-test/web-inf/web.xml"

> + if you wish to add anything (ie servlets), add them to the file
> "orion/jsp-test/web-inf/web.xml"

A quick way to do this is to load up the webappassembler (java -jar
webappassembler.jar), open your directory (eg /opt/j2ee/wars/jsp-test) then
hit File->Save. This will create a WEB-INF directory and a skeleton web.xml
file. (You can also easily configure things through this)

> + start the server.
>
> You should be able to view jsp's that are put in "orion/jsp-test"
> now at "localhost/jsp-test".
>
>
> More information
> ++++++++++++++++
> www.orionsupport.com
> www.orionserver.com/tutorials/
> www.jollem.com


Hope this all helps and I didn't make any obvious slipups. The worst place
to fuckup is writing docs for new users ;)

-mike


Reply via email to