>> That makes me want to have a controller to validate my data against my
>> model and only pass the verified data to the view to render it ;-)
>> Can filters be used for that task?
>
> You could use filters or you could also use the SlingPostProcessor
> concept. Handling this in a filter is more general as it would cover all
> write operations not only those done through the default Sling post
> servlet (you can write your own post servlets for example)
That's for the input side. I am also interested in the output verification.
If I can't rely on my data having a certain format, I need to check
every property before accessing it.
I can do it in my view/template/script as it is done in the
options.esp from slingbucks
// If field has a jcr:title property, we can use it.
if(f["jcr:title"]) { ...
or I check this before I pass the node/type/object to the
view/template to render it.
I'd prefer the later one to keep the template clean. Can this check be
done in a filter?
I am not talking about checking just a single property but instead
verifying that the data that I load from the repository is
representing
the type that I expect:
title,text,email = blog comment object that I can render in my view
email, picture = something is wrong here. My view can't handle this
one -> error page
Regards,
Markus