tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Tomcat Wiki] Update of "HowTo" by KonstantinKolinko
Date Wed, 30 Jan 2013 00:02:39 GMT
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 KonstantinKolinko:
http://wiki.apache.org/tomcat/HowTo?action=diff&rev1=119&rev2=120

Comment:
Remove suggestion of replacing the default servlet. It is irrelevant to the issue. Correct
links.

  
  Just by doing this, you have already made you webapp into the Tomcat ''default webapp''.
  
- 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:
- 
- {{{
-    <servlet>
-         <servlet-name>My First Servlet</servlet-name>
-         <servlet-class>my.Servlet.Number1</servlet-class>
-     </servlet>
- 
-     <servlet-mapping>
-         <servlet-name>My First Servlet</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.
  
  '''Addendum 1 : If you are deploying your application as a war file..'''
  
  The above instructions relate to the situation where you are "manually" deploying your application
as a directory-and-files structure under the /webapps directory.  If instead you are using
the "war" method to deploy your application, the principle is about the same :<<BR>>
- delete the ROOT directory<<BR>> - name your war file "ROOT.war" (capitals mandatory)<<BR>>
- drop the ROOT.war file directly in the /webapps directory.<<BR>> Tomcat will
automatically deploy it.
  
- For more information about this topic in general, consult this page :  [[http://tomcat.apache.org/tomcat-6.0-doc/config/context.html|The
Context Container]]
+ For more information about this topic in general, consult this page :  [[http://tomcat.apache.org/tomcat-7.0-doc/config/context.html|"Configuration
Reference / Context"]]
  
  '''Addendum 2 : If for some reason you want another method..'''
  
- If, for some reason, you do not want to deploy your application under the CATALINA_BASE/webapps/ROOT
subdirectory, or you do not want to name your war-file "ROOT.war", then read on.  But you
should first read this : [[http://tomcat.apache.org/tomcat-6.0-doc/config/context.html|The
Context Container]] and make sure you understand the implications.
+ If, for some reason, you do not want to deploy your application under the CATALINA_BASE/webapps/ROOT
subdirectory, or you do not want to name your war-file "ROOT.war", then read on.  But you
should first read this : [[http://tomcat.apache.org/tomcat-7.0-doc/config/context.html|"Configuration
Reference / Context"]] and make sure you understand the implications.
  
  The method described above is the simple method.  The two methods below are more complex,
and the second one has definite implications on the way you manage and run your Tomcat.
  

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


Mime
View raw message