/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.catalina; import java.io.InputStream; import java.net.URL; import java.util.List; import java.util.Set; /** * Represents the complete set of resources for a web application. The resources * for a web application comprise of multiple ResourceSets and when looking for * a Resource, the ResourceSets are processed in the following order: *
true if the directory was created, otherwise
* false
*/
boolean mkdir(String path);
/**
* Create a new resource at the requested path using the provided
* InputStream.
*
* @param path The path to be used for the new Resource. It is relative
* to the root of the web application and must start with
* '/'.
* @param is The InputStream that will provide the content for the
* new Resource.
* @param overwrite If true and the resource already exists it
* will be overwritten. If false and the
* resource already exists the write will fail.
*
* @return true if and only if the new Resource is written
*/
boolean write(String path, InputStream is, boolean overwrite);
/**
* Creates a new {@link WebResourceSet} for this {@link WebResourceRoot}
* based on the provided parameters.
*
* @param type The type of {@link WebResourceSet} to create
* @param webAppMount The path within the web application that the
* resources should be published at. It must start
* with '/'.
* @param url The URL of the resource (must locate a JAR, file or
* directory)
* @param internalPath The path within the resource where the content is to
* be found. It must start with '/'.
*/
void createWebResourceSet(ResourceSetType type, String webAppMount, URL url,
String internalPath);
/**
* Creates a new {@link WebResourceSet} for this {@link WebResourceRoot}
* based on the provided parameters.
*
* @param type The type of {@link WebResourceSet} to create
* @param webAppMount The path within the web application that the
* resources should be published at. It must start
* with '/'.
* @param base The location of the resources
* @param archivePath The path within the resource to the archive where
* the content is to be found. If there is no
* archive then this should be null.
* @param internalPath The path within the archive (or the resource if the
* archivePath is null where the
* content is to be found. It must start with '/'.
*/
void createWebResourceSet(ResourceSetType type, String webAppMount,
String base, String archivePath, String internalPath);
/**
* Adds the provided WebResourceSet to this web application as a 'Pre'
* resource.
*
* @param webResourceSet the resource set to use
*/
void addPreResources(WebResourceSet webResourceSet);
/**
* @return the list of WebResourceSet configured to this web application
* as a 'Pre' resource.
*/
WebResourceSet[] getPreResources();
/**
* Adds the provided WebResourceSet to this web application as a 'Jar'
* resource.
*
* @param webResourceSet the resource set to use
*/
void addJarResources(WebResourceSet webResourceSet);
/**
* @return the list of WebResourceSet configured to this web application
* as a 'Jar' resource.
*/
WebResourceSet[] getJarResources();
/**
* Adds the provided WebResourceSet to this web application as a 'Post'
* resource.
*
* @param webResourceSet the resource set to use
*/
void addPostResources(WebResourceSet webResourceSet);
/**
* @return the list of WebResourceSet configured to this web application
* as a 'Post' resource.
*/
WebResourceSet[] getPostResources();
/**
* @return the web application this WebResourceRoot is associated with.
*/
Context getContext();
/**
* Set the web application this WebResourceRoot is associated with.
*
* @param context the associated context
*/
void setContext(Context context);
/**
* Configure if this resources allow the use of symbolic links.
*
* @param allowLinking true if symbolic links are allowed.
*/
void setAllowLinking(boolean allowLinking);
/**
* Determine if this resources allow the use of symbolic links.
*
* @return true if symbolic links are allowed
*/
boolean getAllowLinking();
/**
* Set whether or not caching is permitted for this web application.
*
* @param cachingAllowed true to enable caching, else
* false
*/
void setCachingAllowed(boolean cachingAllowed);
/**
* @return true if caching is permitted for this web application.
*/
boolean isCachingAllowed();
/**
* Set the Time-To-Live (TTL) for cache entries.
*
* @param ttl TTL in milliseconds
*/
void setCacheTtl(long ttl);
/**
* Get the Time-To-Live (TTL) for cache entries.
*
* @return TTL in milliseconds
*/
long getCacheTtl();
/**
* Set the maximum permitted size for the cache.
*
* @param cacheMaxSize Maximum cache size in kilobytes
*/
void setCacheMaxSize(long cacheMaxSize);
/**
* Get the maximum permitted size for the cache.
*
* @return Maximum cache size in kilobytes
*/
long getCacheMaxSize();
/**
* Set the maximum permitted size for a single object in the cache. Note
* that the maximum size in bytes may not exceed {@link Integer#MAX_VALUE}.
*
* @param cacheObjectMaxSize Maximum size for a single cached object in
* kilobytes
*/
void setCacheObjectMaxSize(int cacheObjectMaxSize);
/**
* Get the maximum permitted size for a single object in the cache. Note
* that the maximum size in bytes may not exceed {@link Integer#MAX_VALUE}.
*
* @return Maximum size for a single cached object in kilobytes
*/
int getCacheObjectMaxSize();
/**
* Controls whether the track locked files feature is enabled. If enabled,
* all calls to methods that return objects that lock a file and need to be
* closed to release that lock (e.g. {@link WebResource#getInputStream()}
* will perform a number of additional tasks.
*