Re: Response content type when url has no extension

2016-06-22 Thread Oliver Lietz
On Wednesday 22 June 2016 14:15:42 Bertrand Delacretaz wrote:
> Hi,
> 
> On Wed, Jun 22, 2016 at 12:39 AM, Ben Fortuna  wrote:
> > ...Should this be handled in sling or is it common practice to use another
> > mechanism to redirect / to /index.html? ...
> 
> I suspect people often use front-end rewriters like mod_rewrite to add
> extensions to URLs which have none.

Apache Sling URL Rewriter:
https://github.com/apache/sling/tree/trunk/contrib/extensions/urlrewriter

Regards,
O.

> Having a configurable default extension in Sling might be interesting,
> but we'd probably need to limit it to specific paths, or make that
> just an extension point.
> 
> -Bertrand



RE: Response content type when url has no extension

2016-06-22 Thread Jason Bailey
I believe that exists, or I'm misunderstanding the intent. Under

org.apache.sling.servlets.resolver

for the property servletresolver.defaultExtensions

-Original Message-
From: Bertrand Delacretaz [mailto:bdelacre...@apache.org] 
Sent: Wednesday, June 22, 2016 8:16 AM
To: users 
Subject: Re: Response content type when url has no extension

Hi,

On Wed, Jun 22, 2016 at 12:39 AM, Ben Fortuna  wrote:
> ...Should this be handled in sling or is it common practice to use 
> another mechanism to redirect / to /index.html? ...

I suspect people often use front-end rewriters like mod_rewrite to add 
extensions to URLs which have none.

Having a configurable default extension in Sling might be interesting, but we'd 
probably need to limit it to specific paths, or make that just an extension 
point.

-Bertrand


Re: Response content type when url has no extension

2016-06-22 Thread Bertrand Delacretaz
Hi,

On Wed, Jun 22, 2016 at 12:39 AM, Ben Fortuna  wrote:
> ...Should this be handled in sling or is it common practice to use another
> mechanism to redirect / to /index.html? ...

I suspect people often use front-end rewriters like mod_rewrite to add
extensions to URLs which have none.

Having a configurable default extension in Sling might be interesting,
but we'd probably need to limit it to specific paths, or make that
just an extension point.

-Bertrand


Re: Response content type when url has no extension

2016-06-22 Thread Robert Munteanu
Hi Ben,

On Wed, 2016-06-22 at 08:39 +1000, Ben Fortuna wrote:
> Hi,
> 
> Just wondering what is the standard practice for managing sling
> requests
> with no extension. My use case is that my index node is called
> 'index' so
> when I get a request for just the domain name root (ie.
> http://www.example.com/) it will redirect to my index but without an
> extension (ie. /content/blah/index). The content type for this
> request is
> text/plain, so the browser doesn't render the page.
> 
> Should this be handled in sling or is it common practice to use
> another
> mechanism to redirect / to /index.html?

In the default Sling launchpad we use the following properties to set
up the redirect from the root page:

{
"jcr:mixinTypes": [ "sling:Redirect" ],
"sling:resourceType": "sling:redirect",
"sling:target": "/index.html"
}

Perhaps you can do the same.

Thanks,

Robert