You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jonas <ba...@gmail.com> on 2016/03/01 10:44:01 UTC

Improve ResourceStreamResource api

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

Re: Improve ResourceStreamResource api

Posted by Jonas <ba...@gmail.com>.
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 <mg...@apache.org>
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 <ba...@gmail.com> 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
> >
>

Re: Improve ResourceStreamResource api

Posted by Martin Grigorov <mg...@apache.org>.
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 <ba...@gmail.com> 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
>