com.sun.xml.ws.api.ResourceLoader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rt Show documentation
Show all versions of rt Show documentation
JAX-WS Reference Implementation Runtime
The newest version!
/*
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package com.sun.xml.ws.api;
import com.sun.xml.ws.api.server.Container;
import java.net.MalformedURLException;
import java.net.URL;
/**
* Used to locate resources for jax-ws extensions. Using this, extensions
* do not to have to write container specific code to locate resources.
*
* @author Jitendra Kotamraju
*/
public abstract class ResourceLoader {
/**
* Default constructor.
*/
protected ResourceLoader() {}
/**
* Returns the actual location of the resource from the 'resource' arg
* that represents a virtual locaion of a file understood by a container.
* ResourceLoader impl for a Container knows how to map this
* virtual location to actual location.
*
* Extensions can get hold of this object using {@link Container}.
*
* for e.g.:
*
* ResourceLoader loader = container.getSPI(ResourceLoader.class);
* URL catalog = loader.get("jax-ws-catalog.xml");
*
* A ResourceLoader for servlet environment, may do the following.
*
* URL getResource(String resource) {
* return servletContext.getResource("/WEB-INF/"+resource);
* }
*
*
* @param resource Designates a path that is understood by the container. The
* implementations must support "jax-ws-catalog.xml" resource.
* @return the actual location, if found, or null if not found.
* @throws MalformedURLException if there is an error in creating URL
*/
public abstract URL getResource(String resource) throws MalformedURLException;
}