Servlet <welcome-file-list> overridden by Apache Tomcat welcome page?

 

Not sure I am using the proper name for what I am calling the "Apache
Tomcat welcome page".  What I am calling the "Apache Tomcat welcome
page" is the page that comes up when http://localhost:8080 is entered as
the address on an internet browser.

 

Windows 7 (development workstation)

Fedora 23 (web server)

Apache Tomcat 7.0.68

Apache TomEE 1.7.4

Eclipse Mars 2 (4.5.2)

 

I have a single instance of Tomcat.  CATALINA_BASE is not used, just
CATALINA_HOME.  The WEB-INF/web.xml has been configured as follows.

 

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns="http://java.sun.com/xml/ns/javaee";
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"; id="WebApp_ID"
version="3.0">

 

        <!-- ========================================================== -->

        <!-- General Info -->

        <!-- ========================================================== -->

    <display-name>Abc</display-name>

    <description>

           The web site for Abc software

    </description>

 

        <!-- ========================================================== -->

        <!-- Home Servlet -->

        <!-- ========================================================== -->

    <servlet>

       <servlet-name>HomeServlet</servlet-name>

       <servlet-class>software.Abc.website.HomeServlet</servlet-class>

       <load-on-startup>1</load-on-startup>

     </servlet>

 

        <!-- Map the HomeServlet name to the URI /HomeServlet (main page
for site) -->

     <servlet-mapping>

       <servlet-name>HomeServlet</servlet-name>

       <url-pattern>/AbcLandingPage</url-pattern>

     </servlet-mapping>

 

     <security-constraint>

         <web-resource-collection>

             <web-resource-name>Protect Donation page</web-resource-name>

             <url-pattern>/DonateServlet</url-pattern>

             <http-method>GET</http-method>

             <http-method>POST</http-method>       

         </web-resource-collection>

         <user-data-constraint>

             <transport-guarantee>CONFIDENTIAL</transport-guarantee>

         </user-data-constraint>

     </security-constraint> 

 

       

        <!-- ========================================================== -->

        <!-- Welcome Files -->

        <!-- ========================================================== -->

 

        <!-- The main page for the site will be the HomeServlet servlet
(http://website/AbcLandingPage) -->

        <!-- No mapping is defined for other folders
(http://website/someFolder/AbcLandingPage), -->

        <!-- so one of the other files will be displayed (index.html,
index.htm, index.jsp) -->

        <welcome-file-list>

            <welcome-file>AbcLandingPage</welcome-file>

            <welcome-file>index.html</welcome-file>

            <welcome-file>index.htm</welcome-file>

            <welcome-file>index.jsp</welcome-file>

        </welcome-file-list>

</web-app>

 

As per these instructions
(http://wiki.metawerx.net/wiki/HowToUseAServletAsYourMainWebPage) this
configuration should result in the HomeServlet being the first page
rendered when the URL http://myDomain.com is entered as the destination
address in an internet browser.  But these instructions are generic for
the Java Servlet 2.4 specification.  In this
(http://wiki.apache.org/tomcat/HowTo#How_do_I_override_the_default_home_page_loaded_by_Tomcat.3F)FAQ
for Tomcat it is suggest that meta tag refresh be used.  It seems the
Tomcat meta tag refresh instruction were written before the Java Servlet
2.4 specification was written because other research
(https://en.wikipedia.org/wiki/Meta_refresh) points out that the use of
the meta tag refresh method is gone out of use because it can prevent
the end user from being able to use the back button successfully and it
is considered as one of the Un-ethical SEO process by the Search
Engines.  The current version of the Java Servlet Specification is 3.0.
(https://jcp.org/aboutJava/communityprocess/final/jsr315/index.html). 

 

Question 1) Is my assumption correct that the reason my web.xml is not
working is because the Tomcat/Tomee welcome page is specified in such a
way that it takes precedence over the web.xml settings in my websites
.WAR file?

 

Question 2) Is there a way to have my .WAR file WEB-INF/web.xml take
precedence over the Tomcat welcome page without uninstalling the Tomcat
welcome page?


 

 

 

 

 

Reply via email to