0

How to tell web.xml that it should not handle .htc files and so leave them to the web server?

How can I do that ?

I am using Vaadin and it's servlet gets all requests, but I really need to serve a .htc file to fix IE(Dawn you Microsoft) corners and make them look better.

How to do that ?

Vaadin Servlet Mapping

>     <servlet-mapping>
>         <servlet-name>vaadinServlet</servlet-name>
>         <url-pattern>/*</url-pattern>
>     </servlet-mapping>

Servlet

>   <servlet>
>       <servlet-name>vaadinServlet</servlet-name>
>       <servlet-class>com.vaadin.terminal.gwt.server.GAEApplicationServlet</servlet-class>
    <init-param>
>           <description>
>           Application widgetset</description>
>           <param-name>widgetset</param-name>
>           <param-value>web.googlemapwidget.Widgetset</param-value>
>       </init-param>   </servlet>
Cristiano Fontes
  • 4,920
  • 6
  • 43
  • 76

1 Answers1

1
<servlet-mapping>
    <servlet-name>vaadinServlet</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>default</servlet-name>
    <!-- servlet-name>staticServlet</servlet-name --> <!-- removed as suggested by raymi -->
    <url-pattern>/*.htc</url-pattern>
</servlet-mapping>

Notice that the url-pattern for vaadinServlet is changed from /* to /, which is the default mapping. It means if no other pattern is matched then use this servlet. Here is a quick reference I wrote about the url pattern mapping.

You will need to define your static servlet. This depends on your servlet container. For tomcat,
<!-- removed as suggested by raymi -->
<!--servlet>
    <servlet-name>staticServlet</servlet-name>
    <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
</servlet-->

In case you do not want your staticServlet to depends on the servlet containter, read this.

Community
  • 1
  • 1
gigadot
  • 8,879
  • 7
  • 35
  • 51
  • 1
    I think there's no need to define the static servlet for tomcat in your web.xml, since it's already defined in the default web.xml (which you can find at `/conf/web.xml`) as `default`. So you can simply map to `default`. – raymi Jul 08 '11 at 15:08
  • Thank you @raymi . Does the `default` servlet name exist for all servlet containers? – gigadot Jul 08 '11 at 15:11