RE: Assigning Servlets to different ports.
Why don't you just run 2 servlet container(Tomcat)s for each port? -Original Message- From: William Wishon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 9:27 AM To: [EMAIL PROTECTED] Subject: Assigning Servlets to different ports. Hi, snipped 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Assigning Servlets to different ports.
Hi Mel, If you are interested in an approach to getting Tomcat to serve apps on multiple ports, you might want to check out the Enhydra Enterprise 4.0 source. We create multiple ContextManagers, where each ContextManager handles the group of apps running on a particular connection (port). This is currently using Tomcat 3.2.1. Shawn Mel Martinez wrote: --- Uijin Hong [EMAIL PROTECTED] wrote: Why don't you just run 2 servlet container(Tomcat)s for each port? That could get memory expensive if you have to do this for several ports. The best performance scenario might be to use Apache to listen to several ports and rewrite them to go to a single tomcat 'delegator' servlet which then dispatches them to servlets/JSPs appropriately. And actually, you should just use apache rewrites directly to dispatch to any static resources. Mel -Original Message- From: William Wishon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 9:27 AM To: [EMAIL PROTECTED] Subject: Assigning Servlets to different ports. Hi, snipped 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] - 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] -- Shawn McMurdo mailto:[EMAIL PROTECTED] Lutris Technologieshttp://www.lutris.com Enhydra.Orghttp://www.enhydra.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Assigning Servlets to different ports.
Shawn, Could you point me more specifically at where Enhydra uses multiple ContextManagers? I just downloaded EE 4.0a4 and couldn't find any files that have examples of multiple ContextManagers on different ports serving groups of apps. Whenever I try to use multiple ContextManagers on different ports I get lots of messages about removing duplicate servlets (like the jsp servlet, status servlet, exception servlet), and tomcat is unresponsive to any of my requests and refuses to shutdown, until I 'kill' it. Any help on figuring this out would be great. From my code archeology I was just about to conclude that it wasn't possible in tomcat 3.2.1 until your comment made me think that I had missed something. -Bill -Original Message- From: Shawn McMurdo [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 10:25 AM To: [EMAIL PROTECTED] Subject: Re: Assigning Servlets to different ports. Hi Mel, If you are interested in an approach to getting Tomcat to serve apps on multiple ports, you might want to check out the Enhydra Enterprise 4.0 source. We create multiple ContextManagers, where each ContextManager handles the group of apps running on a particular connection (port). This is currently using Tomcat 3.2.1. Shawn Mel Martinez wrote: --- Uijin Hong [EMAIL PROTECTED] wrote: Why don't you just run 2 servlet container(Tomcat)s for each port? That could get memory expensive if you have to do this for several ports. The best performance scenario might be to use Apache to listen to several ports and rewrite them to go to a single tomcat 'delegator' servlet which then dispatches them to servlets/JSPs appropriately. And actually, you should just use apache rewrites directly to dispatch to any static resources. Mel -Original Message- From: William Wishon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 9:27 AM To: [EMAIL PROTECTED] Subject: Assigning Servlets to different ports. Hi, snipped 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] - 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] -- Shawn McMurdo mailto:[EMAIL PROTECTED] Lutris Technologieshttp://www.lutris.com Enhydra.Orghttp://www.enhydra.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Assigning Servlets to different ports.
Hi William, Regarding "multiple ContextManagers" - IMHO it should be possible to do that, but it's not a very tested feature. If what you want to do is support virtual hosts - tomcat supports virtual hosts using a single ContextManager ( the contextManager is a representation for a "server" that may have multiple hosts). There is no special representation for Host ( as a top-level object ) - each Context belongs to a virtual host, and the mapper is routing the requests. You can add additional modules to filter or do other tricks. ( just use Context.getHost() or getHostAliases() ). If you want to isolate applications/hosts - using separate VMs may give you more benefits. There are cases when multiple ContextManagers may help - for example if the servers have very different configuration ( i.e. top-level modules for mapping, etc). In 3.3 ( with the experimental ProfileLoader ) you can push all the modules as per/context interceptors, i.e. separate sets of modules for each web application - what's shared is the config modules and the top-level mapper. That means even fewer reasons to have multiple ContextManagers. IMHO if what you want to do requires changes/fixes in tomcat, you should try tomcat 3.3, where it is still possible to do this kind of change ( assuming it's not too big ). For 3.2.2 I don't think this can be clasified as a critical bug, and I don't think Marc would enjoy it :-) Costin Could you point me more specifically at where Enhydra uses multiple ContextManagers? I just downloaded EE 4.0a4 and couldn't find any files that have examples of multiple ContextManagers on different ports serving groups of apps. Whenever I try to use multiple ContextManagers on different ports I get lots of messages about removing duplicate servlets (like the jsp servlet, status servlet, exception servlet), and tomcat is unresponsive to any of my requests and refuses to shutdown, until I 'kill' it. Any help on figuring this out would be great. From my code archeology I was just about to conclude that it wasn't possible in tomcat 3.2.1 until your comment made me think that I had missed something. -Bill -Original Message- From: Shawn McMurdo [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 10:25 AM To: [EMAIL PROTECTED] Subject: Re: Assigning Servlets to different ports. Hi Mel, If you are interested in an approach to getting Tomcat to serve apps on multiple ports, you might want to check out the Enhydra Enterprise 4.0 source. We create multiple ContextManagers, where each ContextManager handles the group of apps running on a particular connection (port). This is currently using Tomcat 3.2.1. Shawn Mel Martinez wrote: --- Uijin Hong [EMAIL PROTECTED] wrote: Why don't you just run 2 servlet container(Tomcat)s for each port? That could get memory expensive if you have to do this for several ports. The best performance scenario might be to use Apache to listen to several ports and rewrite them to go to a single tomcat 'delegator' servlet which then dispatches them to servlets/JSPs appropriately. And actually, you should just use apache rewrites directly to dispatch to any static resources. Mel -Original Message- From: William Wishon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 9:27 AM To: [EMAIL PROTECTED] Subject: Assigning Servlets to different ports. Hi, snipped 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] - 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] -- Shawn McMurdo mailto:[EMAIL PROTECTED] Lutris Technologieshttp://www.lutris.com Enhydra.Orghttp://www.enhydra.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For addi
RE: Assigning Servlets to different ports.
At 12:35 PM -0800 2001/03/06, [EMAIL PROTECTED] wrote: If what you want to do is support virtual hosts - tomcat supports virtual hosts using a single ContextManager ( the contextManager is a representation for a "server" that may have multiple hosts). There is no special representation for Host ( as a top-level object ) - each Context belongs to a virtual host, and the mapper is routing the requests. You can add additional modules to filter or do other tricks. ( just use Context.getHost() or getHostAliases() ). Costin, I see I can bind specific servlets to a host by name, but how can I bind to a specific port? I want my webapp only available via SSL, and a single homepage on port 80, redirecting users to port 443 to really use the site. There are cases when multiple ContextManagers may help - for example if the servers have very different configuration ( i.e. top-level modules for mapping, etc). In 3.3 ( with the experimental ProfileLoader ) you can push all the modules as per/context interceptors, i.e. separate sets of modules for each web application - what's shared is the config modules and the top-level mapper. That means even fewer reasons to have multiple ContextManagers. I'm using 3.2.1 -- does 3.3 add the capability to bind servlets/webapps to individual ports? IMHO if what you want to do requires changes/fixes in tomcat, you should try tomcat 3.3, where it is still possible to do this kind of change ( assuming it's not too big ). For 3.2.2 I don't think this can be clasified as a critical bug, and I don't think Marc would enjoy it :-) Thanks, Chris Pepper -- Chris Pepper: http://www.reppep.com/~pepper/ Rockefeller U Computing Services: http://www.rockefeller.edu/ Mac OS X Software: http://www.mosxsw.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Assigning Servlets to different ports.
Costin, If what you want to do is support virtual hosts - tomcat supports virtual hosts using a single ContextManager ( the contextManager is a representation for a "server" that may have multiple hosts). I don't mind using virtual hosts, but they don't do what I'm looking for. I have two servlets, one provides a public service and the other is the configuration and administration of that public service. I want to have the root "/" of port 8080 go to the publicly available servlet. Then using firewalling rules allow access to port 8081 only from the local network. "/" on port 8081 would go to the administration servlet. The problem with virtual hosting as implemented in Tomcat 3.2.1 is that both virtual hosts and their contexts are available on both ports. That exposes the administration functionallity to the public and I don't want that. There is no special representation for Host ( as a top-level object ) - each Context belongs to a virtual host, and the mapper is routing the requests. You can add additional modules to filter or do other tricks. ( just use Context.getHost() or getHostAliases() ). If you want to isolate applications/hosts - using separate VMs may give you more benefits. I can't use multiple VM's because the administration servlet 'talks' to the other servlet by changing it's in memory configuration. Ideally what I am looking for is something like: Context path="/" docBase="/webapps/PublicService" port="8080" Context path="/" docBase="/webapps/AdminService" port="8081" I'm begining to think I could modify (or subclass) Context.java to have a port property, then create a new mapper like SimpleMapper1 that looks at the request and looks at the contexts port property and enforces the separation. Does that sound about right? IMHO if what you want to do requires changes/fixes in tomcat, you should try tomcat 3.3, where it is still possible to do this kind of change ( assuming it's not too big ). For 3.2.2 I don't think this can be clasified as a critical bug, and I don't think Marc would enjoy it :-) I'm not trying make any more work for anyone else, I'm just trying to get some advice on how the code works and where to begin my changes. Because stability is important to me I am more willing to make a (hopefully small) patch against 3.2.1 than to 'upgrade' to the more unstable 3.3 code. I would, however, be willing to back port some changes if 3.3 had this functionallity, but from what I could gather 3.3 is also missing this ability. -Bill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Assigning Servlets to different ports.
Hi Costin, I will be very interested to learn more about the ProfileLoader and Tomcat 3.3 in general. I hope to have more time to bang on TC3.3 and TC4.0 after Enhydra Enterprise 4.0 is released. Shawn [EMAIL PROTECTED] wrote: Hi William, Regarding "multiple ContextManagers" - IMHO it should be possible to do that, but it's not a very tested feature. If what you want to do is support virtual hosts - tomcat supports virtual hosts using a single ContextManager ( the contextManager is a representation for a "server" that may have multiple hosts). There is no special representation for Host ( as a top-level object ) - each Context belongs to a virtual host, and the mapper is routing the requests. You can add additional modules to filter or do other tricks. ( just use Context.getHost() or getHostAliases() ). If you want to isolate applications/hosts - using separate VMs may give you more benefits. There are cases when multiple ContextManagers may help - for example if the servers have very different configuration ( i.e. top-level modules for mapping, etc). In 3.3 ( with the experimental ProfileLoader ) you can push all the modules as per/context interceptors, i.e. separate sets of modules for each web application - what's shared is the config modules and the top-level mapper. That means even fewer reasons to have multiple ContextManagers. IMHO if what you want to do requires changes/fixes in tomcat, you should try tomcat 3.3, where it is still possible to do this kind of change ( assuming it's not too big ). For 3.2.2 I don't think this can be clasified as a critical bug, and I don't think Marc would enjoy it :-) Costin Could you point me more specifically at where Enhydra uses multiple ContextManagers? I just downloaded EE 4.0a4 and couldn't find any files that have examples of multiple ContextManagers on different ports serving groups of apps. Whenever I try to use multiple ContextManagers on different ports I get lots of messages about removing duplicate servlets (like the jsp servlet, status servlet, exception servlet), and tomcat is unresponsive to any of my requests and refuses to shutdown, until I 'kill' it. Any help on figuring this out would be great. From my code archeology I was just about to conclude that it wasn't possible in tomcat 3.2.1 until your comment made me think that I had missed something. -Bill -Original Message- From: Shawn McMurdo [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 10:25 AM To: [EMAIL PROTECTED] Subject: Re: Assigning Servlets to different ports. Hi Mel, If you are interested in an approach to getting Tomcat to serve apps on multiple ports, you might want to check out the Enhydra Enterprise 4.0 source. We create multiple ContextManagers, where each ContextManager handles the group of apps running on a particular connection (port). This is currently using Tomcat 3.2.1. Shawn Mel Martinez wrote: --- Uijin Hong [EMAIL PROTECTED] wrote: Why don't you just run 2 servlet container(Tomcat)s for each port? That could get memory expensive if you have to do this for several ports. The best performance scenario might be to use Apache to listen to several ports and rewrite them to go to a single tomcat 'delegator' servlet which then dispatches them to servlets/JSPs appropriately. And actually, you should just use apache rewrites directly to dispatch to any static resources. Mel -Original Message- From: William Wishon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 9:27 AM To: [EMAIL PROTECTED] Subject: Assigning Servlets to different ports. Hi, snipped 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] - 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] -- Shawn McMurdo mailto:[EMAIL PROTECTED] Lutris Technologieshttp://www.lutris.com Enhydra.O
Assigning Servlets to different ports.
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]
Re: Assigning Servlets to different ports.
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]