RE: How to accommodate the webapps directory structure change

2000-12-21 Thread Kitching Simon

It looks like there is a little confusion of terminology here..
When I say "webapp root", I mean the root directory of *a*
web application (ie a tomcat context). I am not talking about
the directory $TOMCAT_HOME/webapps.

A single instance of tomcat can host any number of totally
independent web applications. There are two ways of 
defining a web application:

(a) just create a directory under $TOMCAT_HOME/webapps,
and leave it up to the auto-context-creater-thingy to detect
the presence of the directory and automatically define a
context for it (the same process works if there is a .WAR
file in the $TOMCAT_HOME/webapps directory).

(b) explicitly insert a context tag into file
$TOMCAT_HOME/conf/server.xml, specifying a
directory.

In case (a), the "webapp root" is the directory
$TOMCAT_HOME/webapps/somewebappname.
In case (b), the "webapp root" is whatever you
specified for the "baseDir" attribute of the context.

Note that web applications running under tomcat are 
meant to be entirely independent, just like applications 
running in whatever OS you happen to use. When you
write a windows or unix app, you can generally forget
about the fact that other processes are running at the
same time, because the OS gives each process a nice
isolated environment to run in, where it cannot interfere
with other apps, nor other apps interfere with it (except
over minor details, like contention over files). Servlet
engines are meant to provide the same nice isolation
between "web applications".

To get back to your questions:

1. Are you meaning that "webapps" is already one roof,
underneath it can *only* allow one sw system staying there?

No, you can have as many *independent* web applications as
you want inside one tomcat instance. If you want each web
application to be installed within $TOMCAT_HOME/webapps,
then that's fine but they don't have to be there, because the
context tag allows the *root directory* of each web application
to be specified. The only disadvantage of this is that you can't
deploy by just dropping a .WAR file, you need to change the
server.xml file too. Note the word "independent" though - you
said that the "subsystems" you want have "some relations";
if you model them as separate web applications, you may need
to do some fancy hacking to allow them to communicate.

2. Are you meaning, between WEB-INF and webapps, there
should be *only one* level of directory, rather than two?

No. Assuming that you have installed two web applications
in the $TOMCAT_HOME/webapps directory, you will have:

$TOMCAT_HOME/webapps
  + plan
+ WEB-INF
  + classes
  + libs
+ files_for_webapp1
+ more_files_for_webapp1
+ etc
  + execution
+ WEB-INF
  + classes
  + libs
+ files_for_
+ files2
+ etc

but not

$TOMCAT_HOME/webapps
  + is
+ plan
  + WEB-INF
+ classes
+ libs
  + files_for_webapp1
  + more_files_for_webapp1
  + etc
+ execution
  + WEB-INF
+ classes
+ libs
  + files_for_webapp1
  + more_files_for_webapp1
  + etc

because the auto-context-creator-thingy will see
only *one* web application "is", then see that there
is no WEB-INF directory below "is". 

The second directory structure shown above will work 
ok if you disable the auto-context-creator-thingy, and 
instead define separate contexts in server.xml, setting 
baseDir to $TOMCAT_HOME/webapps/is/plan, 
$TOMCAT_HOME/webapps/is/execution, etc. I 
suggest, however, that if you do want to have this
"is" parent directory, you put it somewhere other than
under webapps.

4. Is there any document talking about the whole Tomcat directory
tree
structure
and its design priciple, ie. why they design directory tree
structure
in that way ?

Tomcat is just complying with the SUN servlet and jsp specifications.
See the original sun documents (downloadable from the sun site).

Regards,

