Я развернул example.war
на Tomcat 6.0.32 (последний на момент написания), и развернутое веб-приложение содержит следующее:
$ find example | egrep -v "WEB-INF/lib|WEB-INF/classes"
example
example/_items.html
example/_share_link.html
example/all_items.html
example/images
example/images/ajax-loader.gif
example/index.html
example/item
example/item/star.html
example/item.html
example/js
example/js/c-jquery-1.4.2.js
example/js/c-jquery-ui-1.8.2.js
example/js/jquery-1.4.2.js
example/js/jquery-1.4.4.min.js
example/js/jquery-ui-1.8.2.js
example/js/jquery-ui-1.8.8.custom.min.js
example/js/jquery.blockUI.js
example/META-INF
example/META-INF/MANIFEST.MF
example/search.html
example/static
example/static/index.html
example/templates-hidden
example/templates-hidden/default.html
example/templates-hidden/wizard-all.html
example/WEB-INF
example/WEB-INF/web.xml
Особое примечание:
example/item
example/item/star.html
example/item.html
Я пытаюсь запросить вышеуказанный ресурс:
$ telnet localhost 8080
Trying ::1...
Connected to localhost.
Escape character is '^]'.
GET /example/item HTTP/1.0
HTTP/1.1 302 Moved Temporarily
Server: Apache-Coyote/1.1
Location: http://localhost:8080/example/item/
Date: Thu, 07 Apr 2011 08:24:39 GMT
Connection: close
Connection closed by foreign host.
Сервер сказал мне попробовать /example/item/
$ telnet localhost 8080
Trying ::1...
Connected to localhost.
Escape character is '^]'.
GET /example/item/ HTTP/1.0
HTTP/1.1 404 Not Found
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=6D97AD3A8F77697146163946B1BBBB64; Path=/example
Expires: Thu, 7 Apr 2011 08:24:58 UTC
Cache-Control: no-cache, private, no-store
Pragma: no-cache
Date: Thu, 07 Apr 2011 08:24:58 GMT
X-Lift-Version: 2.3
Content-Type: text/html;charset=utf-8
Content-Length: 106
Connection: close
<!DOCTYPE html>
<html> <body>The Requested URL /example/item/ was not found on this server</body> </html>
Connection closed by foreign host.
Это не то, что я ожидаю. Первый запрос к /example/item
(без завершающего слеша) должен сработать - на этом этапе веб-инфраструктура Lift вступает во владение и отображает мои элементы, используя star.html
в качестве шаблона. Это хорошо работает с Jetty 6.1.22 и Resin 4.0.16, но не с Tomcat.
Есть ли какая-то особая конфигурация, которую мне не хватает? Есть ли в спецификации сервлета что-то, что обозначает правильное поведение в этом случае?
Пример кода, который я использовал, можно найти здесь:
https://github.com/dpp/simply_lift/tree/master/samples/shopwithme
Я поднял оригинальный вопрос здесь:
https://groups.google.com/forum/?fromgroups#!topic/liftweb/7QlFud1ieOU
Примечание Этот вопрос не о Lift или его конвейере рендеринга, а о Tomcat, и почему его поведение отличается от Jetty и Resin.
<Ч />
ОБНОВЛЕНИЕ: Это классическая проблема "косой черты", и отчет об ошибке был подан здесь: https://issues.apache.org/bugzilla/show_bug.cgi?id=32424