Hi all,

The HTML and TXT renderings of the default GET servlet IIRC predate the
JSON servlet, in particular the tidy feature of the JSON servlet. So at
that time these renderings were used as a means of just presenting the
raw data (and as an "error" marker should a correct script/servlet be
missing).

Nowadays, this feature of the HTML/TXT renderings does not seem to be
that important anymore.

Therefore I suggest the following behaviour:


(1) HTML/TXT rendering (extensions "html" and "txt")
Render the resource with its resource type (might still be used for
error detection) and a title along with a listing of the child
resources. For HTML this list will be links, for TXT just plain names.
A configuration option is added, which causes this rendering to be
disabled and a 403/FORBIDDEN status to be sent back.
This behaviour is comparable to directory listing in httpd


(2a) Streaming (no extension or extension "res")
If the resource adapts to an InputStream, the data is streamed back.
If the resource does not adapt to an InputStream and the request has no
extension, a temporary redirect (302/FOUND) is sent back with the same
URL plus the extension ".html" to cause the HTML rendering to be called
for the resource.
If the resource does not adapt to an InputStream and the request
extension is "res", a 404/NOT FOUND is sent back.

(2b) Streaming (no extension or extension "res")
Same as (2a) except that instead of sending 302/FOUND in case 2 (no
InputStream and no extension), the same resource is included with
resource type overwrite "sling/servlet/default" and extension overwrite
"html".
The (2a) approach would allow normal/full support for HTML rendering of
the resource, while this (2b) approach just allows for HTML rendering
with the default fallback resource type.
We could also make behaviour (2a) vs. (2b) configurable.


WDYT ?

Regards
Felix



Tobias Bocanegra (JIRA) schrieb:
> Add configuration to default GET servlet to produce other kinds of responses.
> -----------------------------------------------------------------------------
> 
>                  Key: SLING-723
>                  URL: https://issues.apache.org/jira/browse/SLING-723
>              Project: Sling
>           Issue Type: Improvement
>           Components: Servlets Get
>             Reporter: Tobias Bocanegra
> 
> 
> it would be desirable to configure the default behavior for the default GET 
> servlet. eg:
> 
> report=dump -> wil generate some sort of dump (as it does today)
> report=dirlisting -> will generate a dir listing of the subnodes.
> report={number}   -> send an error, eg: 403
> 
> 
> 

Reply via email to