There might be a more 'elegant' way but a simple brute
force solution is to create a simple dispatcher
servlet (or JSP) that does the following:
String host = request.getHeader("HOST");
String port = "80";
if(host.indexOf(":")>-1){
port = host.substring(host.indexOf(":")+1);
}
//assume getDispatchMap() returns a map of
//ports to servlets, probably loaded from
//a configuration file or whatever
String target = (String)getDispatchMap().get(port);
RequestDispatcher rd =
context.getRequestDispatcher(target);
rd.forward(request,response);
That is a simple dispatcher pattern that should work.
The only thing you have to do is configure "/" to map
to the above servlet/jsp. You can do that in a
variety of ways.
The usual caveates and disclaimers apply to the above
code... :-)
Cheers,
Mel
--- William Wishon <[EMAIL PROTECTED]> wrote:
> Hi,
> My goal is to be able to have different servlets
> mapped to "/" on different
> ports. I have not found any way to do this in
> server.xml, so I started
> grep'ing and groveling through the code to find out
> more. Now as far as I
> can tell right now what I want to do is not possible
> using Tomcat 3.2.1. My
> question to this list is if anyone here can either
> show me what I've missed
> and tell me how to configure Tomcat to do what I
> want. Or if someone can
> help me out by pointing me in the right direction in
> terms of patching the
> 3.2.1 sources to do what I want. Perhaps this is
> now possible in the newer
> versions of tomcat and I could back port a change.
> Or ??? Any help is
> greatly appreciated.
>
> An example of what I'm trying to do is to have a GET
> on "/" of port 8080
> return webapps/app1/index.html and a GET of "/" on
> port 8081 return
> webapps/app2/index.html.
>
> Thanks,
> Bill
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, email:
> [EMAIL PROTECTED]
>
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]