1/* 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26package com.sun.xml.internal.ws.transport.http; 27 28import java.net.URL; 29import java.net.MalformedURLException; 30import java.util.Set; 31 32/** 33 * Used to locate resources for {@link DeploymentDescriptorParser}. 34 * 35 * <p> 36 * This allows {@link DeploymentDescriptorParser} to be used outside a servlet container, 37 * but it still needs to work with a layout similar to the web application. 38 * If this can be abstracted away better, that would be nice. 39 * 40 * @author Kohsuke Kawaguchi 41 */ 42public interface ResourceLoader { 43 /** 44 * Returns the actual location of the resource from the 'path' 45 * that represents a virtual locaion of a file inside a web application. 46 * 47 * @param path 48 * Desiganates an absolute path within an web application, such as: 49 * '/WEB-INF/web.xml' or some such. 50 * 51 * @return 52 * the actual location, if found, or null if not found. 53 */ 54 URL getResource(String path) throws MalformedURLException; 55 56 /** 57 * Gets the catalog XML file that should be consulted when 58 * loading resources from this {@link ResourceLoader}. 59 */ 60 URL getCatalogFile() throws MalformedURLException; 61 62 /** 63 * Returns the list of files in the given directory. 64 * 65 * @return 66 * null if the path is invalid. empty if the path didn't contain 67 * any entry in it. 68 * 69 * @see javax.servlet.ServletContext#getResourcePaths(String) 70 */ 71 Set<String> getResourcePaths(String path); 72} 73