001/*
002 * The contents of this file are subject to the license and copyright
003 * detailed in the LICENSE and NOTICE files at the root of the source
004 * tree.
005 */
006package org.fcrepo.http.commons;
007
008import org.fcrepo.http.commons.metrics.MicrometerFeature;
009import org.glassfish.jersey.jackson.JacksonFeature;
010import org.glassfish.jersey.logging.LoggingFeature;
011import org.glassfish.jersey.media.multipart.MultiPartFeature;
012import org.glassfish.jersey.server.ResourceConfig;
013
014import java.util.logging.Logger;
015
016import static org.slf4j.LoggerFactory.getLogger;
017
018/**
019 * @author cabeer
020 * @since 9/22/14
021 */
022public class FedoraApplication extends ResourceConfig {
023
024    private static final org.slf4j.Logger LOGGER = getLogger(FedoraApplication.class);
025
026    /**
027     * THIS IS OUR RESOURCE CONFIG!
028     */
029    public FedoraApplication() {
030        super();
031        packages("org.fcrepo");
032        register(MultiPartFeature.class);
033        register(JacksonFeature.class);
034        register(MicrometerFeature.class);
035
036        if (LOGGER.isDebugEnabled()) {
037            register(new LoggingFeature(Logger.getLogger(LoggingFeature.class.getName())));
038        }
039    }
040}