/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.rest.resources;

import org.restlet.resource.Representation;
import org.restlet.resource.Variant;
import org.xwiki.rest.DomainObjectFactory;
import org.xwiki.rest.XWikiResource;
import org.xwiki.rest.model.XWikiRoot;

/**
 * @version $Id$
 */
public class RootResource extends XWikiResource
{
    @Override
    public Representation represent(Variant variant)
    {
        XWikiRoot xwikiRoot = DomainObjectFactory.createXWikiRoot(getRequest(), xwikiApi, resourceClassRegistry);

        return getRepresenterFor(variant).represent(getContext(), getRequest(), getResponse(), xwikiRoot);
    }
}

@@ -941,18 +941,53 @@
 urces;%0D%0A
+%0Aimport org.restlet.data.MediaType;
 %0D%0A
-
 import o
@@ -1103,16 +1103,60 @@
 Factory;
+%0Aimport org.xwiki.rest.XWikiRestApplication;
 %0D%0Aimport
@@ -1502,16 +1502,16 @@
 ry);%0D%0A%0D%0A
-
         
@@ -1615,13 +1615,534 @@
 ;%0D%0A    %7D
+%0A%0A    /* Mimic the behavior of a OPTION request to the root of a WADL application in RESTlet */%0A    @Override%0A    public boolean allowOptions()%0A    %7B%0A        return true;%0A    %7D%0A%0A    @Override%0A    public void handleOptions()%0A    %7B%0A        if (isAutoDescribed()) %7B%0A            XWikiRestApplication application = (XWikiRestApplication) getApplication();%0A            getResponse().setEntity(%0A                application.wadlRepresent(new Variant(MediaType.APPLICATION_WADL_XML), getRequest(), getResponse()));%0A        %7D%0A    %7D
 %0D%0A%7D%0D%0A

Develop the initial feature set of the REST API