Top Description Inners Fields Methods
org.apache.tomcat.util.file

public Interface ConfigurationSource

Known Direct Implementers
org.apache.catalina.startup.CatalinaBaseConfigurationSource
Imports
java.io.File, .FileInputStream, .FileNotFoundException, .IOException, .InputStream, java.net.MalformedURLException, .URI, .URL, .URLConnection, org.apache.tomcat.util.buf.UriUtil

Abstracts configuration file storage. Allows Tomcat embedding using the regular configuration style. This abstraction aims to be very simple and does not cover resource listing, which is usually used for dynamic deployments that are usually not used when embedding, as well as resource writing.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ConfigurationSource.Resource

Represents a resource: a stream to the resource associated with its URI.

Field Summary

Modifier and TypeField and Description
public static final ConfigurationSource

Method Summary

Modifier and TypeMethod and Description
public default ConfigurationSource.Resource

Returns:

the resource as an InputStream
getConfResource
(String
The resource name
name
)

Get a resource, based on the conf path.

public ConfigurationSource.Resource

Returns:

the resource
getResource
(String
The resource name
name
)

Get a resource, not based on the conf path.

public default ConfigurationSource.Resource

Returns:

the server.xml as an InputStream
getServerXml
()

Returns the contents of the main conf/server.xml file.

public default ConfigurationSource.Resource

Returns:

the web.xml as an InputStream
getSharedWebXml
()

Returns the contents of the shared conf/web.xml file.

public URI

Returns:

a URI representing the resource location
getURI
(String
The resource name
name
)

Get a URI to the given resource.

Field Detail

DEFAULTback to summary
public static final ConfigurationSource DEFAULT

Method Detail

getConfResourceback to summary
public default ConfigurationSource.Resource getConfResource(String name) throws IOException

Get a resource, based on the conf path.

Parameters
name:String

The resource name

Returns:ConfigurationSource.Resource

the resource as an InputStream

Exceptions
IOException:
if an error occurs or if the resource does not exist
getResourceback to summary
public ConfigurationSource.Resource getResource(String name) throws IOException

Get a resource, not based on the conf path.

Parameters
name:String

The resource name

Returns:ConfigurationSource.Resource

the resource

Exceptions
IOException:
if an error occurs or if the resource does not exist
getServerXmlback to summary
public default ConfigurationSource.Resource getServerXml() throws IOException

Returns the contents of the main conf/server.xml file.

Returns:ConfigurationSource.Resource

the server.xml as an InputStream

Exceptions
IOException:
if an error occurs or if the resource does not exist
getSharedWebXmlback to summary
public default ConfigurationSource.Resource getSharedWebXml() throws IOException

Returns the contents of the shared conf/web.xml file. This usually contains the declaration of the default and JSP servlets.

Returns:ConfigurationSource.Resource

the web.xml as an InputStream

Exceptions
IOException:
if an error occurs or if the resource does not exist
getURIback to summary
public URI getURI(String name)

Get a URI to the given resource. Unlike getResource, this will also return URIs to locations where no resource exists.

Parameters
name:String

The resource name

Returns:URI

a URI representing the resource location

org.apache.tomcat.util.file back to summary

public Class ConfigurationSource.Resource

extends Object
implements AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable

Represents a resource: a stream to the resource associated with its URI.

Field Summary

Modifier and TypeField and Description
private final InputStream
private final URI

Constructor Summary

AccessConstructor and Description
public
Resource(InputStream inputStream, URI uri)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

public InputStream
public long
public URI
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

inputStreamback to summary
private final InputStream inputStream
uriback to summary
private final URI uri

Constructor Detail

Resourceback to summary
public Resource(InputStream inputStream, URI uri)

Method Detail

closeback to summary
public void close() throws IOException

Implements java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
getInputStreamback to summary
public InputStream getInputStream()
getLastModifiedback to summary
public long getLastModified() throws MalformedURLException, IOException
getURIback to summary
public URI getURI()