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 */ 040 @GET 041 @Path("common.css") 042 @Produces({"text/css", "*/*"}) 043 public Response getViewCss() { 044 return ok().entity(this.getClass().getResourceAsStream(StreamingBaseHtmlProvider.commonCssLocation)).build(); 045 } 046 047 /** 048 * Gets the common js file referenced in all velocity views. 049 * @return 050 */ 051 @GET 052 @Path("common.js") 053 @Produces({"text/javascript", "*/*"}) 054 public Response getViewJs() { 055 return ok().entity(this.getClass().getResourceAsStream(StreamingBaseHtmlProvider.commonJsLocation)).build(); 056 } 057}