2012/8/27 Ivan Polak <ivan.po...@f4s.sk>:
> On 26 August 2012 23:05, Konstantin Kolinko <knst.koli...@gmail.com> wrote:
>> 2012/8/27 Ivan Polak <ivan.po...@f4s.sk>:
>>> I have found, where is the problem.
>>>
>>> problem is in StandardContextValve.java in
>>>
>>> @Override
>>>     public final void invoke(Request request, Response response)
>>>         throws IOException, ServletException {
>>>
>>> ....
>>>
>>> // Select the Wrapper to be used for this Request
>>>         Wrapper wrapper = request.getWrapper();
>>>         if (wrapper == null || wrapper.isUnavailable()) {
>>>             response.sendError(HttpServletResponse.SC_NOT_FOUND);
>>>             return;
>>>         }
>>> .....
>>>
>>> if request is : http://localhost:8080/app/index.html (direct link to
>>> Spring MVC controller), object wrapper is not null,
>>>
>>> and if request is : http://localhost:8080/app/invitations/ (served by
>>> UrlRewrite filter), object wrapper is NULL!
>>>
>>> in CoyoteAdapter.java on line 649:
>>>
>>> request.setWrapper((Wrapper) request.getMappingData().wrapper);
>>>
>>> is set NULL.
>>>
>>
>> Can you stop top-posting?
>> http://en.wikipedia.org/wiki/Posting_style#Choosing_the_proper_posting_style
>>
>> What is your list of welcome files?
>>
>> How a wrapper can be null?
>> 1) For a directory path like yours,
>> the welcome files come into play and the servlet that serves them is
>> selected as the wrapper.
>> 2) There is always DefaultServlet (servlet mapped to "/") that is
>> selected when nothing else matches the request.
>>
>> When your breakpoint is on "if (wrapper == null ||
>> wrapper.isUnavailable()) {" line,
>> what is the value of the local variable "requestPathMB" ?
>>
>>
>>> request.setWrapper((Wrapper) request.getMappingData().wrapper);
>>
>> Mapping is performed in
>> org.apache.tomcat.util.http.mapper.Mapper#map(..) (there are two
>> public map() methods)
>>
>> Best regards,
>> Konstantin Kolinko
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>
>
> Hi,
>
> 1.
> local variable requestPathMB = null (in Tomcat 7.0.14 requestPathMB =
> "/invitations")
>
> 2. <welcome-file-list>
>                 <welcome-file>index.jsp</welcome-file>
>         </welcome-file-list>
>
> 3.
> As I wrote on the last mail, the problem is in
> StandardContextValve.java in method:
>
> public final void invoke(Request request, Response response)
>         throws IOException, ServletException {
>
> ...
> Wrapper wrapper = request.getWrapper();
> ...
>
> in Mapper class on line 988
>
> // Rule 7 -- Default servlet
>         if (mappingData.wrapper == null && !checkJspWelcomeFiles) {
>             if (contextVersion.defaultWrapper != null) {
>
> contextVersion.defaultWrapper is NULL.
>
> in Tomcat 7.0.14 (where everything is OK) is not null.
>
> in Mapper.java, on line 708, method:
>
> private final void internalMap(CharChunk host, CharChunk uri,
>             String version, MappingData mappingData) throws Exception {
>
> on line 725: contexts = hosts[pos].contextList.contexts;
>
> there are 2 contexts:
>
> 1. [0]:name="", versions.MapperContextVersion.defaultWrapper not null
> 2. [1]:name="app", versions.MapperContextVersion.defaultWrapper is null
>
> [in Tomcat 7.0.14, there are 2 contexts, too, but all have
> defaultWrapper not null]
>
> variable pos=1, context = contexts[pos];
>
> selected context has defaultWrapper null, variable
> contextVersion.defaultWrapper is null.
>
> Ivan
>

If you configure this web application with
<Context resourceOnlyServlets="" />

(Or, alternatively, you can add
org.apache.catalina.STRICT_SERVLET_COMPLIANCE=true
to catalina.properties or to CATALINA_OPTS),

does it give you the desired behaviour?

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to