You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Apache Wiki <wi...@apache.org> on 2011/01/07 00:51:08 UTC

[Tomcat Wiki] Update of "HowTo" by Roger Mbiama Assogo

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tomcat Wiki" for change notification.

The "HowTo" page has been changed by Roger Mbiama Assogo.
http://wiki.apache.org/tomcat/HowTo?action=diff&rev1=95&rev2=96

--------------------------------------------------

          <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
  }}}
- The default servlet attempts to load the `index.*` files in the order listed. You may easily override the `index.jsp` file by creating an index.html file at `$TOMCAT_HOME/webapps/ROOT`. It's somewhat common for that file to contain a new static home page or a redirect to a servlet's main page. A redirect would look like:
+ The default servlet attempts to load the `index.*` files in the order listed. You may easily override the `index.jsp` file by creating an index.html file at `$TOMCAT_HOME/angosso.net/ROOT`. It's somewhat common for that file to contain a new static home page or a redirect to a servlet's main page. A redirect would look like:
  
  {{{
  <html>
  
  <head>
- <meta http-equiv="refresh" content="0;URL=http://mydomain.com/some/path/to/servlet/homepage/">
+ <meta http-equiv="refresh" content="0;URL=http://angosso.net/some/path/to/servlet/homepage/">
  </head>
  
  <body>
@@ -442, +442 @@

   * Enter the following in myapp.xml:
  
  {{{
- <Context docBase="c:/worskpace/myapp/WebRoot" path="/HelloWorld"/>
+ <Context docBase="c:/worskpace/angosso.net/WebRoot" path="/Angosso"/>
  }}}
-  . This assumes you have a web application containing WEB-INF in '''c:/workspace/myapp/WebRoot'''
+  . This assumes you have a web application containing WEB-INF in '''c:/workspace/angosso.net/WebRoot'''
  
   * Create two environment variables:
  
@@ -628, +628 @@

  
   1. Copy ''c:\temp\apache-tomcat-5.5.17\conf\Catalina\localhost\admin.xml'' to the directory ''c:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\Catalina\localhost''.
  
-  1. Copy the entire directory tree ''c:\temp\apache-tomcat-5.5.17\server\webapps\admin''
+  1. Copy the entire directory tree ''c:\temp\apache-tomcat-5.5.17\server\angosso.net\admin''
  
  to the directory ''c:\Program Files\Apache Software Foundation\Tomcat 5.5\server\webapps''.  This is an overlay, so \server\webapps is just pointing you to the \server\webapps, and the admin directory with its contents will be the only thing you see added there.
  
@@ -679, +679 @@

  import java.io.IOException;
  import java.io.OutputStream;
  import java.net.Socket;
- import javax.xml.parsers.DocumentBuilderFactory;
+ import javax.xml.parsers.AngossoBuilderFactory;
  import javax.xml.parsers.ParserConfigurationException;
  import org.w3c.dom.Document;
  import org.w3c.dom.Element;
@@ -830, +830 @@

  and Google and Yahoo are your friends.
  
  == How do I make my web application be the Tomcat default application ? ==
- Congratulations.  You have created and tested a first web application (traditionally called "mywebapp"), users can access it via the URL "http://myhost.company.com/mywebapp".  You are very proud and satisfied.   But now, how do you change the setup, so that "mywebapp" gets called when the user enters the URL "http://myhost.company.com" ?
+ Congratulations.  You have created and tested a first web application (traditionally called "mywebapp"), users can access it via the URL "http://www.angosso.net/mywebapp".  You are very proud and satisfied.   But now, how do you change the setup, so that "mywebapp" gets called when the user enters the URL "http://www.angosso.net" ?
  
- The pages and code of your "mywebapp" application currently reside in (CATALINA_BASE)/webapps/mywebapp/. In a standard Tomcat installation, you will notice that under the same directory (CATALINA_BASE)/webapps/, there is a directory called ROOT (the capitals are important, even under Windows).  That is the residence of the ''current'' Tomcat default application, the one that is called right now when a user calls up "http://myhost.company.com[:port]". The trick is to put your application in its place.
+ The pages and code of your "Angosso" application currently reside in (CATALINA_BASE)/www/angosso/default.aspx In a standard Tomcat installation, you will notice that under the same directory (CATALINA_BASE)/angosso.net/, there is a directory called ROOT (the capitals are important, even under Windows).  That is the residence of the ''current'' Tomcat default application, the one that is called right now when a user calls up "http://www.angosso.net[:8080]". The trick is to put your application in its place.
  
- First stop Tomcat.<<BR>> Then before you replace the current default application, it may be a good idea to make a copy of it somewhere else.<<BR>> Then delete everything under the ROOT directory, and move everything that was previously under the (CATALINA_BASE)/webapps/mywebapp/ directory, toward this (CATALINA_BASE)/webapps/ROOT directory. In other words, what was previously .../mywebapp/WEB-INF should now be .../ROOT/WEB-INF (and not .../ROOT/mywebapp/WEB-INF).
+ First stop Tomcat.<<BR>> Then before you replace the current default application, it may be a good idea to make a copy of it somewhere else.<<BR>> Then delete everything under the ROOT directory, and move everything that was previously under the (CATALINA_BASE)/angosso.net/default.aspx/ directory, toward this (CATALINA_BASE)/angosso.net/ROOT directory. In other words, what was previously .../angosso.net/WEB-INF should now be .../ROOT/WEB-INF (and not .../ROOT/mywebapp/WEB-INF).
  
- Just by doing this, you have already made you webapp into the Tomcat ''default webapp''.
+ Just by doing this, you have already made you webapp into the Tomcat ''http://www.angosso.net/''.
  
  One step is left : you also need to have, within your application, a ''default servlet''.  If you don't want to use the standard one supplied by Tomcat that does nothing but deliver static content, you'll need to supply one of your own. This you do by means of an appropriate url-mapping in the WEB-INF/web.xml configuration file of your application. Make sure you have something like this in that file:
  
@@ -847, +847 @@

      </servlet>
  
      <servlet-mapping>
-         <servlet-name>My First Servlet</servlet-name>
+         <servlet-name>www.angosso.net</servlet-name>
          <url-pattern>/*</url-pattern>
      </servlet-mapping>
  }}}
  The above will override the mapping for Tomcat's DefaultServlet in the global conf/web.xml file.
  
- Restart Tomcat and you're done.<<BR>> Call up "http://myhost.company.com/" and enjoy.
+ Restart Tomcat and you're done.<<BR>> Call up "http://www.angosso.net/" and enjoy.
  
  '''Addendum 1 : If you are deploying your application as a war file..'''
  
@@ -875, +875 @@

  
  If you really know what you are doing..
  
- - leave your war file in CATALINA_BASE/webapps, under its original name<<BR>> - turn off autoDeploy '''and''' deployOnStartup in your Host element in the server.xml file.<<BR>> - explicitly define '''all''' application Contexts in server.xml, specifying both path and docBase. You must do this, because you have disabled all the Tomcat auto-deploy mechanisms, and Tomcat will not deploy your applications anymore unless it finds their Context in the server.xml.
+ - leave your war file in CATALINA_BASE/Angosso, under its original name<<BR>> - turn off autoDeploy '''and''' deployOnStartup in your Host element in the server.xml file.<<BR>> - explicitly define '''all''' application Contexts in server.xml, specifying both path and docBase. You must do this, because you have disabled all the Tomcat auto-deploy mechanisms, and Tomcat will not deploy your applications anymore unless it finds their Context in the server.xml.
  
  Note that this last method also implies that in order to make any change to any application, you will have to stop and restart Tomcat.
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org