tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Polak <ivan.po...@f4s.sk>
Subject Re: problem with filters on Tomcat 7.0.16 and above
Date Sat, 25 Aug 2012 20:46:20 GMT
thank you for your answer.

"invitations" is served by a filter and translated from
http://localhost:8080/app/invitations/ to Spring MVC controller, in
urlrewrite filter configuration is:

<rule>
        <note></note>
        <from>/invitations/(.*)</from>
        <to>/invitations.html</to>
    </rule>

and in Spring MVC configuration is:

<bean id="urlMapping"
		class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
			<props>
				<prop key="/invitations.html">invitationsController</prop>
......

after Iset logEffectiveWebXml="true" on <Context> in META-INF in my
application, I have this messages in log file:

......
INFO: web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0"
         metadata-complete="true">

  <display-name>app</display-name>
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-valuee>/WEB-INF/applicationContext.xml
            /WEB-INF/applicationContext-services.xml
            /WEB-INF/applicationContext-resources.xml
            /WEB-INF/applicationContext-mail.xml
            /WEB-INF/applicationContext-business.xml
            /WEB-INF/applicationContext-security.xml
            /WEB-INF/applicationContext-quartz.xml</param-valuee>
  </context-param>

  <filter>
    <filter-name>UrlRewriteFilter</filter-name>
    <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
    <async-supported>false</async-supported>
  </filter>
  <filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <async-supported>false</async-supported>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>UTF-8</param-value>
    </init-param>
    <init-param>
      <param-name>forceEncoding</param-name>
      <param-value>true</param-value>
    </init-param>
  </filter>
  <filter>
    <filter-name>messageFilter</filter-name>
    <filter-class>org.skynetframework.core.filter.MessageFilter</filter-class>
    <async-supported>false</async-supported>
  </filter>

  <filter-mapping>
    <filter-name>UrlRewriteFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
  </filter-mapping>
  <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>messageFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
  </filter-mapping>

  <servlet>
    <servlet-name>jsp</servlet-name>
    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
    <init-param>
      <param-name>fork</param-name>
      <param-value>false</param-value>
    </init-param>
    <init-param>
      <param-name>xpoweredBy</param-name>
      <param-value>false</param-value>
    </init-param>
    <load-on-startup>3</load-on-startup>
  </servlet>
  <servlet>
    <servlet-name>default</servlet-name>
    <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
    <init-param>
      <param-name>debug</param-name>
      <param-value>0</param-value>
    </init-param>
    <init-param>
      <param-name>listings</param-name>
      <param-value>false</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet>
    <servlet-name>apps</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/app-servlet.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet>
    <servlet-name>pluploadServlet</servlet-name>
    <servlet-class>info.app.servlet.servlets.upload.PluploadServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jsp</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.gif</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.jpg</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>apps</servlet-name>
    <url-pattern>*.html</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.png</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jspx</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.css</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.js</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>pluploadServlet</servlet-name>
    <url-pattern>/upload</url-pattern>
  </servlet-mapping>

  <session-config>
    <session-timeout>30</session-timeout>
    <cookie-config>
    </cookie-config>
  </session-config>

  <mime-mapping>
.....


thanks

Ivan

On 25 August 2012 16:34, Konstantin Kolinko <knst.kolinko@gmail.com> wrote:
> 2012/8/25 Ivan Polak <ivan.polak@f4s.sk>:
>> Hi!
>>
>> Recently, we have migrated my web app from Tomcat 6.0.16 to Tomcat
>> 7.0.29. The application works fine for most of the part but gives
>> problem with URLRewriteFilter. I am using URLRewriteFilter version
>> 4.0.5.
>>
>> In tomcat 6.0.16 everything is OK,
>>
>> URLRewriteFilter has status information page on
>> http://localhost:8080/app/rewrite-status/, with Tomcat 6.0.16 is OK,
>> but in tomcat 7.0.16 and above, this page show HTTP Status 404 tomcat
>> error screen.
>>
>> I use tomcat in eclipse, with debug mode (URLRewriteFilter parameter
>> logLevel=DEBUG), in console there all messages (the same messages as
>> with tomcat 6.0.16), so the filter is started correctly.
>>
>>     INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: about to parse
>> conf 24.8.2012 20:09:56 org.apache.catalina.core.ApplicationContext
>> log
>>     INFO: org.tuckey.web.filters.urlrewrite.ConfHandler
>>     DEBUG: Resolving to DTD
>> /org/tuckey/web/filters/urlrewrite/dtds/urlrewrite4.0.dtd 24.8.2012
>> 20:09:56 org.apache.catalina.core.ApplicationContext log
>>     INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: now
>> initialising conf 24.8.2012 20:09:56
>> org.apache.catalina.core.ApplicationContext log
>>     INFO: org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: loaded
>> rule Rule 0 (/test/status/, %{context-path}/rewrite-status 0)
>>
>> with Tomcat 7.0.16 and above there are problem with defined filters in web.xml.
>>
>> <filter>
>>                 <filter-name>UrlRewriteFilter</filter-name>
>>                 <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
>> </filter>
>>
>>         <filter-mapping>
>>                 <filter-name>UrlRewriteFilter</filter-name>
>>                 <url-pattern>/*</url-pattern>
>>                 <dispatcher>REQUEST</dispatcher>
>>                 <dispatcher>FORWARD</dispatcher>
>>         </filter-mapping>
>>
>> in Tomcat 7.0.10, 7.0.11, 7.0.12, 7.0.14 is everything OK,
>>
>> but in Tomcat 7.0.16 and above, method:
>>
>> public void doFilter(final ServletRequest request, final
>> ServletResponse response, final FilterChain chain)
>>             throws IOException, ServletException {
>>
>> in filter is called on welcome-screen
>> (http://localhost:8080/app/index.html), but when I click on link
>> http://localhost:8080/app/invitations/, method doFilter is not called.
>>
>> the same situation is with others filters defined in web.xml.
>>
>
> 1. Is "invitations" a subdirectory in your application? (Is Tomcat
> looking for a welcome file there?) Or it is served by a servlet, or by
> a filter?
>
> 2. Can you reproduce this with the standard "examples" webapp?
>
> 3. Try to dump "merged web.xml": set logEffectiveWebXml="true" on <Context>
> and look for filter and filter-mapping elements there. What is their order?
> http://tomcat.apache.org/tomcat-7.0-doc/config/context.html
>
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

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


Mime
View raw message