Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2757

MimeType/ContentType detection in ResourceStreamRequestTarget unreliable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.4.6
    • 1.4.7, 1.5-M1
    • wicket
    • None
    • Wicket 1.4.0 in embedded Jetty

    Description

      With WICKET-356 the content type detection moved from the resoure stream to the ResourceStreamRequestTarget configure method.
      There the content type is detected with the following schema:
      1. If in stream a content type is set (deprecated) then use that one
      2. If on the stream a file name is set use the filename for detection
      3. Else use the request URL for detection.

      The last option is not reliable. In Line 230 we have the following code

      response.detectContentType(requestCycle, requestCycle.getRequest().getURL());

      I think it should be

      response.detectContentType(requestCycle, requestCycle.getRequest().getPath());

      In my case the request I have parameters attached to the Request URL like this.

      web/test.tif?sso=dsagdfgdsfhfg438efgkd549456

      And this is passed to the detectContentType() method and this fails because it expects a file name with a file extension.
      Using option 1. to fix this is working but is deprecated using option 2. and setting a file name does not work because it has the side effect to set the content disposition header

      I'm no wicket expert so I don't now if my suggested change will have side effects. But please consider fixing this.

      Thanks,

      • Bernd Rosstauscher

      Attachments

        Activity

          People

            ivaynberg Igor Vaynberg
            rossi Bernd Rosstauscher
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: