Importing content to root

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Importing content to root

Ben Short-4
Hi,

I have deployed the Sling Web Application to a tomcat instance and all
works fine.

When I connect via webdav I can see a index.html file. If I point my
browser to htttp://127.0.0.1:8888 (I deployed the webapp as root) I
get redirected to the index.html file.

How is the redirect configured and how can I change it to redirect to
some other file?

Also how can I import bundle content to the root node?

Taking the following XML Descriptor id like the content of the root
node to be rendered via a GET.jsp located at
/apps/website/home/GET.jsp

<node>
    <name>root</name>
    <primaryNodeType>nt:unstructured</primaryNodeType>
    <property>
            <name>sling:resourceType</name>
            <value>website/home</value>
        </property>
</node>

Regards

Ben Short

Reply | Threaded
Open this post in threaded view
|

Re: Importing content to root

Bertrand Delacretaz
Hi Ben,

On Tue, Oct 13, 2009 at 11:45 AM, Ben Short <[hidden email]> wrote:
> ...When I connect via webdav I can see a index.html file. If I point my
> browser to htttp://127.0.0.1:8888 (I deployed the webapp as root) I
> get redirected to the index.html file.
>
> How is the redirect configured and how can I change it to redirect to
> some other file?...

In the Sling Launchpad this is configured by the
org.apache.sling.launchpad.content which supplies some initial
content.

See http://svn.apache.org/repos/asf/sling/trunk/launchpad/content/src/main/resources/content/ROOT.json
for more specific info on the root node properties that configure the
redirect.

>
> Also how can I import bundle content to the root node?
>
> Taking the following XML Descriptor id like the content of the root
> node to be rendered via a GET.jsp located at
> /apps/website/home/GET.jsp
>
> <node>
>    <name>root</name>
>    <primaryNodeType>nt:unstructured</primaryNodeType>
>    <property>
>            <name>sling:resourceType</name>
>            <value>website/home</value>
>        </property>
> </node>

ROOT.json, as shown above, should allow you to setup the root node as required.

-Bertrand

Reply | Threaded
Open this post in threaded view
|

Re: Importing content to root

Ben Short-4
Hi,

I have the following in ROOT.json at the route of the bundle content
but after I deploy the bundle I still get redirected to index.html

{
    "sling:resourceType": "website",
        "headline": "Loaded from ROOT.json"
}

Is there anyway to dump the contents of jackrabbit so I can see if the
properties are set as expected?

Regards

Ben

2009/10/13 Bertrand Delacretaz <[hidden email]>:

> Hi Ben,
>
> On Tue, Oct 13, 2009 at 11:45 AM, Ben Short <[hidden email]> wrote:
>> ...When I connect via webdav I can see a index.html file. If I point my
>> browser to htttp://127.0.0.1:8888 (I deployed the webapp as root) I
>> get redirected to the index.html file.
>>
>> How is the redirect configured and how can I change it to redirect to
>> some other file?...
>
> In the Sling Launchpad this is configured by the
> org.apache.sling.launchpad.content which supplies some initial
> content.
>
> See http://svn.apache.org/repos/asf/sling/trunk/launchpad/content/src/main/resources/content/ROOT.json
> for more specific info on the root node properties that configure the
> redirect.
>
>>
>> Also how can I import bundle content to the root node?
>>
>> Taking the following XML Descriptor id like the content of the root
>> node to be rendered via a GET.jsp located at
>> /apps/website/home/GET.jsp
>>
>> <node>
>>    <name>root</name>
>>    <primaryNodeType>nt:unstructured</primaryNodeType>
>>    <property>
>>            <name>sling:resourceType</name>
>>            <value>website/home</value>
>>        </property>
>> </node>
>
> ROOT.json, as shown above, should allow you to setup the root node as required.
>
> -Bertrand
>

Reply | Threaded
Open this post in threaded view
|

Re: Importing content to root

Ben Short-4
I just tried http://127.0.0.1:8888/json and got the following...

{
"headline":"Loaded from ROOT.json",
"sling:resourceType":"sling:redirect",
"jcr:mixinTypes":["mix:lockable","rep:AccessControllable"],
"sling:target":"/index.html",
"jcr:primaryType":"rep:root"
}

So it seems that some of my content is being set but not all of it.

Ben

2009/10/13 Ben Short <[hidden email]>:

> Hi,
>
> I have the following in ROOT.json at the route of the bundle content
> but after I deploy the bundle I still get redirected to index.html
>
> {
>    "sling:resourceType": "website",
>        "headline": "Loaded from ROOT.json"
> }
>
> Is there anyway to dump the contents of jackrabbit so I can see if the
> properties are set as expected?
>
> Regards
>
> Ben
>
> 2009/10/13 Bertrand Delacretaz <[hidden email]>:
>> Hi Ben,
>>
>> On Tue, Oct 13, 2009 at 11:45 AM, Ben Short <[hidden email]> wrote:
>>> ...When I connect via webdav I can see a index.html file. If I point my
>>> browser to htttp://127.0.0.1:8888 (I deployed the webapp as root) I
>>> get redirected to the index.html file.
>>>
>>> How is the redirect configured and how can I change it to redirect to
>>> some other file?...
>>
>> In the Sling Launchpad this is configured by the
>> org.apache.sling.launchpad.content which supplies some initial
>> content.
>>
>> See http://svn.apache.org/repos/asf/sling/trunk/launchpad/content/src/main/resources/content/ROOT.json
>> for more specific info on the root node properties that configure the
>> redirect.
>>
>>>
>>> Also how can I import bundle content to the root node?
>>>
>>> Taking the following XML Descriptor id like the content of the root
>>> node to be rendered via a GET.jsp located at
>>> /apps/website/home/GET.jsp
>>>
>>> <node>
>>>    <name>root</name>
>>>    <primaryNodeType>nt:unstructured</primaryNodeType>
>>>    <property>
>>>            <name>sling:resourceType</name>
>>>            <value>website/home</value>
>>>        </property>
>>> </node>
>>
>> ROOT.json, as shown above, should allow you to setup the root node as required.
>>
>> -Bertrand
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Importing content to root

Bertrand Delacretaz
In reply to this post by Ben Short-4
On Tue, Oct 13, 2009 at 12:11 PM, Ben Short <[hidden email]> wrote:

> Hi,
>
> I have the following in ROOT.json at the route of the bundle content
> but after I deploy the bundle I still get redirected to index.html
>
> {
>    "sling:resourceType": "website",
>        "headline": "Loaded from ROOT.json"
> }
>
> Is there anyway to dump the contents of jackrabbit so I can see if the
> properties are set as expected?

You can request /.tidy.json (or /.tidy.2.json to get a two-level
recursive dump or the root node).

-Bertrand

Reply | Threaded
Open this post in threaded view
|

Re: Importing content to root

Bertrand Delacretaz
In reply to this post by Ben Short-4
On Tue, Oct 13, 2009 at 12:14 PM, Ben Short <[hidden email]> wrote:

> I just tried http://127.0.0.1:8888/json and got the following...
>
> {
> "headline":"Loaded from ROOT.json",
> "sling:resourceType":"sling:redirect",
> "jcr:mixinTypes":["mix:lockable","rep:AccessControllable"],
> "sling:target":"/index.html",
> "jcr:primaryType":"rep:root"
> }
>
> So it seems that some of my content is being set but not all of it.

Looks like you have leftovers from the default initial content, you
can remove them with (for example)

  curl -F "sling:target=" http://admin:admin@localhost:8888/

as setting a property to an empty string removes it.

-Bertrand

Reply | Threaded
Open this post in threaded view
|

Re: Importing content to root

Ben Short-4
Thank Bertrand that did the job.

2009/10/13 Bertrand Delacretaz <[hidden email]>:

> On Tue, Oct 13, 2009 at 12:14 PM, Ben Short <[hidden email]> wrote:
>> I just tried http://127.0.0.1:8888/json and got the following...
>>
>> {
>> "headline":"Loaded from ROOT.json",
>> "sling:resourceType":"sling:redirect",
>> "jcr:mixinTypes":["mix:lockable","rep:AccessControllable"],
>> "sling:target":"/index.html",
>> "jcr:primaryType":"rep:root"
>> }
>>
>> So it seems that some of my content is being set but not all of it.
>
> Looks like you have leftovers from the default initial content, you
> can remove them with (for example)
>
>  curl -F "sling:target=" http://admin:admin@localhost:8888/
>
> as setting a property to an empty string removes it.
>
> -Bertrand
>