added max-age to cache control

This commit is contained in:
Sebastian Sdorra
2011-02-13 17:49:41 +01:00
parent a8b468d50e
commit cb6357f53c
2 changed files with 29 additions and 0 deletions

View File

@@ -262,6 +262,30 @@ public abstract class AbstractManagerResource<T extends ModelObject,
return createResponse(request, items); return createResponse(request, items);
} }
/**
* Method description
*
*
* @return
*/
public int getCacheMaxAge()
{
return cacheMaxAge;
}
//~--- set methods ----------------------------------------------------------
/**
* Method description
*
*
* @param cacheMaxAge
*/
public void setCacheMaxAge(int cacheMaxAge)
{
this.cacheMaxAge = cacheMaxAge;
}
//~--- methods -------------------------------------------------------------- //~--- methods --------------------------------------------------------------
/** /**
@@ -324,6 +348,7 @@ public abstract class AbstractManagerResource<T extends ModelObject,
{ {
CacheControl cc = new CacheControl(); CacheControl cc = new CacheControl();
cc.setMaxAge(cacheMaxAge);
rb.cacheControl(cc); rb.cacheControl(cc);
} }
@@ -395,6 +420,9 @@ public abstract class AbstractManagerResource<T extends ModelObject,
//~--- fields --------------------------------------------------------------- //~--- fields ---------------------------------------------------------------
/** Field description */
protected int cacheMaxAge = 1;
/** Field description */ /** Field description */
protected Manager<T, E> manager; protected Manager<T, E> manager;
} }

View File

@@ -83,6 +83,7 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
initComponent: function(){ initComponent: function(){
var repositoryStore = new Sonia.rest.JsonStore({ var repositoryStore = new Sonia.rest.JsonStore({
id: 'repositoryStore',
proxy: new Ext.data.HttpProxy({ proxy: new Ext.data.HttpProxy({
url: restUrl + 'repositories.json', url: restUrl + 'repositories.json',
disableCaching: false disableCaching: false