001/*
002 * (C) Copyright 2010 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Nuxeo - initial API and implementation
016 */
017
018package org.nuxeo.ecm.webdav;
019
020import org.nuxeo.ecm.webdav.resource.RootResource;
021import org.nuxeo.ecm.webengine.model.io.BlobWriter;
022
023import java.util.HashSet;
024import java.util.Set;
025
026/**
027 * Registers the application (root resource classes and providers) in a standard / container-neutral way.
028 */
029public class Application extends javax.ws.rs.core.Application {
030
031    @Override
032    public Set<Class<?>> getClasses() {
033        Set<Class<?>> classes = new HashSet<Class<?>>();
034        classes.add(RootResource.class);
035        return classes;
036    }
037
038    @Override
039    public Set<Object> getSingletons() {
040        Set<Object> singletons = new HashSet<Object>();
041        singletons.add(new ExceptionHandler());
042        singletons.add(new WebDavContextResolver());
043        singletons.add(new BlobWriter());
044        return singletons;
045    }
046
047}