Chapter 15: Shared Tomcat Hosting IP-Based Virtual Hosting
Chapter 15: Shared Tomcat Hosting IP-Based Virtual Hosting in Tomcat, the getLocalName() method is used by Tomcat to map the request to a (virtual) host. Feel free to change these setup details for example, modifying the contents of the JSP or including additional Web application contexts to suit the server hosting policy required. Tomcat as a Standalone Server Figure 15-2 illustrates the relationship between the various components of Tomcat when Tomcat is being used as a standalone server. The Tomcat process HTTP connection handler Request Response Contexts Web client VHost 1 VHost 2 VHost n … other contexts Figure 15-2: Tomcat handling a request for a virtual host Name-Based Virtual Hosting in Tomcat In Figure 15-2 , the Web client directly sends the HTTP request to the Tomcat process listening at (default) port 8080. The HTTP Connector handles the Web client interaction. Tomcat then takes a look at the Host: header present in the HTTP request. If one is present, it tries to look up a virtual host with a name matching the one requested. If such a virtual host is found, the context parameter of the virtual host is taken and merged with the context parameters of the default configuration, and the file served accordingly. The resultant output is sent back to the Web client using the HTTP Connector again. If no context with the given virtual host is found, Tomcat tries to match the context path to the contexts that do not belong to any virtual hosts. If one is found, that context is used to send back the results. If no such context is found, either the default (with the empty context path) context is used to send back the result (in which case, the context path is matched to a physical directory or file name) or an HTTP 404 error is generated and sent back to the client. Adding a virtual host is as simple as adding an
If you looking for unlimited one inclusive web hosting plan please check web hosting plan website.