You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Clemens Wyss <cl...@mysign.ch> on 2010/12/02 09:12:16 UTC

What if sling is not deployed/run on the root '/'

What ist he easiest way to deploy/run sling not on root '/', but, for example, beneath '/sling/'? Can this be "handled" by a simple sling:Mapping (internalRedirect) node beneath /etc/map? 
There used to be the sling.root Servlet property...(*)

Thx for your advices
Clemens
(*)Btw, if I put sling.root into the sling servlet initParams it is written into the sling.properties file

Re: What if sling is not deployed/run on the root '/'

Posted by Carsten Ziegeler <cz...@apache.org>.
Felix Meschberger  wrote
> Hi,
> 
> Sling is always registered as the root servlet of the web application.
> We cannot currently change this. The sling.root configuration property
> has in fact been removed, because it was not supported.
> 
> Of course you can deploy the Sling Web Application in any context root
> you like, the default of course being the root context.
> 
In addition, if you're deploying Sling as a web application, you can
mount the bridge servlet to any path within the web app context -
currently it is mounted at the root.
So if you mount your web app at context /foo, you can mount the bridge
servlet at /bar, therefore Sling responds to everything starting with
/foo/bar.

Regards
Carsten

> Am Donnerstag, den 02.12.2010, 09:12 +0100 schrieb Clemens Wyss: 
>> What ist he easiest way to deploy/run sling not on root '/', but, for example, beneath '/sling/'? Can this be "handled" by a simple sling:Mapping (internalRedirect) node beneath /etc/map? 
>> There used to be the sling.root Servlet property...(*)
>>
>> Thx for your advices
>> Clemens
>> (*)Btw, if I put sling.root into the sling servlet initParams it is written into the sling.properties file
> 
> Yes. Everything that's in the servlet's init-param is copied into the
> sling.properties file in ${sling.home}. As such ${sling.home} actually
> reflects the set of the current framework properties set by Sling.
> 
> Regards
> Felix
> 
> 
> 


-- 
Carsten Ziegeler
cziegeler@apache.org

AW: What if sling is not deployed/run on the root '/'

Posted by Clemens Wyss <cl...@mysign.ch>.
One step further.

While my standalone sling runs on (default) port 8080, my embedded sling@tomcat runs on 8081. 

While debugging I noticed the following:
MapEntry#fixUriPath transforms my uri matching regex " http/localhost\.\d*" into " http/localhost\.\d*.80"

While this (luckily (*)) matches http://localhost:8080 it does NOT match http://localhost:8081 ! 

Does fixUriPath do what it's expected to do? IMHO no, because my original regex allows any port (\d*), as described here http://sling.apache.org/site/mappings-for-resource-resolution.html .

WDYT?

(*) I guess the replacement pattern should be "http/$1$2\.80$3", not "http/$1$2.80$3"

> -----Ursprüngliche Nachricht-----
> Von: Clemens Wyss [mailto:clemensdev@mysign.ch]
> Gesendet: Donnerstag, 2. Dezember 2010 10:52
> An: users@sling.apache.org
> Betreff: AW: What if sling is not deployed/run on the root '/'
> 
> > Got it!
> Unfortunately not yet. The mapping works within "sling standalone", but not
> when I launch sling from within tomcat. In the latter case the mapping seems
> to have no effect...
> 
> The only "difference" I see when comparing the two sling.properties files is
> the following line in the tomcat sling.properties (which does not exist in the
> standalone sling.properties):
> org.apache.sling.launcher.system.packages=,javax.servlet;javax.servlet.http;
> javax.servlet.resources; version\=2.5
> 
> Why does sling@tomcat not map correctly?
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Clemens Wyss [mailto:clemensdev@mysign.ch]
> > Gesendet: Donnerstag, 2. Dezember 2010 10:14
> > An: users@sling.apache.org
> > Betreff: AW: What if sling is not deployed/run on the root '/'
> >
> > Got it!
> > Had to prepend the protocol/scheme:
> >
> > "localhost\.\d*" -> "http/localhost\.\d*"
> >
> > Cool & thanks
> > Clemens
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Clemens Wyss [mailto:clemensdev@mysign.ch]
> > > Gesendet: Donnerstag, 2. Dezember 2010 10:07
> > > An: users@sling.apache.org
> > > Betreff: AW: What if sling is not deployed/run on the root '/'
> > >
> > > @Felix: Thanks for your fast reply.
> > >
> > > > Of course you can deploy the Sling Web Application in any context
> > > > root you like, the default of course being the root context.
> > > But what do I need to do that Sling "moves" requests coming
> > > from/through
> > > http://localhost:8080/sling/* down to http://localhost:8080/* ?
> > > Is this to be solved with mappings?
> > > I have setup the following mapping(s) /etc/map/
> > >             |-- [localhost_any]< sling:match = "localhost\.\d*" >
> > >                 |-- [sling]< sling:internalRedirect = "/" > to no avail...
> > >
> > > Regards
> > > Clemens
> > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Felix Meschberger [mailto:fmeschbe@gmail.com]
> > > > Gesendet: Donnerstag, 2. Dezember 2010 09:48
> > > > An: users@sling.apache.org
> > > > Betreff: Re: What if sling is not deployed/run on the root '/'
> > > >
> > > > Hi,
> > > >
> > > > Sling is always registered as the root servlet of the web application.
> > > > We cannot currently change this. The sling.root configuration
> > > > property has in fact been removed, because it was not supported.
> > > >
> > > > Of course you can deploy the Sling Web Application in any context
> > > > root you like, the default of course being the root context.
> > > >
> > > > Am Donnerstag, den 02.12.2010, 09:12 +0100 schrieb Clemens Wyss:
> > > > > What ist he easiest way to deploy/run sling not on root '/',
> > > > > but, for
> > > > example, beneath '/sling/'? Can this be "handled" by a simple
> > > > sling:Mapping
> > > > (internalRedirect) node beneath /etc/map?
> > > > > There used to be the sling.root Servlet property...(*)
> > > > >
> > > > > Thx for your advices
> > > > > Clemens
> > > > > (*)Btw, if I put sling.root into the sling servlet initParams it
> > > > > is written into the sling.properties file
> > > >
> > > > Yes. Everything that's in the servlet's init-param is copied into
> > > > the sling.properties file in ${sling.home}. As such ${sling.home}
> > > > actually reflects the set of the current framework properties set by
> Sling.
> > > >
> > > > Regards
> > > > Felix
> > > >


