Capture browser request for resources and respond dynamically

Hi,
I have a requirement to capture the specific href browser request and respond to that requested resource dynamically without having that resource pre-exists in the application.

For example, we have the following CSS link in the application HTTP header

Here this foo.css file does not exists in the application, instead I want to generate this file content on the fly and return that generated foo.css for the request that was sent from the browser for the above href (may be by capturing the corresponding output steam and writing the foo.css content onto that).

Is it possible and how to achieve this in Vaadin?

thanks
dheeraj

Create an HttpServlet and pop its mapping in to your web.xml file.


  <servlet>
    <servlet-name>MyServlet</servlet-name>
    <display-name>MyServlet</display-name>
    <servlet-class>com.example.MyServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>MyServlet</servlet-name>
    <url-pattern>/mystyles/*</url-pattern>
  </servlet-mapping>