Improve ResourceStreamResource api

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Improve ResourceStreamResource api

Jonas-21
Hi all,

I'd like to propose an improvement of
org.apache.wicket.request.resource.ResourceStreamResource: it is currently
quite hard to determine the IResourceStream inside the #getResourceStream
method, as the relevant context (i.e. the Attributes object) isn't
available. Of course it is possible to override #newResourceResponse to get
access to Attributes, but the resulting code feels quite clumsy. I propose
to pass the Attributes from #newResourceResponse into
#internalGetResourceStream and finally into #getResourceStream.
This of course breaks the current API, so I guess this would be something
for Wicket 8.

To put this in context, what we're doing is basically described in
http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ , except
we don't extend DynamicImageResource, where you would have to handle mime
type etc. in your subclass. By extending ResourceStreamResource, mime type
etc. is handled by automatically.

What do you think?

Cheers,

Jonas
Reply | Threaded
Open this post in threaded view
|

Re: Improve ResourceStreamResource api

Martin Grigorov-4
Hi,

I think this would be a good improvement for Wicket 8.x.
Please file a ticket in JIRA!
Thank you!

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Mar 1, 2016 at 10:44 AM, Jonas <[hidden email]> wrote:

> Hi all,
>
> I'd like to propose an improvement of
> org.apache.wicket.request.resource.ResourceStreamResource: it is currently
> quite hard to determine the IResourceStream inside the #getResourceStream
> method, as the relevant context (i.e. the Attributes object) isn't
> available. Of course it is possible to override #newResourceResponse to get
> access to Attributes, but the resulting code feels quite clumsy. I propose
> to pass the Attributes from #newResourceResponse into
> #internalGetResourceStream and finally into #getResourceStream.
> This of course breaks the current API, so I guess this would be something
> for Wicket 8.
>
> To put this in context, what we're doing is basically described in
> http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ , except
> we don't extend DynamicImageResource, where you would have to handle mime
> type etc. in your subclass. By extending ResourceStreamResource, mime type
> etc. is handled by automatically.
>
> What do you think?
>
> Cheers,
>
> Jonas
>
Reply | Threaded
Open this post in threaded view
|

Re: Improve ResourceStreamResource api

Jonas-21
Hi,

here's the JIRA ticket: https://issues.apache.org/jira/browse/WICKET-6113

Thanks!

Jonas


On Tue, Mar 1, 2016 at 12:02 PM, Martin Grigorov <[hidden email]>
wrote:

> Hi,
>
> I think this would be a good improvement for Wicket 8.x.
> Please file a ticket in JIRA!
> Thank you!
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Tue, Mar 1, 2016 at 10:44 AM, Jonas <[hidden email]> wrote:
>
> > Hi all,
> >
> > I'd like to propose an improvement of
> > org.apache.wicket.request.resource.ResourceStreamResource: it is
> currently
> > quite hard to determine the IResourceStream inside the #getResourceStream
> > method, as the relevant context (i.e. the Attributes object) isn't
> > available. Of course it is possible to override #newResourceResponse to
> get
> > access to Attributes, but the resulting code feels quite clumsy. I
> propose
> > to pass the Attributes from #newResourceResponse into
> > #internalGetResourceStream and finally into #getResourceStream.
> > This of course breaks the current API, so I guess this would be something
> > for Wicket 8.
> >
> > To put this in context, what we're doing is basically described in
> > http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ ,
> except
> > we don't extend DynamicImageResource, where you would have to handle mime
> > type etc. in your subclass. By extending ResourceStreamResource, mime
> type
> > etc. is handled by automatically.
> >
> > What do you think?
> >
> > Cheers,
> >
> > Jonas
> >
>