I'm tempted to say no.

Because you might be adding a "/" in front of your servlet mapping.

In other words, changing the path of the folder slightly, with a different 
relative path.

________________________________
From: Jeffrey Janner [mailto:jeffrey.jan...@polydyne.com]
Sent: Tuesday, April 23, 2013 2:29 PM
To: 'Tomcat Users List'
Subject: Question on servlet determination

Running Tomcat 6.0.36, JDK 1.6.0_43

I've an application defined with the following web.xml:

<web-app>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Everything</web-resource-name>
      <url-pattern>*.jsp</url-pattern>
      <url-pattern>*.html</url-pattern>
      <url-pattern>*.js</url-pattern>
      <url-pattern>/Servlet1</url-pattern>
      <url-pattern>/Servlet2</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
      <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
  </security-constraint>
  <resource-ref>
    <description>Oracle Universal Connection Pool</description>
    <res-ref-name>jdbc/oracleUCPPool</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>
  <servlet>
    <servlet-name>Servlet1</servlet-name>
    <display-name>Servlet1</display-name>
    <description>Controlling servlet for Servlet1</description>
    <servlet-class>com.polydyne.servlet1</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet>
    <servlet-name>Servlet2</servlet-name>
    <display-name>Servlet2</display-name>
    <description>Controlling servlet for Servlet2</description>
    <servlet-class>com.polydyne.servlet2</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Servlet1</servlet-name>
    <url-pattern>/Servlet1</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>Servlet2</servlet-name>
    <url-pattern>/Servlet2</url-pattern>
  </servlet-mapping>
  <error-page>
     <error-code>404</error-code>
     <location>/Unavailable.jsp</location>
  </error-page>
</webapp>

The issue:  If I connect with the URL: http://myhost/Servlet1 (or Servlet2), I 
get what I expect.  However, if I connect http://myhost/Servlet1/ then I get a 
404.  Actually, I get my 404 page but not all the graphics come over.

Shouldn't the final / be stripped and I get the same behavior either way?

Also willing to entertain critiques on my security-constraint section, but not 
that we don't use Tomcat authentication, so I want any requests for top-level 
files in the Web directory to also force https.

Jeffrey Janner
Sr. Network Administrator
jeffrey.jan...@polydyne.com<mailto:first.l...@polydyne.com>
PolyDyne Software Inc.
Main:   512.343.9100
Direct:  512.583.8930

 [cid:image002.png@01CC0FB7.4FF43CE0]

Speed, Intelligence & Savings in Sourcing

Reply via email to