27e7 The Invoker
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
The Invoker

Waiter at PortsmouthWho, what or where is the Invoker? There are web sites that have a lot of pages on them, none of which is served up all that often, and there are other web sites which only host a few web applications,each of which is run in a container service such as Catalina within Tomcat. In the first case, the web site developer / maintainer wants to simply add extra pages to the appropriate directory and have them appear at their own URLs, but in the latter case (s)he will usually want to specifically point individual URLs at individual applications. And on Tomcat, this is done though the web.xml file.

But just occasionally under Tomcat, there's a requirement to be able to copy a Class that contains a servlet on the web server, and have it available straight away - no mucking about with web.xml. For example, I'm training systems administrators who will be looking after a system used by Java classes (University ones, not ours!) this week, and their students need to be able to upload a class that contains a servlet, and with minimal fuss and editing, test it on the server. This is where the Invoker comes in.

To enable the invoker ... in the administrator's main web application configuration file (also called web.xml, but in the conf directory), remove the comments that disable the Invoker in the sample file supplied with the Tomcat distribution. That extra code comes in two sections - one to define what the invoker IS and and other to define how it MAPS - and you need them both. Then kick [restart] your Tomcat.

To use the invoker for a new Servlet ... place the class file in the WEB-INF/classes subdirectory of your web application, and visit it via a URL of the form:
http://www.sitename.org.uk/webappname/servlet/Whichone
where webappname is the name of your web application (directory name in the webapps folder) and Whichone is the class name - i.e. the file is called Whichone.class. The word "servlet" is 'hard coded' in the web.xml file - you can change it server-wide if you wish!


We go through all of this (and much, much more!) on our Deploying Apache httpd / Tomcat course. Illustration - a waiter at Gun Wharf in Portsmouth
(written 2009-02-13, updated 2009-02-15) 209e

 
Associated topics are indexed under
A654 - Web Application Deployment - Configuring and Controlling Tomcat
  [3043] Gathering information - logging - with log4j. First steps. - (2010-11-12)
  [2652] Reading and writing cookies in Java Servlets and JSPs - (2010-02-26)
  [2163] CATALINA_OPTS v JAVA_OPTS - What is the difference? - (2009-05-09)
  [2061] Tomcat 6 - Annotated Sample Configuration Files - (2009-03-01)
  [1994] tomcat-users.xml; what a difference a space made - (2009-01-16)
  [1943] Port and Glasses - (2008-12-14)
  [1762] WEB-INF (Tomcat) and .htaccess (httpd) - (2008-08-20)
  [1553] Automatic startup and shutdown of Tomcat - (2008-02-24)
  [1503] Web page (http) error status 405 - (2008-01-12)
  [1370] Apache Tomcat Performance Tuning - (2007-09-29)
  [1351] Compressing web pages sent out from server. Is it worth it? - (2007-09-14)
  [914] A practical example of roles - (2006-11-04)
  [907] Browser -> httpd -> Tomcat -> MySQL. Restarting. - (2006-10-28)
  [837] Tomcat - Shutdown port - (2006-08-18)


Back to
Sticky Sessions with mod_jk (httpd to Tomcat)
Previous and next
or
Horse's mouth home
Forward to
Error: Cant read xxxxx: no such variable (in Tcl Tk)
Some other Articles
Confidence, Customer Service and Tourism in Melksham
Wiltshire Rail Service Update
httpd, Tomcat and PHP course enhancements
Error: Cant read xxxxx: no such variable (in Tcl Tk)
The Invoker
Sticky Sessions with mod_jk (httpd to Tomcat)
The Interview and The Lift
Java Tag Libraries / how they work / Tomcat Deployment
1234567890 ... coming up on Friday 13th
Through Snow and Flood to Linux and Tomcat
4090 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page
b93

© WELL HOUSE CONSULTANTS LTD., 2013: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/2039_The-Invoker.html • PAGE BUILT: Sat Feb 23 12:39:13 2013 • BUILD SYSTEM: wizard
0