Women in Technology

Hear us Roar



Article:
  Two Servlet Filters Every Web Application Should Have
Subject:   MIME types and Servlets that generate binary data
Date:   2003-12-12 14:58:19
From:   jfalkner
Response to: MIME types and Servlets that generate binary data

True, but a good point is that you can map your servlet to both "MyServlet.jpg" and "MyServlet.png", then use the correct URL based on if you want a JPG or a PNG -- same for other extensions and MIME types. I'd argue this is the way you should do dynamic images/content unless you really must do it a different way.
Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • MIME types and Servlets that generate binary data
    2004-01-26 21:45:24  jleech [View]

    But isn't it a goal to make the filters as easy as possible to retrofit to existing applications? Sure, you could go in, add the filters, change lots of links to accomodate them, and add lines of code to web.xml to map everything -- Or just cache the response headers along with the rest of the response and everything is much simpler.
    Here's a real-world example of a situation where your suggestion wouldn't work -- and you really must do it a different way: A web form that lets the user input a bunch of parameters, including ouput format, e.g. { .pdf, .xml, .csv, .html }.
    The only compelling reason I can see to use extensions on the URLs for the content is to satisfy really old, broken versions of Internet Explorer. And you can trick them anyway by appending ?.pdf or &.pdf to the URL...