>
> This if statement checks if a parameter starts with
> "cocoon:cache" and if yes,
> it add it to the params object and removes it from the
> "normal" request
> parameters. It looks fine for me and the expires value is set
> correctly at the
> source AFAICS. BTW, I'm working on trunk.
Yes I saw this about the cocoon:cache, but it seems to me that the other
parameters are forgotten to add to params, and therefor, int expires =
params.getParameterAsInteger(CachingSource.CACHE_EXPIRES_PARAM,
defaultExpires); always returns a -1...Look at the code snipper below from the
getSource in the trunk:
index = uri.indexOf('?');
if (index != -1) {
sp = new SourceParameters(uri.substring(index + 1));
uri = uri.substring(0, index);
}
// put caching source specific query string parameters
// into a Parameters object
final Parameters params = new Parameters();
if (sp != null) {
SourceParameters remainingParameters = (SourceParameters)
sp.clone();
final Iterator names = sp.getParameterNames();
while (names.hasNext()) {
String name = (String) names.next();
if (name.startsWith("cocoon:cache")) {
params.setParameter(name.substring("cocoon:".length()),
sp.getParameter(name));
remainingParameters.removeParameter(name);
}
}
String queryString = remainingParameters.getEncodedQueryString();
if (queryString != null) {
uri += "?" + queryString;
}
}
int expires =
params.getParameterAsInteger(CachingSource.CACHE_EXPIRES_PARAM, defaultExpires);
The only parameter that is added to params is the cocoon:cache, and therefor
expires always has the defaultExpires.
if (name.startsWith("cocoon:cache")) {
params.setParameter(name.substring("cocoon:".length()),
sp.getParameter(name));
remainingParameters.removeParameter(name);
}
else{
params.setParameter(name,sp.getParameter(name));
}
solves this IMO
Ard
>
>
> > because all parameters are neglected in the current way.
> >
> > Then, when I do have my expires accounted for correctly, I
> do not understand why while the cached object is not expired,
> there is still a call for the remote source. This doesn't
> make sense to me. Also, when the expires is set correctly,
> and the object is expired, I am getting a
> NullPointerException, but it might be because we use an old
> version...?
>
> I can confirm this but don't know where those requests come
> from. I could be
> caused by a validity check but that's only a wild guess.
>
> --
> Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
>
> {Software Engineering, Open Source, Web Applications, Apache Cocoon}
>
> web(log): http://www.poetz.cc
> --------------------------------------------------------------------
>