You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Chris Merrill <ch...@webperformance.com> on 2012/03/15 16:44:46 UTC
ResourceStreamResource ignoring content-type of the ResourceStream
We ran into a puzzling bug in our app, that we eventually traced
down to this code in ResourceStreamResource:
if (fileName != null && Application.exists())
{
contentType = Application.get().getMimeType(fileName);
}
else
{
contentType = stream.getContentType();
}
This seems to conflict with the javadocs for IResourceStream.getContentType(),
which says:
* @return The mime type of this resource, such as "image/jpeg" or "text/html". Return null to
* let {@link ResourceStreamRequestHandler} handle the Content-Type automatically
The result is that if we create a ResourceStreamRequestHandler and give
it a filename in the constructor, it always ignores IResourceStream.getContentType().
We've been able to work around this another way, but I wanted to understand if we
are using these incorrectly or if this is a bug (either code or documentation)?
TIA!
Chris
--
------------------------------------------------------------------------ -
Chris Merrill | Web Performance, Inc.
chris@webperformance.com | http://webperformance.com
919-433-1762 | 919-845-7601
Web Performance: Website Load Testing Software & Services
------------------------------------------------------------------------ -
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: ResourceStreamResource ignoring content-type of the ResourceStream
Posted by Chris Merrill <ch...@webperformance.com>.
On 3/15/2012 11:47 AM, Martin Grigorov wrote:
> As simple as: upgrade to 1.5.5 ;-)
Doh! My co-worker is going to love this. He told me to upgrade before asking
this question :( Though he pointed me at 1.5.4 :>
Thanks!
> On Thu, Mar 15, 2012 at 5:44 PM, Chris Merrill <ch...@webperformance.com> wrote:
>> We ran into a puzzling bug in our app, that we eventually traced
>> down to this code in ResourceStreamResource:
>>
>> if (fileName != null && Application.exists())
>> {
>> contentType = Application.get().getMimeType(fileName);
>> }
>> else
>> {
>> contentType = stream.getContentType();
>> }
>>
>> This seems to conflict with the javadocs for IResourceStream.getContentType(),
>> which says:
>>
>> * @return The mime type of this resource, such as "image/jpeg" or "text/html". Return null to
>> * let {@link ResourceStreamRequestHandler} handle the Content-Type automatically
>>
>> The result is that if we create a ResourceStreamRequestHandler and give
>> it a filename in the constructor, it always ignores IResourceStream.getContentType().
>> We've been able to work around this another way, but I wanted to understand if we
>> are using these incorrectly or if this is a bug (either code or documentation)?
>>
>> TIA!
>> Chris
>>
>> --
>> ------------------------------------------------------------------------ -
>> Chris Merrill | Web Performance, Inc.
>> chris@webperformance.com | http://webperformance.com
>> 919-433-1762 | 919-845-7601
>>
>> Web Performance: Website Load Testing Software & Services
>> ------------------------------------------------------------------------ -
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
--
------------------------------------------------------------------------ -
Chris Merrill | Web Performance, Inc.
chris@webperformance.com | http://webperformance.com
919-433-1762 | 919-845-7601
Web Performance: Website Load Testing Software & Services
------------------------------------------------------------------------ -
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: ResourceStreamResource ignoring content-type of the ResourceStream
Posted by Martin Grigorov <mg...@apache.org>.
As simple as: upgrade to 1.5.5 ;-)
On Thu, Mar 15, 2012 at 5:44 PM, Chris Merrill <ch...@webperformance.com> wrote:
> We ran into a puzzling bug in our app, that we eventually traced
> down to this code in ResourceStreamResource:
>
> if (fileName != null && Application.exists())
> {
> contentType = Application.get().getMimeType(fileName);
> }
> else
> {
> contentType = stream.getContentType();
> }
>
> This seems to conflict with the javadocs for IResourceStream.getContentType(),
> which says:
>
> * @return The mime type of this resource, such as "image/jpeg" or "text/html". Return null to
> * let {@link ResourceStreamRequestHandler} handle the Content-Type automatically
>
> The result is that if we create a ResourceStreamRequestHandler and give
> it a filename in the constructor, it always ignores IResourceStream.getContentType().
> We've been able to work around this another way, but I wanted to understand if we
> are using these incorrectly or if this is a bug (either code or documentation)?
>
> TIA!
> Chris
>
> --
> ------------------------------------------------------------------------ -
> Chris Merrill | Web Performance, Inc.
> chris@webperformance.com | http://webperformance.com
> 919-433-1762 | 919-845-7601
>
> Web Performance: Website Load Testing Software & Services
> ------------------------------------------------------------------------ -
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org