Yes, I understand that perfectly. What I am asking is what if we include a web application Context path, that is <Context path="someuri"...>. Of course, JkMount /*/eservlet/* would relay all the request with mywebapp/eservlet/* from Apache to Tomcat -- I am aware of that. Now if we set <Context path="someuri"...>, what is going to happen to our URI?
Here's an excerpt from Tomcat config document: "The context path of this web application, which is matched against the beginning of each request URI to select the appropriate web application for processing. All of the context paths within a particular Host must be unique. If you specify a context path of an empty string (""), you are defining the default web application for this Host, which will process all requests not assigned to other Contexts. The value of this field must not be set except when statically defining a Context in server.xml, as it will be infered from the filenames used for either the .xml context file or the docBase." So when Apache webserver gets a request for a particular virtualhost, jk_mod sees if the request must be handled by Tomcat (i.e. satisfies /*/eservlet/*) or not. If it does, it relays it to the appropriate host and depending on "path" which is defined above, finally the request is handed to the appropriate context or web application designated for that "Host" (based on that "path", again according to the excerpt above). Now, having specified the "path," how are we going to access a servlet with such scenario? I gave a straightforward example but you still didn't answer my question. On 8/20/06, Martin Gainty <[EMAIL PROTECTED]> wrote:
Why are you mixing up Apache and Tomcat? If you are speaking of AJP 'context' term if you look at the doc you will see JkMount [URL prefix] [Worker name] /*where URL prefix is the context*/ JkMount /*/esrvlt/* worker1 Send all requests of whateverWebApp/eservlet/WhateverFileName to worker1 so in essence http://<host>/*/eservlet/<anything> will be directed to Tomcat Assuming your workers.properties has this configuration #workers.properties worker.worker1.port=8009 worker.worker1.host=localhost worker.worker1.type=ajp13 /*Now all tomcat requests are redirected to localhost on port 8009*/ /*Inside $TOMCAT_HOME/conf/server.xml you have a connector which will listen on port 8009*/ <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 --> <Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8009" minProcessors="5" maxProcessors="75" enableLookups="true" redirectPort="8443" acceptCount="10" debug="0" connectionTimeout="0" useURIValidationHack="false" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/> Martin -- ********************************************************************* This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. ----- Original Message ----- From: "Evan J " <[EMAIL PROTECTED]> To: "Tomcat Users List" <users@tomcat.apache.org>; "Martin Gainty" <[EMAIL PROTECTED]> Sent: Sunday, August 20, 2006 1:15 PM Subject: Re: JkMount and Context path > Martin, > > I have the documents and I'm aware the difinition of Context path and > from what you have posted, it says, "It is matched against the > requesting URI." Now, my question was having Context path set, what > would the appropriate URI in case that the system utilizes Apache and > jk_mod in which JkMount is used for the requests to be processes by > jk_mod and passed on to Tomcat? Allow me to restate my example, so you > will be able to answer my question through the example itself. > > JkMount /*/esrvlt/* worker1 > JkMount /*/esrvlt/*.jsp worker1 > > The web application is "myapp" > Context path is "/someuri" > One of the servlet mapping in web.xml is "/esrvlt/myservlet" > > Now given that, how should "myservlet" be accessed, that is the actual > URL must look like? > > http://vh.host.com/myapp/esrvlt/myservlet OR > http://vh.host.com/someuri/myapp/esrvlt/myservlet OR > Must it have a different set of configuration (jkMount, path, mapping) > in order to be accessed properly? Or Context path in such situation > has no bearing? Please answer through forementioned scenario. > > And as for using Apache webserver... I am just playing around with > different configuration in order to understand how they interact with > each other. For now, I have no need to utilize a third party web > server. Although, that being said, I can see usage for having a front > end web server to, for example, pass on the load balancing to it > rather than let Tomcat's handle it. And as you have posted, directives > such as JkAutoAlias/JkMount/JkUnMount would allow me to process those > files that can be statistically served such as .gif or .html and > dynamic content to be passed on and handled by Tomcat (or any other > web container). > > Sincerely, > > Evan > > > On 8/20/06, Martin Gainty <[EMAIL PROTECTED]> wrote: >> <Context path="/urlPath" docBase="/com/packagename" ... > >> #path is the context path of the webapp which is matched against the requesting URI to choose appropriate webapp to process (all paths must be unique) >> #docBase maps the urlPath to physical docBase (which can either be absolute path or relative to webapps) >> #embedding context elements within server.xml has been replaced by encapsulating context.xml for each webapp #$CATALINA_HOME/webapps/WebApp/META-INF/context.xml >> >> #within context You also have the capability of passing in initialisation parameters via <Parameter in context.xml >> #or Environment settings via <Environment parameter >> >> #If you have JDBC resources You can also declare ResourceParams for jdbc connections via <ResourceParams >> >> #You can also declare global JNDI resource via <ResourceLink >> >> Doc available at >> http://tomcat.apache.org/tomcat-5.0-doc/config/context.html >> >> Mod-jk >> #mod_jk JkAutoAlias maps all web application context directories into Apache document space..you DONT want to do this if you want to give Tomcat >> #control of the folder as in the example illustrated here >> JkAutoAlias /export/home/web/host2/webapps >> >> JkMount /*.jsp ajp13 >> JkMount /*/servlet/ ajp13 >> >> #A single webapp mapped into Apache document space can be accomplished via Alias as in this example >> Alias /examples /export/home/web/host1/webapps/examples >> JkMount /*.jsp ajp13 >> JkMount /*/servlet/ ajp13 >> >> All of this depends on how you are configuring your Context listener as in this example >> <Host name="localhost" debug="0" appbase="webapps" > >> <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" >> append="true" forwardAll="true"/ > >> /> >> #where the most significant parameter forwardAll = "true" will direct apache to forward your context listener requests to tomcat >> #verify these settings by viewing mod-jk.conf >> >> The only question I have is why not let tomcat run standalone? >> M- >> ********************************************************************* >> This email message and any files transmitted with it contain confidential >> information intended only for the person(s) to whom this email message is >> addressed. If you have received this email message in error, please notify >> the sender immediately by telephone or email and destroy the original >> message without making a copy. Thank you. >> >> >> >> ----- Original Message ----- >> From: "Evan J " <[EMAIL PROTECTED]> >> To: "Tomcat Users List" <users@tomcat.apache.org>; "Martin Gainty" <[EMAIL PROTECTED]> >> Sent: Sunday, August 20, 2006 1:01 AM >> Subject: Re: JkMount and Context path >> >> >> > Ok, your answer just recaps everything that is needed to run >> > Apache-jk_mod-Tomcat but does not answer my question. What if in your >> > setting, you have set Context path, what would be the consequences? >> > How are the servlets then are accessed? Is it required to include >> > Context path in the uri ending to the servlet like the examples are >> > provided earlier? It seems like that is not the case so I am taking it >> > either Context path, if it's designated, has no bearing when it comes >> > to jk_mod or must be included in the uri in some other way. >> > >> > On 8/19/06, Martin Gainty <[EMAIL PROTECTED]> wrote: >> >> /*httpd.conf >> >> JkMount maps all JSP (*.jsp) to ajp13 >> >> */ >> >> e.g. >> >> httpd.conf >> >> JkMount /*.jsp ajp13 >> >> >> >> /*map ajp13 to your webapp docRoot /var/tomcat4/webapps/domain1 >> >> <VirtualHost *> >> >> ServerName domain1.com >> >> ServerAlias www.domain1.com >> >> DocumentRoot /var/tomcat4/webapps/domain1 >> >> JkMount /* ajp13 >> >> </VirtualHost> >> >> >> >> /*server.xml maps known webapp docBase /var/tomcat4/webapps/domain to domain name(domain1) via this entry*/ >> >> <Host name="domain1.com" debug="0" appBase="webapps" unpackWARs="true"> >> >> <Alias>www.domain1.com</Alias> >> >> <Logger className="org.apache.catalina.logger.FileLogger" >> >> directory="logs" prefix="virtual_log1." suffix=".log" timestamp="true"/> >> >> <Context path="" docBase="/var/tomcat4/webapps/domain1" debug="0" reloadable="true"/> >> >> </Host> >> >> >> >> HTH >> >> M- >> > >> > --------------------------------------------------------------------- >> > 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] > >
--------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]