You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (Resolved) (JIRA)" <ji...@apache.org> on 2012/02/20 22:19:35 UTC
[jira] [Resolved] (WICKET-4421) content type (mime type) detection
in ResourceStreamResource has false fallback
[ https://issues.apache.org/jira/browse/WICKET-4421?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Grigorov resolved WICKET-4421.
-------------------------------------
Resolution: Duplicate
This code has been improved in WICKET-4359 (1.5.5)
> content type (mime type) detection in ResourceStreamResource has false fallback
> -------------------------------------------------------------------------------
>
> Key: WICKET-4421
> URL: https://issues.apache.org/jira/browse/WICKET-4421
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.5.4
> Reporter: Johannes Unterstein
>
> the content type (or mime type) detectiong deliveres a wrong mime type, if the file name is set, but the mime type is not know from the application.
> ResourceStreamResource Line 148 and the followings:
> final String contentType;
> if (fileName != null && Application.exists())
> {
> contentType = Application.get().getMimeType(fileName);
> }
> else
> {
> contentType = stream.getContentType();
> }
> data.setContentType(contentType);
> When the mime type is not know from the application it is set to null and indifferent if the stream knows the correct mime type or not.
> I think the stream should be used as fallback if there is no mime type registered at the application, see:
> String contentType = null;
> if (fileName != null && Application.exists()) {
> contentType = Application.get().getMimeType(fileName);
> }
> if(contentType == null) {
> contentType = stream.getContentType();
> }
> data.setContentType(contentType);
> This solutions offers the benefit, that the user can provide the correct mime type through the ResourceStream.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira