You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Mauro Ciancio <ma...@gmail.com> on 2010/10/31 00:11:35 UTC

If-Modified-Since header

Hello everyone:

I've been trying to get properly working the caching in my site's
resources using the if-modified-since header. I've noticed that the
check for the header is only done if the resource is mounted under the
'/resources' url (wicket filter @ line 1130, Wicket 1.4).

My resources are mounted under another url ('/photos'). I was
wondering why the check is restricted to that url. Also, I've tried to
mount my resources under /resources/photos but I get an exception that
says 'cannot be mounted under /resources'.

Any advices?
Thanks in advance.
-- 
Mauro Ciancio

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: If-Modified-Since header

Posted by Mauro Ciancio <ma...@gmail.com>.
Sorry for bringing up this thread, but I'm still looking for advices.
Should I implement this or Wicket can do it for me?

Regards.

On Sun, Oct 31, 2010 at 2:11 PM, Mauro Ciancio <ma...@gmail.com> wrote:
> Hi Martin,
>
> I didn't explain myself very well. I'm using wicket resources, I
> inherited from WebResource and implemented the abstract methods.
>
> Also, I mounted the resources using the following code:
>
> String resourceKey = "photos";
> String alias = "photos"
>
> SharedResources sharedResources = application.getSharedResources();
> sharedResources.putClassAlias(MyWebResource.class, alias);
> sharedResources.add(MyWebResource.class, resourceKey, null, null, new
> MyWebResource());
> webApplication.mount(new
> IndexedSharedResourceCodingStrategy("/photos", alias + "/" +
> resourceKey));
>
> So, I get the pretty urls I wanted. My resources gets mounted at
> "domain.com/photos/my/parameters" and according to the parameters I
> serve differents photos.
>
> Once the photos are uploaded they never change, so I'd like the photos
> be cached. I'm expecting to get a 304 not modified, but the
> If-Modified-Since header is ignored because of the mount path is not
> under '/resources'.
>
> Is this clearer?
> Should I implement the checking for the header or it's supposed that
> wicket could do that for me?
>
> Thanks in advance.
> Regards.
>
> On Sun, Oct 31, 2010 at 6:15 AM, Martin Grigorov <mg...@apache.org> wrote:
>> Hi Mauro,
>>
>> /resources is a special path managed by Wicket, e.g.
>> ResourceReference(MyComponent.class, "myImage.gif") will be reachable at
>> /resources/com.mypackage.MyComponent/myImage.gif
>>
>> Resources which are put in next to WEB-INF folder are not managed by WIcket
>> and they are served directly by the web container
>> Take a look at http://code.google.com/p/wro4j/
>>
>> On Sun, Oct 31, 2010 at 1:11 AM, Mauro Ciancio <ma...@gmail.com>wrote:
>>
>>> Hello everyone:
>>>
>>> I've been trying to get properly working the caching in my site's
>>> resources using the if-modified-since header. I've noticed that the
>>> check for the header is only done if the resource is mounted under the
>>> '/resources' url (wicket filter @ line 1130, Wicket 1.4).
>>>
>>> My resources are mounted under another url ('/photos'). I was
>>> wondering why the check is restricted to that url. Also, I've tried to
>>> mount my resources under /resources/photos but I get an exception that
>>> says 'cannot be mounted under /resources'.
>>>
>>> Any advices?
>>> Thanks in advance.
>>> --
>>> Mauro Ciancio
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>
>
>
> --
> Mauro Ciancio
>



-- 
Mauro Ciancio

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: If-Modified-Since header

Posted by Mauro Ciancio <ma...@gmail.com>.
Hi Martin,

I didn't explain myself very well. I'm using wicket resources, I
inherited from WebResource and implemented the abstract methods.

Also, I mounted the resources using the following code:

String resourceKey = "photos";
String alias = "photos"

SharedResources sharedResources = application.getSharedResources();
sharedResources.putClassAlias(MyWebResource.class, alias);
sharedResources.add(MyWebResource.class, resourceKey, null, null, new
MyWebResource());
webApplication.mount(new
IndexedSharedResourceCodingStrategy("/photos", alias + "/" +
resourceKey));

So, I get the pretty urls I wanted. My resources gets mounted at
"domain.com/photos/my/parameters" and according to the parameters I
serve differents photos.

Once the photos are uploaded they never change, so I'd like the photos
be cached. I'm expecting to get a 304 not modified, but the
If-Modified-Since header is ignored because of the mount path is not
under '/resources'.

Is this clearer?
Should I implement the checking for the header or it's supposed that
wicket could do that for me?

Thanks in advance.
Regards.

On Sun, Oct 31, 2010 at 6:15 AM, Martin Grigorov <mg...@apache.org> wrote:
> Hi Mauro,
>
> /resources is a special path managed by Wicket, e.g.
> ResourceReference(MyComponent.class, "myImage.gif") will be reachable at
> /resources/com.mypackage.MyComponent/myImage.gif
>
> Resources which are put in next to WEB-INF folder are not managed by WIcket
> and they are served directly by the web container
> Take a look at http://code.google.com/p/wro4j/
>
> On Sun, Oct 31, 2010 at 1:11 AM, Mauro Ciancio <ma...@gmail.com>wrote:
>
>> Hello everyone:
>>
>> I've been trying to get properly working the caching in my site's
>> resources using the if-modified-since header. I've noticed that the
>> check for the header is only done if the resource is mounted under the
>> '/resources' url (wicket filter @ line 1130, Wicket 1.4).
>>
>> My resources are mounted under another url ('/photos'). I was
>> wondering why the check is restricted to that url. Also, I've tried to
>> mount my resources under /resources/photos but I get an exception that
>> says 'cannot be mounted under /resources'.
>>
>> Any advices?
>> Thanks in advance.
>> --
>> Mauro Ciancio
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>



-- 
Mauro Ciancio

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: If-Modified-Since header

Posted by Martin Grigorov <mg...@apache.org>.
Hi Mauro,

/resources is a special path managed by Wicket, e.g.
ResourceReference(MyComponent.class, "myImage.gif") will be reachable at
/resources/com.mypackage.MyComponent/myImage.gif

Resources which are put in next to WEB-INF folder are not managed by WIcket
and they are served directly by the web container
Take a look at http://code.google.com/p/wro4j/

On Sun, Oct 31, 2010 at 1:11 AM, Mauro Ciancio <ma...@gmail.com>wrote:

> Hello everyone:
>
> I've been trying to get properly working the caching in my site's
> resources using the if-modified-since header. I've noticed that the
> check for the header is only done if the resource is mounted under the
> '/resources' url (wicket filter @ line 1130, Wicket 1.4).
>
> My resources are mounted under another url ('/photos'). I was
> wondering why the check is restricted to that url. Also, I've tried to
> mount my resources under /resources/photos but I get an exception that
> says 'cannot be mounted under /resources'.
>
> Any advices?
> Thanks in advance.
> --
> Mauro Ciancio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>