You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by smallufo <sm...@gmail.com> on 2013/04/24 17:54:40 UTC
[6.7] How to set header of DynamicImageResource ?
Hi :
I wonder how to set header of DynamicImageResource ?
In 1.4 , it just override setHeaders(WebResponse response)
{
response.setHeader("Cache-Control" , "no-cache");
}
But , how to do this in 6.7 ?
If I override setResponseHeaders(ResourceResponse data , Attributes
attributes) ,
It seems there are two ways to setHeader :
data.getHeaders().addHeader("Cache-Control", "no-cache");
and
((WebResponse) attributes.getResponse()).addHeader("Cache-Control" ,
"no-cache");
Which is correct ?
And...
in 1.4 , there is an "isCacheable()" method , where is it in 6.7 ?
Thanks .
Re: [6.7] How to set header of DynamicImageResource ?
Posted by vineet semwal <vi...@gmail.com>.
adding header in data.getHeaders() appears better to me according to code
flow in AbstractResource
On Thu, Apr 25, 2013 at 2:15 AM, vineet semwal <vi...@gmail.com>wrote:
> both does the same thing ,however there are some internal headers so take
> a look at them in AbstractResource,if your header is one of those you can't
> use it manually
>
>
> On Thu, Apr 25, 2013 at 1:24 AM, smallufo <sm...@gmail.com> wrote:
>
>> Hi
>> I just take "Cache-Control":"no-cache" for example.
>> What if I want to add additional header information, which is correct ?
>>
>> data.getHeaders().addHeader("key", "value"); ?
>> or
>> ((WebResponse) attributes.getResponse()).addHeader("key" , "value"); ?
>>
>> Thanks.
>>
>
>
>
> --
> regards,
>
> Vineet Semwal
>
--
regards,
Vineet Semwal
Re: [6.7] How to set header of DynamicImageResource ?
Posted by vineet semwal <vi...@gmail.com>.
both does the same thing ,however there are some internal headers so take a
look at them in AbstractResource,if your header is one of those you can't
use it manually
On Thu, Apr 25, 2013 at 1:24 AM, smallufo <sm...@gmail.com> wrote:
> Hi
> I just take "Cache-Control":"no-cache" for example.
> What if I want to add additional header information, which is correct ?
>
> data.getHeaders().addHeader("key", "value"); ?
> or
> ((WebResponse) attributes.getResponse()).addHeader("key" , "value"); ?
>
> Thanks.
>
--
regards,
Vineet Semwal
Re: [6.7] How to set header of DynamicImageResource ?
Posted by smallufo <sm...@gmail.com>.
Hi
I just take "Cache-Control":"no-cache" for example.
What if I want to add additional header information, which is correct ?
data.getHeaders().addHeader("key", "value"); ?
or
((WebResponse) attributes.getResponse()).addHeader("key" , "value"); ?
Thanks.
Re: [6.7] How to set header of DynamicImageResource ?
Posted by vineet semwal <vi...@gmail.com>.
as far as i can see this is the default behavior for DynamicImageResource
so you don't need it ,other wise call disableCaching() ,
i don't remember 1.4 now but you can have your isNotCachable() ,it's very
simple check if getCacheduration is none/zero else there is
boolean dataNeedsToBeWritten(attributes)
On Wed, Apr 24, 2013 at 9:24 PM, smallufo <sm...@gmail.com> wrote:
> Hi :
> I wonder how to set header of DynamicImageResource ?
> In 1.4 , it just override setHeaders(WebResponse response)
> {
> response.setHeader("Cache-Control" , "no-cache");
> }
>
> But , how to do this in 6.7 ?
>
> If I override setResponseHeaders(ResourceResponse data , Attributes
> attributes) ,
> It seems there are two ways to setHeader :
>
> data.getHeaders().addHeader("Cache-Control", "no-cache");
> and
> ((WebResponse) attributes.getResponse()).addHeader("Cache-Control" ,
> "no-cache");
>
> Which is correct ?
>
> And...
> in 1.4 , there is an "isCacheable()" method , where is it in 6.7 ?
>
> Thanks .
>
--
regards,
Vineet Semwal