I think "Using extensions based on the response format is such a good
practice" is my answer. I was hoping to not force the user to enter an HTML
extension (in the browser URL). Sounds like that is bad practice.
(Just for completeness): By 'hit that node' I mean entering the URL in
the browser to the node (i.e. http://server:port/records), like 'hit that
website'.
Thanks.
-----Original Message-----
From: Alexander Klimetschek [mailto:[email protected]]
Sent: Thursday, January 27, 2011 12:07 PM
To: [email protected]
Subject: Re: Sling.getContent() and resourceType
On 27.01.11 17:55, "Andrew Top" <[email protected]> wrote:
> I have a node at /records say. I want to user to be able to hit that
>node by specifying the URL: http://server:port/records.
What do you mean by "hit that node"? How do the responses look like -
html, xml, etc.?
> I have been using resourceType to accomplish that. But without
>specifying any selectors, extensions, suffixes, or anything else, I find
>I need to use GET.jsp. Is there a better way? Or do I require the user
>to add a 'html'?
You add whatever extension (and selectors) you are using. Using extensions
based on the response format is such a good practice that it is built into
the heart of Sling.
Using no extension at all is possible, but then you need to manually
handle the default servlets if you rely on them. For example, for the json
needed by getContent() you would have a GET.json.jsp and do sth. like
<sling:include resourceType="default-json-servlet"> (where
default-json-servlet needs to be replaced with the right type, I don't
know it at the moment).
Regards,
Alex
--
Alexander Klimetschek
Developer // Adobe (Day) // Berlin - Basel