1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.myfaces.renderkit.html.util; 20 21 import javax.servlet.ServletContext; 22 import java.io.IOException; 23 import java.io.InputStream; 24 25 /** 26 * A class which can provide the resource itself 27 * 28 * @author imario (latest modification by $Author: skitching $) 29 * @version $Revision: 673833 $ $Date: 2008-07-03 16:58:05 -0500 (Thu, 03 Jul 2008) $ 30 */ 31 public interface ResourceProvider 32 { 33 /** 34 * check if the resource exists 35 */ 36 public boolean exists(ServletContext context, String resource); 37 38 /** 39 * get the content length of the resource 40 */ 41 public int getContentLength(ServletContext context, String resource) throws IOException; 42 43 /** 44 * get the last modified time of the resource 45 */ 46 public long getLastModified(ServletContext context, String resource) throws IOException; 47 48 /** 49 * get the input stream of the resource 50 */ 51 public InputStream getInputStream(ServletContext context, String resource) throws IOException; 52 53 /** 54 * get resource encoding 55 */ 56 public String getEncoding(ServletContext context, String resource) throws IOException; 57 }