Hi gang!
The way I'd like to provide path mapping for classes is with JAX-RS
(Jersey) annontations.
That should be pretty straightforward for compiled bundles, but I think
it can work for scripts too (at least Groovy scripts anyhow).
I just started using Sling and don't my way around at all yet, so this
comment is probably entirely off the topic of this proposal.
Jim
Felix Meschberger wrote:
Hi all,
Prompted by Shane Johnson's comments on the naming conventions for
servlets in the repository [1], I come to think, that there might be
another solution or way to look at it.
Currently a script must basically be named according to the following
convention:
[ selector "." ] method |
[ selector "." ] extension | // GET only
selector // GET html only
All matches are done case-sensitive. This works find with general
scripts, which may have as many dots in the file name as we like. For
Servlets (stored in the repository) it is more problematic, since class
files must be named after ther class name and class names are not
allowed to have dots in it.
To workaround this, I could imagine, that we extend the convention for
script file names:
[ selector "." ] method |
Selector method |
[ selector "." ] extension | // GET only
Selector Extension | // GET only
selector | // GET html only
Selector // GET html only
(uppercase signifies camelcased name).
So the request "GET /some/path.print.html" could be handled by any of
the following scripts
path.GET.jsp
GET.jsp
PathGET.java
path.html.esp
html.esp
PathHtml.vlt
path.gsp
Path.groovy
This would of course extend the list of checks to apply for finding
scripts, but would certainly gelp Java developers.
The drawback of this is, that the request "GET /path.PrintA4.html" might
be handled by the same script as "GET /path.Print.A4.html". But this may
be a hypothetical collision and problem.
WDYT ?
Regards
Felix
[1] http://blogs.citytechinc.com/sjohnson/?p=47