Simon

 -Original Message-
 From: Steven Liu [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, December 20, 2000 7:50 PM
 To:   Kitching Simon
 Cc:   '[EMAIL PROTECTED]'
 Subject:  RE: How to accommodate the webapps directory structure
 change
 Importance:   High
 
 Thanks very much, Simon, I see your point.
 
 Now I'd tell you why I want to add one more dir "is"
 
 I'm designing a software system, whose architecture is
 like 
 webapps
  |
 is(Integratioin Suite)
  |
   |--||-|--|
 Plan Execution Report Search Admin
 
 My intention is to allow each subsystem like
 Plan/Execution/Report/Search/Admin as independent
 as possiable, even though there will be some relations
 among them. So I can let different develop group to
 develop each subsystem a bit more independently.
 
 My reason to add "is" dir i

RE: How to accommodate the webapps directory structure change

2000-12-20 Thread Kitching Simon

Hi Steven,

The problem you have with your new directory structure is that the
WEB-INF directory isn't immediately below the webapp root.

In the first case, you have a webapp root of "execution", and WEB-INF
is directly below that directory, so this is OK.

In the second case, you need WEB-INF to be off the "is" directory,
not the "execution" directory. Because it is in the wrong place, it is
regarded as a plain old content directory, not a special directory.
Tomcat will therefore not find the web.xml file, *or* any of the servlet
classes. As a result, any /servlet/... url won't work - tomcat won't
find any corresponding class file.

Cheers,

Simon

 -Original Message-
 From: Steven Liu [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, December 19, 2000 7:13 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  How to accommodate the webapps directory structure change
 
 Following is my directory/file structure for a servlet, it works fine.
 the index.html has the statement:
 "td WIDTH="30%"a href="../execution/servlet/ABC"img
 SRC="../images/execute.gif" HSPACE=4 BORDER=0  align=TOP/aa
 href="../execution/servlet/ABC"Execute/a/td
  
 webapps
|
 execution
||
 servlets  WEB-INF
|   |
 index.html  classes
||
  abc.class  LocalStrings.properties
  
  
 However, after I change the structure into following(add one more
 level of directory, ie "is"), it won't work any more !
 How should I change the statement in index.html like above to 
 accommodate the directory structure change ?
 Or I should do something else to accommodate ?
  
 webapps
|
   is
 execution
||
 servlets  WEB-INF
|   |
 index.html  classes
||
  abc.class  LocalStrings.properties
  
 
 [EMAIL PROTECTED] 
  _ 
| 
 \_/o\_/ 
   \_/ 
 
   Every once in a while, the boundaries get redefined. 
 



RE: How to accommodate the webapps directory structure change

2000-12-20 Thread Steven Liu

Thanks very much, Simon, I see your point.

Now I'd tell you why I want to add one more dir "is"

I'm designing a software system, whose architecture is
like 
webapps
 |
is(Integratioin Suite)
 |
  |--||-|--|
Plan Execution Report Search Admin

My intention is to allow each subsystem like
Plan/Execution/Report/Search/Admin as independent
as possiable, even though there will be some relations
among them. So I can let different develop group to
develop each subsystem a bit more independently.

My reason to add "is" dir is just intend to make whole
sw system under one roof - "is", so under webapps, there
could be more than one sw systems staying there.

1. Are you meaning that "webapps" is already one roof,
underneath it can *only* allow one sw system staying there?

2. Are you meaning, between WEB-INF and webapps, there
should be *only one* level of directory, rather than two?

3. Are you meaning each subsystem should have its own WEB-INF
like following structure? ( Report/Search/Admin are not detailed in this
diagram)

 
|---|--|---|--|
   Plan  Execution Report
Search Admin 
 |   |

|--|---|---||--|---|---| 
jsp servletsWEB-INF META-INFjsp servletsWEB-INF META-INF

 |  |   ||   |  |   ||

some.jsp index.html classes MENIFEST.MF some.jsp index.html classes
MENIFEST.MF 

4. Is there any document talking about the whole Tomcat directory tree
structure
and its design priciple, ie. why they design directory tree structure
in that way ?

So far, I'm still struggling to understand the Tomcat's directory
structure, Tomcat sw design principles, ie. big-picture-wise stuff, 
if you can share some of the lights w/ me, 
that will be greatly appreciated.

Cheers,

[EMAIL PROTECTED]
 _
   |
\_/o\_/
  \_/

  Every once in a while, the boundaries get redefined.



-Original Message-
From: Kitching Simon [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 20, 2000 2:07 AM
To: '[EMAIL PROTECTED]'
Subject: RE: How to accommodate the webapps directory structure change


Hi Steven,

The problem you have with your new directory structure is that the
WEB-INF directory isn't immediately below the webapp root.

In the first case, you have a webapp root of "execution", and WEB-INF
is directly below that directory, so this is OK.

In the second case, you need WEB-INF to be off the "is" directory,
not the "execution" directory. Because it is in the wrong place, it is
regarded as a plain old content directory, not a special directory.
Tomcat will therefore not find the web.xml file, *or* any of the servlet
classes. As a result, any /servlet/... url won't work - tomcat won't
find any corresponding class file.

Cheers,

Simon

 -Original Message-
 From: Steven Liu [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, December 19, 2000 7:13 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  How to accommodate the webapps directory structure change
 
 Following is my directory/file structure for a servlet, it works fine.
 the index.html has the statement:
 "td WIDTH="30%"a href="../execution/servlet/ABC"img
 SRC="../images/execute.gif" HSPACE=4 BORDER=0  align=TOP/aa
 href="../execution/servlet/ABC"Execute/a/td
  
 webapps
|
 execution
||
 servlets  WEB-INF
|   |
 index.html  classes
||
  abc.class  LocalStrings.properties
  
  
 However, after I change the structure into following(add one more
 level of directory, ie "is"), it won't work any more !
 How should I change the statement in index.html like above to 
 accommodate the directory structure change ?
 Or I should do something else to accommodate ?
  
 webapps
|
   is
 execution
||
 servlets  WEB-INF
|   |
 index.html  classes
||
  abc.class  LocalStrings.properties
  
 
 [EMAIL PROTECTED] 
  _ 
| 
 \_/o\_/ 
   \_/ 
 
   Every once in a while, the boundaries get redefined.