Here is my env:
Server version: Apache Tomcat/7.0.47
Server built:   Oct 18 2013 01:07:38
Server number:  7.0.47.0
OS Name:        Linux
OS Version:     2.6.32-358.el6.x86_64
Architecture:   amd64
JVM Version:    1.6.0_20-b02
JVM Vendor:     Sun Microsystems Inc.


The problem:
my application layout:
root
  |-/WEB-INF/web.xml
  |-/WEB-INF/classes
  |-/bar/index.jsp
  |-/META-INF
  |-/index.jsp


and In $CATALINA_BASE/conf/web.xml, a welcome-file-list was defined as:
<welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
</welcome-file-list>


I didn't mapping any servlet on the /bar.
So when I request http://127.0.0.1:8080/bar,
it was mapped to the default servlet, and get a 302 response.()
Like this:
#curl 127.0.0.1:8080/bar -v
* About to connect() to 127.0.0.1 port 8080 (#0)
*   Trying 127.0.0.1... connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /bar HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.6.0 
> zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 127.0.0.1:8080
> Accept: */*
> 
< HTTP/1.1 302 Found
< Server: Apache-Coyote/1.1
< Location: http://127.0.0.1:8080/bar/
< Transfer-Encoding: chunked
< Date: Tue, 30 Sep 2014 07:27:19 GMT
< 
* Connection #0 to host 127.0.0.1 left intact
* Closing connection #0


But when I further make a request to the http://127.0.0.1:8080/bar/ . A 404 was 
responsed, like
#curl 127.0.0.1:8080/bar/ -v
* About to connect() to 127.0.0.1 port 8080 (#0)
*   Trying 127.0.0.1... connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /bar/ HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.6.0 
> zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 127.0.0.1:8080
> Accept: */*
> 
< HTTP/1.1 404 Not Found
< Server: Apache-Coyote/1.1
< Content-Type: text/html;charset=utf-8
< Content-Language: en
< Content-Length: 949
< Date: Tue, 30 Sep 2014 07:27:22 GMT
< 
* Connection #0 to host 127.0.0.1 left intact
* Closing connection #0


I suggest that the /bar/index.jsp should be responsed for the welcome file 
mechanism.
But why i get a 404?



Reply via email to