1

I have this filter that is not getting triggered (perhaps due to the welcome-file)

<filter>
    <filter-name>gwtCacheControlFilter</filter-name>
    <filter-class>com.me.server.GWTCacheControlFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>gwtCacheControlFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

Where the welcome-file is defined:

<welcome-file-list>
    <welcome-file>app.html</welcome-file>
</welcome-file-list>

When localhost:8080 is access it automatically returns the app.html. I cannot remove that welcome-file as I need that when the site is accessed it will automatically show the home page.

What can be a work around for this scenario to make the Filter work?

quarks
  • 33,478
  • 73
  • 290
  • 513
  • I cannot reproduce this. What evidence do you have that the request doesn't pass through your `GWTCacheControlFilter`? – Sotirios Delimanolis Mar 16 '15 at 14:31
  • I placed a LOG into the doHandle and its not showing when I access the root path, but when I access like /stuff or /stuff/stuff it works – quarks Mar 16 '15 at 14:49
  • Your filter needs a path to be triggered. But when you enter `http://128.0.0.1` the filter does not match. It expects a leading `/`. – Hannes Mar 16 '15 at 21:02

1 Answers1

0

Write a redirect jsp and use it as welcome page.

<welcome-file-list> 
   <welcome-file>index.jsp</welcome-file> 
</welcome-file-list> 

See Redirect pages in JSP?

Community
  • 1
  • 1
Hannes
  • 2,018
  • 25
  • 32
  • @xybrek AFAIK is the welcome page handled as forward when accessing the host without path. So first you filter is not triggered and the forward will be handled internally so no filter trigger. But the rediect is client side so your filter will be triggered when the client follows the redirect. – Hannes Mar 16 '15 at 18:08