AW: What if sling is not deployed/run on the root '/'

Posted by Clemens Wyss <cl...@mysign.ch>.
> Got it!
Unfortunately not yet. The mapping works within "sling standalone", but not when I launch sling from within tomcat. In the latter case the mapping seems to have no effect...

The only "difference" I see when comparing the two sling.properties files is the following line in the tomcat sling.properties (which does not exist in the standalone sling.properties):
org.apache.sling.launcher.system.packages=,javax.servlet;javax.servlet.http;javax.servlet.resources; version\=2.5

Why does sling@tomcat not map correctly?

> -----Ursprüngliche Nachricht-----
> Von: Clemens Wyss [mailto:clemensdev@mysign.ch]
> Gesendet: Donnerstag, 2. Dezember 2010 10:14
> An: users@sling.apache.org
> Betreff: AW: What if sling is not deployed/run on the root '/'
> 
> Got it!
> Had to prepend the protocol/scheme:
> 
> "localhost\.\d*" -> "http/localhost\.\d*"
> 
> Cool & thanks
> Clemens
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Clemens Wyss [mailto:clemensdev@mysign.ch]
> > Gesendet: Donnerstag, 2. Dezember 2010 10:07
> > An: users@sling.apache.org
> > Betreff: AW: What if sling is not deployed/run on the root '/'
> >
> > @Felix: Thanks for your fast reply.
> >
> > > Of course you can deploy the Sling Web Application in any context
> > > root you like, the default of course being the root context.
> > But what do I need to do that Sling "moves" requests coming
> > from/through
> > http://localhost:8080/sling/* down to http://localhost:8080/* ?
> > Is this to be solved with mappings?
> > I have setup the following mapping(s)
> > /etc/map/
> >             |-- [localhost_any]< sling:match = "localhost\.\d*" >
> >                 |-- [sling]< sling:internalRedirect = "/" > to no avail...
> >
> > Regards
> > Clemens
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Felix Meschberger [mailto:fmeschbe@gmail.com]
> > > Gesendet: Donnerstag, 2. Dezember 2010 09:48
> > > An: users@sling.apache.org
> > > Betreff: Re: What if sling is not deployed/run on the root '/'
> > >
> > > Hi,
> > >
> > > Sling is always registered as the root servlet of the web application.
> > > We cannot currently change this. The sling.root configuration
> > > property has in fact been removed, because it was not supported.
> > >
> > > Of course you can deploy the Sling Web Application in any context
> > > root you like, the default of course being the root context.
> > >
> > > Am Donnerstag, den 02.12.2010, 09:12 +0100 schrieb Clemens Wyss:
> > > > What ist he easiest way to deploy/run sling not on root '/', but,
> > > > for
> > > example, beneath '/sling/'? Can this be "handled" by a simple
> > > sling:Mapping
> > > (internalRedirect) node beneath /etc/map?
> > > > There used to be the sling.root Servlet property...(*)
> > > >
> > > > Thx for your advices
> > > > Clemens
> > > > (*)Btw, if I put sling.root into the sling servlet initParams it
> > > > is written into the sling.properties file
> > >
> > > Yes. Everything that's in the servlet's init-param is copied into
> > > the sling.properties file in ${sling.home}. As such ${sling.home}
> > > actually reflects the set of the current framework properties set by Sling.
> > >
> > > Regards
> > > Felix
> > >


AW: What if sling is not deployed/run on the root '/'

Posted by Clemens Wyss <cl...@mysign.ch>.
Got it! 
Had to prepend the protocol/scheme:

"localhost\.\d*" -> "http/localhost\.\d*"

Cool & thanks
Clemens

