Interesting question.... this is wot I would do.... try!
The basic thing I would use Apache Httpd for it to.... direct via Virtual
hosting and the worker file... domain names to various tomcat instances.
eg you can have 2 tomcat instances on a machine and tomcat spread across
many machines.
So domain names become things like Games.ServiceProvider.Net
Accounts.ServiceProvider.Net Webs.ServiceProvider.Net
Free.ServiceProvider.Net
..... Context paths as far as I am concerned dont work... nor do I (you)
really want them....
It works on the web-app name and the uri mapping in web.xml.... or the
web-app name and the path to the jsp..... forget about context paths.
It makes more sense outside of context paths, anyway...
So if a client writes an app the uri will be
AssignedMachine/WebAppName/servletname
AssignedMachine/WebAppName/pathto.Jsp
etc...
In theory you can mess with the relative URI.... but in practice you cant...
For example if you just change the webappname of the WAR... you will see
that uri also changes... and tomcat does the right thing with the context
paths (automatically!).
If you change the path to a jsp.... it will change the uri.
If you change the servlet mapping in web.xml you can put the servlet
anywhere..... eg
AssignedMachine/WebAppName/Some/more/stuff/in/servlet/mapping
etc etc....
BUT..... if you mess with this and even if you wanted to and could override
the context paths..... it will probably break the web-app 8 out of 10 times
because programmers often hardcode paths inside their apps.... or have used
relative contexts that they expect to be there.
Point is.... if you forget about the users name in the uri.... life gets
easy... you will be dropping web-apps into a tomcat web-app... and going for
a coffee break.
Sometimes 2 users will have the same web app name.... you dont change
it..... thats why you got multiple tomcat instances. Funstuff1.SP.net etc.
Sometimes the user will want the root of the domain.... and his own domain
name.... that requires a restart of the system.... because you going to use
apache to map that 2 the TomcatsInstancesWithOwnDomainNames.... and each
tomcat will Map via the hosts section to that users own webapp location....
ie if a user wants a domain name... they get their very own tomcat (web-app
location)... and they can use ROOT.... ie they own that domain.
Own domain name users will need a restart... so you try isolate that
system... own domain users pay more..... but they got their own tomcat.
Keeping track of users..... spreadsheets.... ie webappx belongs to userx
Domainer's.... a good question now will be.... can the tomcat manager be
used to install web-app remotely.... only in one <host docbase> section and
not the others..... if so its great.... once setup... own domainers... do
their own thing.
Other thing is if a user... an own domainer... ever wanted load
balancing.... its easy to provide....
If you want to get it to what you suggesting.... just tell the users that
their webapp name must be their username.... thing is, I think you will find
thats the last thing most people want in thier uri.....
Accounts.SP.net/JohnnyKewl/InvoiceSystem/ ..... yuk!
Something like that..... nice interesting project..... have fun....
----- Original Message -----
From: "Nathan Hook" <[EMAIL PROTECTED]>
To: <users@tomcat.apache.org>
Sent: Tuesday, May 15, 2007 8:28 PM
Subject: Dynamic URIs Using one Context
We've been given a difficult problem to solve and I'm hoping that some
help/insight is available on this mailing list.
We are an Application Service Provider (ASP) that has numerous clients
with the number of clients increasing rapidly. All our clients use the
same application but each client needs/wants a distinguishing element in
the url to identify them to their users.
Here is our current setup:
Apache 2.2 with mod_jk sending requests to Tomcat 5.5. Struts 1.3.8 is
our current web framework.
In our httpd.conf we have a different domain name for each client:
<VirtualHost *:80>
ServerName <client name 1>.<server name>.com
DocumentRoot <some directory>/<client name 1>.<server name>.com
</VirtualHost>
<VirtualHost *:80>
ServerName <client name 2>.<server name>.com
DocumentRoot <some directory>/<client name 2>.<server name>.com
</VirtualHost>
Then in our server.xml config file for Tomcat we only declare one Host
element with a Context that has many Alias':
<Host name="<client name 1>.<server name>.com" appBase="webapps">
<Context path="/app" >
</Context>
<Alias><client name 2>.<server name>.com</Alias>
<Alias><client name 3>.<server name>.com</Alias>
...etc for each of our clients...
</Host>
So, what is the problem? Well, when we add a new customer we have to edit
the httpd.conf, the server.xml, restart both applications, and add the new
<customer>.<server name>.com to DNS (Usually, we have to wait until late
into the evening to do these tasks). Our Client Services team want the
ability to add customers without having to wait until we can restart our
servers.
Is it possible to do the following with an Apache 2.2 and Tomcat 5.5
combination while having only ONE instance of the application only once
loaded in Tomcat? (Meaning we do NOT want the application loaded by
Tomcat x times, with x being the number of clients we have.)
<base name>.<server name>.com/<client name 1>/app
<base name>.<server name>.com/<client name 2>/app
<base name>.<server name>.com/<client name 3>/app
I'm not really the best with how the Context attribute works outside of
having it placed in the server.xml. I've tried reading the documentation
on Contexts at:
http://tomcat.apache.org/tomcat-5.5-doc/deployer-howto.html
But, I find what is explained a tad bit confusing.
Here is one thread from the archives that explained our problem pretty
well, but there never really was an answer on how to accomplish the task
except "you're getting the right behavior with a 400 response":
http://marc.info/?l=tomcat-user&m=115602705505727&w=2
Finally, through some other research, it seems as though someone was
trying to use mod_vhost_alias to accomplish the same thing.
Any thoughts or suggestions are welcome.
Thank you for your time.
_________________________________________________________________
Make every IM count. Download Messenger and join the i'm Initiative now.
It's free. http://im.live.com/messenger/im/home/?source=TAGHM_MAY07
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]