Hi,
I am about to start a new project where the JCR seems to be a good fit
as it provides a lot of the requested functionality ootb.
As certain operations should be provided as REST services I thought
about trying SLING and have spent the last days reading the docs and
checking the samples.
So I have a high-level understanding of SLING but for sure not the
complete picture.

That results into some (very basic) questions:

1) It is more a finding then a question: I miss the C in MVC. I read
that a controller is not required when using SLING as the selection of
scripts happens content driven.
    However I have seen code on top of some jsps that is typical for a
controller:    E.g. checking whether a user is logged in (or has the
appropriate role) and redirecting if that's not the case.
    I would like to see that code in a controller, long before my HTML
view template is about to render and not mixed into my view. Is there
any concept in SLING to provide a better separation?
    Speaking about separation: I have seen a lot of code on top of the
esp and jsps files. That's fine for samples but for the last years I
always tried to avoid that kind of mixture in my projects.
    Is there a way to provide all that code in java services which can
make use of DI and just provide calculated values to the HTML view?
Something I'd do normally in the controller?
    (I am aware of JSPs taglibs but, hm, I don't like the programming
model. Any alternatives?)

2) How is input validation done? The postservlet allows the client to
post nearly everything in every structure to the repository. I am sure
there are ways to restrict that ability.
    I guess part of this is to define ACLs on the repository and to
not use nt:unstructured as nodetype but a more precise one (see next
question). But how would I do more low level validation like checking
that a number is in a certain range,
    a string matches a given regex or a given e-mailadress is not
already existent in the repository?

3) How do I interact with the underlying jackrabbit repository? In the
slingbucks sample I have seen some json files to setup a basic
structure. Can I use that mechanism to also setup custom node types
and define ACLs? Or how would I do that?


I hope the questions aren't already answered prominently in the
documentation and I have simply missed them.

Thanks,
 Markus

Reply via email to