> -----Ursprüngliche Nachricht-----
> Von: Clemens Wyss [mailto:clemensdev@mysign.ch]
> Gesendet: Donnerstag, 2. Dezember 2010 10:07
> An: users@sling.apache.org
> Betreff: AW: What if sling is not deployed/run on the root '/'
> 
> @Felix: Thanks for your fast reply.
> 
> > Of course you can deploy the Sling Web Application in any context root
> > you like, the default of course being the root context.
> But what do I need to do that Sling "moves" requests coming from/through
> http://localhost:8080/sling/* down to http://localhost:8080/* ?
> Is this to be solved with mappings?
> I have setup the following mapping(s)
> /etc/map/
>             |-- [localhost_any]< sling:match = "localhost\.\d*" >
>                 |-- [sling]< sling:internalRedirect = "/" > to no avail...
> 
> Regards
> Clemens
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Felix Meschberger [mailto:fmeschbe@gmail.com]
> > Gesendet: Donnerstag, 2. Dezember 2010 09:48
> > An: users@sling.apache.org
> > Betreff: Re: What if sling is not deployed/run on the root '/'
> >
> > Hi,
> >
> > Sling is always registered as the root servlet of the web application.
> > We cannot currently change this. The sling.root configuration property
> > has in fact been removed, because it was not supported.
> >
> > Of course you can deploy the Sling Web Application in any context root
> > you like, the default of course being the root context.
> >
> > Am Donnerstag, den 02.12.2010, 09:12 +0100 schrieb Clemens Wyss:
> > > What ist he easiest way to deploy/run sling not on root '/', but,
> > > for
> > example, beneath '/sling/'? Can this be "handled" by a simple
> > sling:Mapping
> > (internalRedirect) node beneath /etc/map?
> > > There used to be the sling.root Servlet property...(*)
> > >
> > > Thx for your advices
> > > Clemens
> > > (*)Btw, if I put sling.root into the sling servlet initParams it is
> > > written into the sling.properties file
> >
> > Yes. Everything that's in the servlet's init-param is copied into the
> > sling.properties file in ${sling.home}. As such ${sling.home} actually
> > reflects the set of the current framework properties set by Sling.
> >
> > Regards
> > Felix
> >


AW: What if sling is not deployed/run on the root '/'

Posted by Clemens Wyss <cl...@mysign.ch>.
@Felix: Thanks for your fast reply.

> Of course you can deploy the Sling Web Application in any context root you
> like, the default of course being the root context.
But what do I need to do that Sling "moves" requests coming from/through 
http://localhost:8080/sling/* down to http://localhost:8080/* ? 
Is this to be solved with mappings? 
I have setup the following mapping(s)
/etc/map/
            |-- [localhost_any]< sling:match = "localhost\.\d*" >
                |-- [sling]< sling:internalRedirect = "/" >
to no avail...

Regards
Clemens

> -----Ursprüngliche Nachricht-----
> Von: Felix Meschberger [mailto:fmeschbe@gmail.com]
> Gesendet: Donnerstag, 2. Dezember 2010 09:48
> An: users@sling.apache.org
> Betreff: Re: What if sling is not deployed/run on the root '/'
> 
> Hi,
> 
> Sling is always registered as the root servlet of the web application.
> We cannot currently change this. The sling.root configuration property has in
> fact been removed, because it was not supported.
> 
> Of course you can deploy the Sling Web Application in any context root you
> like, the default of course being the root context.
> 
> Am Donnerstag, den 02.12.2010, 09:12 +0100 schrieb Clemens Wyss:
> > What ist he easiest way to deploy/run sling not on root '/', but, for
> example, beneath '/sling/'? Can this be "handled" by a simple sling:Mapping
> (internalRedirect) node beneath /etc/map?
> > There used to be the sling.root Servlet property...(*)
> >
> > Thx for your advices
> > Clemens
> > (*)Btw, if I put sling.root into the sling servlet initParams it is
> > written into the sling.properties file
> 
> Yes. Everything that's in the servlet's init-param is copied into the
> sling.properties file in ${sling.home}. As such ${sling.home} actually reflects
> the set of the current framework properties set by Sling.
> 
> Regards
> Felix
> 


Re: What if sling is not deployed/run on the root '/'

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

Sling is always registered as the root servlet of the web application.
We cannot currently change this. The sling.root configuration property
has in fact been removed, because it was not supported.

Of course you can deploy the Sling Web Application in any context root
you like, the default of course being the root context.

Am Donnerstag, den 02.12.2010, 09:12 +0100 schrieb Clemens Wyss: 
> What ist he easiest way to deploy/run sling not on root '/', but, for example, beneath '/sling/'? Can this be "handled" by a simple sling:Mapping (internalRedirect) node beneath /etc/map? 
> There used to be the sling.root Servlet property...(*)
> 
> Thx for your advices
> Clemens
> (*)Btw, if I put sling.root into the sling servlet initParams it is written into the sling.properties file

Yes. Everything that's in the servlet's init-param is copied into the
sling.properties file in ${sling.home}. As such ${sling.home} actually
reflects the set of the current framework properties set by Sling.

Regards
Felix