001/**
002 * Copyright 2015 DuraSpace, Inc.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.fcrepo.http.api;
017
018
019import org.fcrepo.http.api.responses.StreamingBaseHtmlProvider;
020import org.springframework.context.annotation.Scope;
021
022import javax.ws.rs.GET;
023import javax.ws.rs.Path;
024import javax.ws.rs.Produces;
025import javax.ws.rs.core.Response;
026
027import static javax.ws.rs.core.Response.ok;
028
029/**
030 * @author md5wz
031 * @since 11/12/2014
032 */
033@Scope("request")
034@Path("/fcr:assets")
035public class ViewAssets {
036
037    /**
038     * Gets the common css file referenced in all velocity views.
039     * @return the common css file referenced in all velocity views
040     */
041    @GET
042    @Path("common.css")
043    @Produces({"text/css", "*/*"})
044    public Response getViewCss() {
045        return ok().entity(this.getClass().getResourceAsStream(StreamingBaseHtmlProvider.commonCssLocation)).build();
046    }
047
048    /**
049     * Gets the common js file referenced in all velocity views.
050     * @return the response
051     */
052    @GET
053    @Path("common.js")
054    @Produces({"text/javascript", "*/*"})
055    public Response getViewJs() {
056        return ok().entity(this.getClass().getResourceAsStream(StreamingBaseHtmlProvider.commonJsLocation)).build();
057    }
058}