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