You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/02/17 11:20:15 UTC
[tomcat] 02/02: Clean-up. Fix Javdoc warnings on newer JREs. Align
with 8.5.x.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit d7bd7729b686929e33559e16635e8a235dcecf48
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Feb 17 11:17:14 2020 +0000
Clean-up. Fix Javdoc warnings on newer JREs. Align with 8.5.x.
---
java/org/apache/catalina/core/StandardContext.java | 550 +++++++++------------
1 file changed, 244 insertions(+), 306 deletions(-)
diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java
index 85a6147..d96deab 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -14,8 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
package org.apache.catalina.core;
import java.io.BufferedReader;
@@ -201,7 +199,6 @@ public class StandardContext extends ContainerBase
// ----------------------------------------------------- Instance Variables
-
/**
* Allow multipart/form-data requests to be parsed even when the
* target servlet doesn't specify @MultipartConfig or have a
@@ -259,7 +256,6 @@ public class StandardContext extends ContainerBase
* The set of application listeners that are required to have limited access
* to ServletContext methods. See Servlet 3.0 section 4.4.
*/
-
private final Set<Object> noPluggabilityListeners = new HashSet<Object>();
/**
@@ -767,6 +763,7 @@ public class StandardContext extends ContainerBase
*/
private boolean webXmlNamespaceAware = Globals.STRICT_SERVLET_COMPLIANCE;
+
/**
* Attribute value used to turn on/off TLD processing
*/
@@ -867,12 +864,10 @@ public class StandardContext extends ContainerBase
/**
* If an HttpClient keep-alive timer thread has been started by this web
* application and is still running, should Tomcat change the context class
- * loader from the current
- * {@link org.apache.catalina.loader.WebappClassLoaderBase} to
- * {@link org.apache.catalina.loader.WebappClassLoaderBase#parent} to
- * prevent a memory leak? Note that the keep-alive timer thread will stop on
- * its own once the keep-alives all expire however, on a busy system that
- * might not happen for some time.
+ * loader from the current {@link ClassLoader} to
+ * {@link ClassLoader#getParent()} to prevent a memory leak? Note that the
+ * keep-alive timer thread will stop on its own once the keep-alives all
+ * expire however, on a busy system that might not happen for some time.
*/
private boolean clearReferencesHttpClientKeepAliveThread = true;
@@ -880,7 +875,7 @@ public class StandardContext extends ContainerBase
* Should Tomcat renew the threads of the thread pool when the application
* is stopped to avoid memory leaks because of uncleaned ThreadLocal
* variables. This also requires that the threadRenewalDelay property of the
- * StandardThreadExecutor of ThreadPoolExecutor be set to a positive value.
+ * StandardThreadExecutor or ThreadPoolExecutor be set to a positive value.
*/
private boolean renewThreadsWhenStoppingContext = true;
@@ -1280,7 +1275,7 @@ public class StandardContext extends ContainerBase
/**
- * Is caching allowed ?
+ * @return Is caching allowed?
*/
public boolean isCachingAllowed() {
return cachingAllowed;
@@ -1289,6 +1284,8 @@ public class StandardContext extends ContainerBase
/**
* Set caching allowed flag.
+ *
+ * @param cachingAllowed {@code true} to permit caching
*/
public void setCachingAllowed(boolean cachingAllowed) {
this.cachingAllowed = cachingAllowed;
@@ -1297,6 +1294,8 @@ public class StandardContext extends ContainerBase
/**
* Set allow linking.
+ *
+ * @param allowLinking {@code true} to permit linking
*/
public void setAllowLinking(boolean allowLinking) {
this.allowLinking = allowLinking;
@@ -1304,7 +1303,7 @@ public class StandardContext extends ContainerBase
/**
- * Is linking allowed.
+ * @return Is linking allowed?
*/
public boolean isAllowLinking() {
return allowLinking;
@@ -1364,6 +1363,8 @@ public class StandardContext extends ContainerBase
/**
* Set cache TTL.
+ *
+ * @param cacheTTL Time between cache entry revalidation in milliseconds
*/
public void setCacheTTL(int cacheTTL) {
this.cacheTTL = cacheTTL;
@@ -1371,7 +1372,7 @@ public class StandardContext extends ContainerBase
/**
- * Get cache TTL.
+ * @return cache TTL.
*/
public int getCacheTTL() {
return cacheTTL;
@@ -1379,7 +1380,7 @@ public class StandardContext extends ContainerBase
/**
- * Return the maximum size of the cache in KB.
+ * @return the maximum size of the cache in KB.
*/
public int getCacheMaxSize() {
return cacheMaxSize;
@@ -1388,6 +1389,8 @@ public class StandardContext extends ContainerBase
/**
* Set the maximum size of the cache in KB.
+ *
+ * @param cacheMaxSize Maximum size of the cache in KB
*/
public void setCacheMaxSize(int cacheMaxSize) {
this.cacheMaxSize = cacheMaxSize;
@@ -1395,7 +1398,7 @@ public class StandardContext extends ContainerBase
/**
- * Return the maximum size of objects to be cached in KB.
+ * @return the maximum size of objects to be cached in KB.
*/
public int getCacheObjectMaxSize() {
return cacheObjectMaxSize;
@@ -1404,6 +1407,8 @@ public class StandardContext extends ContainerBase
/**
* Set the maximum size of objects to be placed the cache in KB.
+ *
+ * @param cacheObjectMaxSize Maximum size of the objects in the cache in KB
*/
public void setCacheObjectMaxSize(int cacheObjectMaxSize) {
this.cacheObjectMaxSize = cacheObjectMaxSize;
@@ -1411,7 +1416,7 @@ public class StandardContext extends ContainerBase
/**
- * Return the list of resource aliases.
+ * @return the list of resource aliases.
*/
public String getAliases() {
return this.aliases;
@@ -1434,9 +1439,11 @@ public class StandardContext extends ContainerBase
}
/**
- * Add a URL for a JAR that contains static resources in a
+ * Add a DirContext for a JAR that contains static resources in a
* META-INF/resources directory that should be included in the static
* resources for this context.
+ *
+ * @param altDirContext static resources to be added to this context
*/
public void addResourcesDirContext(DirContext altDirContext) {
if (webappResources instanceof BaseDirContext) {
@@ -1452,6 +1459,8 @@ public class StandardContext extends ContainerBase
* form "/aliasPath1=docBase1,/aliasPath2=docBase2" where aliasPathN must
* include a leading '/' and docBaseN must be an absolute path to either a
* .war file or a directory.
+ *
+ * @param aliases List of aliases for this context
*/
public void setAliases(String aliases) {
this.aliases = aliases;
@@ -1475,11 +1484,11 @@ public class StandardContext extends ContainerBase
/**
* Return the "follow standard delegation model" flag used to configure
* our ClassLoader.
+ *
+ * @return <code>true</code> if classloading delegates to the parent classloader first
*/
public boolean getDelegate() {
-
- return (this.delegate);
-
+ return this.delegate;
}
@@ -1500,17 +1509,17 @@ public class StandardContext extends ContainerBase
/**
- * Returns true if the internal naming support is used.
+ * @return true if the internal naming support is used.
*/
public boolean isUseNaming() {
-
- return (useNaming);
-
+ return useNaming;
}
/**
* Enables or disables naming.
+ *
+ * @param useNaming <code>true</code> to enable the naming environment
*/
public void setUseNaming(boolean useNaming) {
this.useNaming = useNaming;
@@ -1518,14 +1527,12 @@ public class StandardContext extends ContainerBase
/**
- * Returns true if the resources associated with this context are
+ * @return {@code true} if the resources associated with this context are
* filesystem based.
*/
@Deprecated
public boolean isFilesystemBased() {
-
- return (filesystemBased);
-
+ return filesystemBased;
}
@@ -1559,6 +1566,8 @@ public class StandardContext extends ContainerBase
/**
* Add a listener to the end of the list of initialized application event
* listeners.
+ *
+ * @param listener The listener to add
*/
public void addApplicationEventListener(Object listener) {
int len = applicationEventListenersObjects.length;
@@ -1599,6 +1608,8 @@ public class StandardContext extends ContainerBase
/**
* Add a listener to the end of the list of initialized application
* lifecycle listeners.
+ *
+ * @param listener The listener to add
*/
public void addApplicationLifecycleListener(Object listener) {
int len = applicationLifecycleListenersObjects.length;
@@ -1610,22 +1621,18 @@ public class StandardContext extends ContainerBase
/**
- * Return the antiJARLocking flag for this Context.
+ * @return the antiJARLocking flag for this Context.
*/
public boolean getAntiJARLocking() {
-
- return (this.antiJARLocking);
-
+ return this.antiJARLocking;
}
/**
- * Return the antiResourceLocking flag for this Context.
+ * @return the antiResourceLocking flag for this Context.
*/
public boolean getAntiResourceLocking() {
-
- return (this.antiResourceLocking);
-
+ return this.antiResourceLocking;
}
@@ -1662,7 +1669,7 @@ public class StandardContext extends ContainerBase
/**
- * Return the application available flag for this Context.
+ * @return the application available flag for this Context.
*/
@Override
public boolean getAvailable() {
@@ -1674,7 +1681,7 @@ public class StandardContext extends ContainerBase
/**
- * Return the Locale to character set mapper for this Context.
+ * @return the Locale to character set mapper for this Context.
*/
@Override
public CharsetMapper getCharsetMapper() {
@@ -1690,7 +1697,7 @@ public class StandardContext extends ContainerBase
}
}
- return (this.charsetMapper);
+ return this.charsetMapper;
}
@@ -1719,37 +1726,21 @@ public class StandardContext extends ContainerBase
}
- /**
- * Return the URL of the XML descriptor for this context.
- */
@Override
public URL getConfigFile() {
-
- return (this.configFile);
-
+ return this.configFile;
}
- /**
- * Set the URL of the XML descriptor for this context.
- *
- * @param configFile The URL of the XML descriptor for this context.
- */
@Override
public void setConfigFile(URL configFile) {
-
this.configFile = configFile;
}
- /**
- * Return the "correctly configured" flag for this Context.
- */
@Override
public boolean getConfigured() {
-
- return (this.configured);
-
+ return this.configured;
}
@@ -1772,14 +1763,9 @@ public class StandardContext extends ContainerBase
}
- /**
- * Return the "use cookies for session ids" flag.
- */
@Override
public boolean getCookies() {
-
- return (this.cookies);
-
+ return this.cookies;
}
@@ -2005,18 +1991,16 @@ public class StandardContext extends ContainerBase
}
/**
- * Return the display name of this web application.
+ * @return the display name of this web application.
*/
@Override
public String getDisplayName() {
-
- return (this.displayName);
-
+ return this.displayName;
}
/**
- * Return the alternate Deployment Descriptor name.
+ * @return the alternate Deployment Descriptor name.
*/
@Override
public String getAltDDName(){
@@ -2026,6 +2010,8 @@ public class StandardContext extends ContainerBase
/**
* Set an alternate Deployment Descriptor name.
+ *
+ * @param altDDName The new name
*/
@Override
public void setAltDDName(String altDDName) {
@@ -2037,7 +2023,7 @@ public class StandardContext extends ContainerBase
/**
- * Return the compiler classpath.
+ * @return the compiler classpath.
*/
@Deprecated
public String getCompilerClasspath(){
@@ -2047,6 +2033,8 @@ public class StandardContext extends ContainerBase
/**
* Set the compiler classpath.
+ *
+ * @param compilerClasspath The new compiler classpath
*/
@Deprecated
public void setCompilerClasspath(String compilerClasspath) {
@@ -2070,13 +2058,11 @@ public class StandardContext extends ContainerBase
/**
- * Return the distributable flag for this web application.
+ * @return the distributable flag for this web application.
*/
@Override
public boolean getDistributable() {
-
- return (this.distributable);
-
+ return this.distributable;
}
/**
@@ -2096,17 +2082,13 @@ public class StandardContext extends ContainerBase
@Override
public String getDocBase() {
-
- return (this.docBase);
-
+ return this.docBase;
}
@Override
public void setDocBase(String docBase) {
-
this.docBase = docBase;
-
}
/**
@@ -2139,7 +2121,7 @@ public class StandardContext extends ContainerBase
/**
- * Return the boolean on the annotations parsing.
+ * @return the boolean on the annotations parsing.
*/
@Override
public boolean getIgnoreAnnotations() {
@@ -2163,13 +2145,11 @@ public class StandardContext extends ContainerBase
/**
- * Return the login configuration descriptor for this web application.
+ * @return the login configuration descriptor for this web application.
*/
@Override
public LoginConfig getLoginConfig() {
-
- return (this.loginConfig);
-
+ return this.loginConfig;
}
@@ -2222,7 +2202,7 @@ public class StandardContext extends ContainerBase
/**
- * Get the mapper associated with the context.
+ * @return the mapper associated with the context.
*/
@Override
public org.apache.tomcat.util.http.mapper.Mapper getMapper() {
@@ -2231,16 +2211,14 @@ public class StandardContext extends ContainerBase
/**
- * Return the naming resources associated with this web application.
+ * @return the naming resources associated with this web application.
*/
@Override
public NamingResources getNamingResources() {
-
if (namingResources == null) {
setNamingResources(new NamingResources());
}
- return (namingResources);
-
+ return namingResources;
}
@@ -2297,11 +2275,11 @@ public class StandardContext extends ContainerBase
/**
- * Return the context path for this Context.
+ * @return the context path for this Context.
*/
@Override
public String getPath() {
- return (path);
+ return path;
}
@@ -2338,14 +2316,12 @@ public class StandardContext extends ContainerBase
/**
- * Return the public identifier of the deployment descriptor DTD that is
+ * @return the public identifier of the deployment descriptor DTD that is
* currently being parsed.
*/
@Override
public String getPublicId() {
-
- return (this.publicId);
-
+ return this.publicId;
}
@@ -2370,36 +2346,30 @@ public class StandardContext extends ContainerBase
/**
- * Return the reloadable flag for this web application.
+ * @return the reloadable flag for this web application.
*/
@Override
public boolean getReloadable() {
-
- return (this.reloadable);
-
+ return this.reloadable;
}
/**
- * Return the default context override flag for this web application.
+ * @return the default context override flag for this web application.
*/
@Override
public boolean getOverride() {
-
- return (this.override);
-
+ return this.override;
}
/**
- * Return the original document root for this Context. This can be an absolute
+ * @return the original document root for this Context. This can be an absolute
* pathname, a relative pathname, or a URL.
* Is only set as deployment has change docRoot!
*/
public String getOriginalDocBase() {
-
- return (this.originalDocBase);
-
+ return this.originalDocBase;
}
/**
@@ -2415,31 +2385,29 @@ public class StandardContext extends ContainerBase
/**
- * Return the parent class loader (if any) for this web application.
+ * @return the parent class loader (if any) for this web application.
* This call is meaningful only <strong>after</strong> a Loader has
* been configured.
*/
@Override
public ClassLoader getParentClassLoader() {
if (parentClassLoader != null)
- return (parentClassLoader);
+ return parentClassLoader;
if (getPrivileged()) {
return this.getClass().getClassLoader();
} else if (parent != null) {
- return (parent.getParentClassLoader());
+ return parent.getParentClassLoader();
}
- return (ClassLoader.getSystemClassLoader());
+ return ClassLoader.getSystemClassLoader();
}
/**
- * Return the privileged flag for this web application.
+ * @return the privileged flag for this web application.
*/
@Override
public boolean getPrivileged() {
-
- return (this.privileged);
-
+ return this.privileged;
}
@@ -2495,13 +2463,11 @@ public class StandardContext extends ContainerBase
/**
- * Return the "replace welcome files" property.
+ * @return the "replace welcome files" property.
*/
@Deprecated
public boolean isReplaceWelcomeFiles() {
-
- return (this.replaceWelcomeFiles);
-
+ return this.replaceWelcomeFiles;
}
@@ -2522,30 +2488,26 @@ public class StandardContext extends ContainerBase
/**
- * Return the servlet context for which this Context is a facade.
+ * @return the servlet context for which this Context is a facade.
*/
@Override
public ServletContext getServletContext() {
-
if (context == null) {
context = new ApplicationContext(this);
if (altDDName != null)
context.setAttribute(Globals.ALT_DD_ATTR,altDDName);
}
- return (context.getFacade());
-
+ return context.getFacade();
}
/**
- * Return the default session timeout (in minutes) for this
+ * @return the default session timeout (in minutes) for this
* web application.
*/
@Override
public int getSessionTimeout() {
-
- return (this.sessionTimeout);
-
+ return this.sessionTimeout;
}
@@ -2573,13 +2535,11 @@ public class StandardContext extends ContainerBase
/**
- * Return the value of the swallowOutput flag.
+ * @return the value of the swallowOutput flag.
*/
@Override
public boolean getSwallowOutput() {
-
- return (this.swallowOutput);
-
+ return this.swallowOutput;
}
@@ -2603,12 +2563,10 @@ public class StandardContext extends ContainerBase
/**
- * Return the value of the unloadDelay flag.
+ * @return the value of the unloadDelay flag.
*/
public long getUnloadDelay() {
-
- return (this.unloadDelay);
-
+ return this.unloadDelay;
}
@@ -2632,44 +2590,53 @@ public class StandardContext extends ContainerBase
/**
- * Unpack WAR flag accessor.
+ * @return unpack WAR flag.
*/
public boolean getUnpackWAR() {
-
- return (unpackWAR);
-
+ return unpackWAR;
}
/**
* Unpack WAR flag mutator.
+ *
+ * @param unpackWAR <code>true</code> to unpack WARs on deployment
*/
public void setUnpackWAR(boolean unpackWAR) {
-
this.unpackWAR = unpackWAR;
-
}
+ /**
+ * Flag which indicates if bundled context.xml files should be copied to the
+ * config folder. The doesn't occur by default.
+ *
+ * @return <code>true</code> if the <code>META-INF/context.xml</code> file included
+ * in a WAR will be copied to the host configuration base folder on deployment
+ */
public boolean getCopyXML() {
return copyXML;
}
+ /**
+ * Allows copying a bundled context.xml file to the host configuration base
+ * folder on deployment.
+ *
+ * @param copyXML the new flag value
+ */
public void setCopyXML(boolean copyXML) {
this.copyXML = copyXML;
}
/**
- * Return the Java class name of the Wrapper implementation used
+ * @return the Java class name of the Wrapper implementation used
* for servlets registered in this Context.
*/
@Override
public String getWrapperClass() {
-
- return (this.wrapperClassName);
-
+ return this.wrapperClassName;
}
@@ -2752,7 +2719,7 @@ public class StandardContext extends ContainerBase
// ------------------------------------------------------ Public Properties
/**
- * Returns whether or not an attempt to modify the JNDI context will trigger
+ * @return whether or not an attempt to modify the JNDI context will trigger
* an exception or if the request will be ignored.
*/
public boolean getJndiExceptionOnFailedWrite() {
@@ -2764,7 +2731,7 @@ public class StandardContext extends ContainerBase
* Controls whether or not an attempt to modify the JNDI context will
* trigger an exception or if the request will be ignored.
*
- * @param jndiExceptionOnFailedWrite
+ * @param jndiExceptionOnFailedWrite <code>false</code> to avoid an exception
*/
public void setJndiExceptionOnFailedWrite(
boolean jndiExceptionOnFailedWrite) {
@@ -2773,12 +2740,10 @@ public class StandardContext extends ContainerBase
/**
- * Return the Locale to character set mapper class for this Context.
+ * @return the Locale to character set mapper class for this Context.
*/
public String getCharsetMapperClass() {
-
- return (this.charsetMapperClass);
-
+ return this.charsetMapperClass;
}
@@ -2824,12 +2789,10 @@ public class StandardContext extends ContainerBase
}
/**
- * Return the work directory for this Context.
+ * @return the work directory for this Context.
*/
public String getWorkDir() {
-
- return (this.workDir);
-
+ return this.workDir;
}
@@ -2862,7 +2825,7 @@ public class StandardContext extends ContainerBase
/**
- * Save config ?
+ * @return Save config flag (unused)
*/
@Deprecated
public boolean isSaveConfig() {
@@ -2871,7 +2834,9 @@ public class StandardContext extends ContainerBase
/**
- * Set save config flag.
+ * Set save config flag (unused).
+ *
+ * @param saveConfig New flag value
*/
@Deprecated
public void setSaveConfig(boolean saveConfig) {
@@ -2880,7 +2845,7 @@ public class StandardContext extends ContainerBase
/**
- * Return the clearReferencesStatic flag for this Context.
+ * @return the clearReferencesStatic flag for this Context.
*
* @deprecated This option will be removed in Tomcat 8.5
*/
@@ -2912,12 +2877,10 @@ public class StandardContext extends ContainerBase
/**
- * Return the clearReferencesStopThreads flag for this Context.
+ * @return the clearReferencesStopThreads flag for this Context.
*/
public boolean getClearReferencesStopThreads() {
-
- return (this.clearReferencesStopThreads);
-
+ return this.clearReferencesStopThreads;
}
@@ -2939,10 +2902,10 @@ public class StandardContext extends ContainerBase
/**
- * Return the clearReferencesStopTimerThreads flag for this Context.
+ * @return the clearReferencesStopTimerThreads flag for this Context.
*/
public boolean getClearReferencesStopTimerThreads() {
- return (this.clearReferencesStopTimerThreads);
+ return this.clearReferencesStopTimerThreads;
}
@@ -2964,11 +2927,11 @@ public class StandardContext extends ContainerBase
/**
- * Return the clearReferencesHttpClientKeepAliveThread flag for this
+ * @return the clearReferencesHttpClientKeepAliveThread flag for this
* Context.
*/
public boolean getClearReferencesHttpClientKeepAliveThread() {
- return (this.clearReferencesHttpClientKeepAliveThread);
+ return this.clearReferencesHttpClientKeepAliveThread;
}
@@ -3851,6 +3814,8 @@ public class StandardContext extends ContainerBase
/**
* FIXME: Fooling introspection ...
+ *
+ * @return an object which may be utilized for mapping to this component
*/
@Deprecated
public Context findMappingObject() {
@@ -3859,65 +3824,55 @@ public class StandardContext extends ContainerBase
/**
- * Return the message destination with the specified name, if any;
+ * @return the message destination with the specified name, if any;
* otherwise, return <code>null</code>.
*
* @param name Name of the desired message destination
*/
public MessageDestination findMessageDestination(String name) {
-
synchronized (messageDestinations) {
- return (messageDestinations.get(name));
+ return messageDestinations.get(name);
}
-
}
/**
- * Return the set of defined message destinations for this web
+ * @return the set of defined message destinations for this web
* application. If none have been defined, a zero-length array
* is returned.
*/
public MessageDestination[] findMessageDestinations() {
-
synchronized (messageDestinations) {
MessageDestination results[] =
new MessageDestination[messageDestinations.size()];
- return (messageDestinations.values().toArray(results));
+ return messageDestinations.values().toArray(results);
}
-
}
/**
- * Return the message destination ref with the specified name, if any;
+ * @return the message destination ref with the specified name, if any;
* otherwise, return <code>null</code>.
*
* @param name Name of the desired message destination ref
*/
- public MessageDestinationRef
- findMessageDestinationRef(String name) {
-
+ public MessageDestinationRef findMessageDestinationRef(String name) {
return namingResources.findMessageDestinationRef(name);
-
}
/**
- * Return the set of defined message destination refs for this web
+ * @return the set of defined message destination refs for this web
* application. If none have been defined, a zero-length array
* is returned.
*/
- public MessageDestinationRef[]
- findMessageDestinationRefs() {
-
+ public MessageDestinationRef[] findMessageDestinationRefs() {
return namingResources.findMessageDestinationRefs();
-
}
/**
- * Return the MIME type to which the specified extension is mapped,
+ * @return the MIME type to which the specified extension is mapped,
* if any; otherwise return <code>null</code>.
*
* @param extension Extension to map to a MIME type
@@ -3931,23 +3886,20 @@ public class StandardContext extends ContainerBase
/**
- * Return the extensions for which MIME mappings are defined. If there
+ * @return the extensions for which MIME mappings are defined. If there
* are none, a zero-length array is returned.
*/
@Override
public String[] findMimeMappings() {
-
synchronized (mimeMappings) {
String results[] = new String[mimeMappings.size()];
- return
- (mimeMappings.keySet().toArray(results));
+ return mimeMappings.keySet().toArray(results);
}
-
}
/**
- * Return the value for the specified context initialization
+ * @return the value for the specified context initialization
* parameter name, if any; otherwise return <code>null</code>.
*
* @param name Name of the parameter to return
@@ -3959,7 +3911,7 @@ public class StandardContext extends ContainerBase
/**
- * Return the names of all defined context initialization parameters
+ * @return the names of all defined context initialization parameters
* for this Context. If no parameters are defined, a zero-length
* array is returned.
*/
@@ -3977,24 +3929,23 @@ public class StandardContext extends ContainerBase
* is one. Otherwise, return the specified role unchanged.
*
* @param role Security role to map
+ * @return the role name
*/
@Override
public String findRoleMapping(String role) {
-
String realRole = null;
synchronized (roleMappings) {
realRole = roleMappings.get(role);
}
if (realRole != null)
- return (realRole);
+ return realRole;
else
- return (role);
-
+ return role;
}
/**
- * Return <code>true</code> if the specified security role is defined
+ * @return <code>true</code> if the specified security role is defined
* for this application; otherwise return <code>false</code>.
*
* @param role Security role to verify
@@ -4005,57 +3956,50 @@ public class StandardContext extends ContainerBase
synchronized (securityRolesLock) {
for (int i = 0; i < securityRoles.length; i++) {
if (role.equals(securityRoles[i]))
- return (true);
+ return true;
}
}
- return (false);
+ return false;
}
/**
- * Return the security roles defined for this application. If none
+ * @return the security roles defined for this application. If none
* have been defined, a zero-length array is returned.
*/
@Override
public String[] findSecurityRoles() {
-
synchronized (securityRolesLock) {
- return (securityRoles);
+ return securityRoles;
}
-
}
/**
- * Return the servlet name mapped by the specified pattern (if any);
+ * @return the servlet name mapped by the specified pattern (if any);
* otherwise return <code>null</code>.
*
* @param pattern Pattern for which a mapping is requested
*/
@Override
public String findServletMapping(String pattern) {
-
synchronized (servletMappingsLock) {
- return (servletMappings.get(pattern));
+ return servletMappings.get(pattern);
}
-
}
/**
- * Return the patterns of all defined servlet mappings for this
+ * @return the patterns of all defined servlet mappings for this
* Context. If no mappings are defined, a zero-length array is returned.
*/
@Override
public String[] findServletMappings() {
-
synchronized (servletMappingsLock) {
String results[] = new String[servletMappings.size()];
- return
- (servletMappings.keySet().toArray(results));
+ return servletMappings.keySet().toArray(results);
}
-
}
@@ -4073,7 +4017,6 @@ public class StandardContext extends ContainerBase
return errorPage.getLocation();
}
return null;
-
}
@@ -4093,12 +4036,11 @@ public class StandardContext extends ContainerBase
results[i++] = elements.next().intValue();
return (results);
}
-
}
/**
- * Return <code>true</code> if the specified welcome file is defined
+ * @return <code>true</code> if the specified welcome file is defined
* for this Context; otherwise return <code>false</code>.
*
* @param name Welcome file to verify
@@ -4109,16 +4051,16 @@ public class StandardContext extends ContainerBase
synchronized (welcomeFilesLock) {
for (int i = 0; i < welcomeFiles.length; i++) {
if (name.equals(welcomeFiles[i]))
- return (true);
+ return true;
}
}
- return (false);
+ return false;
}
/**
- * Return the set of watched resources for this Context. If none are
+ * @return the set of watched resources for this Context. If none are
* defined, a zero length array will be returned.
*/
@Override
@@ -4130,44 +4072,38 @@ public class StandardContext extends ContainerBase
/**
- * Return the set of welcome files defined for this Context. If none are
+ * @return the set of welcome files defined for this Context. If none are
* defined, a zero-length array is returned.
*/
@Override
public String[] findWelcomeFiles() {
-
synchronized (welcomeFilesLock) {
- return (welcomeFiles);
+ return welcomeFiles;
}
-
}
/**
- * Return the set of LifecycleListener classes that will be added to
+ * @return the set of LifecycleListener classes that will be added to
* newly created Wrappers automatically.
*/
@Override
public String[] findWrapperLifecycles() {
-
synchronized (wrapperLifecyclesLock) {
- return (wrapperLifecycles);
+ return wrapperLifecycles;
}
-
}
/**
- * Return the set of ContainerListener classes that will be added to
+ * @return the set of ContainerListener classes that will be added to
* newly created Wrappers automatically.
*/
@Override
public String[] findWrapperListeners() {
-
synchronized (wrapperListenersLock) {
- return (wrapperListeners);
+ return wrapperListeners;
}
-
}
@@ -4262,7 +4198,6 @@ public class StandardContext extends ContainerBase
fireContainerEvent("removeApplicationListener", listener);
// FIXME - behavior if already started?
-
}
@@ -4390,7 +4325,6 @@ public class StandardContext extends ContainerBase
}
}
fireContainerEvent("removeErrorPage", errorPage);
-
}
@@ -4939,7 +4873,7 @@ public class StandardContext extends ContainerBase
private int insertPoint = 0;
/**
- * Return the set of filter mappings.
+ * @return The set of filter mappings
*/
public FilterMap[] asArray() {
synchronized (lock) {
@@ -5017,44 +4951,44 @@ public class StandardContext extends ContainerBase
/**
* Configure and initialize the set of filters for this Context.
- * Return <code>true</code> if all filter initialization completed
+ * @return <code>true</code> if all filter initialization completed
* successfully, or <code>false</code> otherwise.
*/
public boolean filterStart() {
- if (getLogger().isDebugEnabled())
+ if (getLogger().isDebugEnabled()) {
getLogger().debug("Starting filters");
+ }
// Instantiate and record a FilterConfig for each defined filter
boolean ok = true;
synchronized (filterConfigs) {
filterConfigs.clear();
- for (Entry<String, FilterDef> entry : filterDefs.entrySet()) {
+ for (Entry<String,FilterDef> entry : filterDefs.entrySet()) {
String name = entry.getKey();
- if (getLogger().isDebugEnabled())
+ if (getLogger().isDebugEnabled()) {
getLogger().debug(" Starting filter '" + name + "'");
- ApplicationFilterConfig filterConfig = null;
+ }
try {
- filterConfig =
- new ApplicationFilterConfig(this, entry.getValue());
+ ApplicationFilterConfig filterConfig =
+ new ApplicationFilterConfig(this, entry.getValue());
filterConfigs.put(name, filterConfig);
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
ExceptionUtils.handleThrowable(t);
- getLogger().error
- (sm.getString("standardContext.filterStart", name), t);
+ getLogger().error(sm.getString(
+ "standardContext.filterStart", name), t);
ok = false;
}
}
}
- return (ok);
-
+ return ok;
}
/**
* Finalize and release the set of filters for this Context.
- * Return <code>true</code> if all filter finalization completed
+ * @return <code>true</code> if all filter finalization completed
* successfully, or <code>false</code> otherwise.
*/
public boolean filterStop() {
@@ -5072,7 +5006,7 @@ public class StandardContext extends ContainerBase
}
filterConfigs.clear();
}
- return (true);
+ return true;
}
@@ -5082,17 +5016,17 @@ public class StandardContext extends ContainerBase
* specified filter name, if any; otherwise return <code>null</code>.
*
* @param name Name of the desired filter
+ * @return the filter config object
*/
public FilterConfig findFilterConfig(String name) {
-
- return (filterConfigs.get(name));
-
+ return filterConfigs.get(name);
}
/**
* Configure the set of instantiated application event listeners
- * for this Context. Return <code>true</code> if all listeners wre
+ * for this Context.
+ * @return <code>true</code> if all listeners wre
* initialized successfully, or <code>false</code> otherwise.
*/
public boolean listenerStart() {
@@ -5126,7 +5060,7 @@ public class StandardContext extends ContainerBase
}
if (!ok) {
getLogger().error(sm.getString("standardContext.applicationSkipped"));
- return (false);
+ return false;
}
// Sort listeners in two arrays
@@ -5206,14 +5140,14 @@ public class StandardContext extends ContainerBase
ok = false;
}
}
- return (ok);
+ return ok;
}
/**
* Send an application stop event to all interested listeners.
- * Return <code>true</code> if all events were sent successfully,
+ * @return <code>true</code> if all events were sent successfully,
* or <code>false</code> otherwise.
*/
public boolean listenerStop() {
@@ -5223,7 +5157,7 @@ public class StandardContext extends ContainerBase
boolean ok = true;
Object listeners[] = getApplicationLifecycleListeners();
- if (listeners != null) {
+ if (listeners != null && listeners.length > 0) {
ServletContextEvent event = new ServletContextEvent(getServletContext());
ServletContextEvent tldEvent = null;
if (noPluggabilityServletContext != null) {
@@ -5302,8 +5236,8 @@ public class StandardContext extends ContainerBase
/**
* Allocate resources, including proxy.
- * Return <code>true</code> if initialization was successfull,
- * or <code>false</code> otherwise.
+ * @return <code>true</code> if initialization was successfull,
+ * or <code>false</code> otherwise.
*/
public boolean resourcesStart() {
@@ -5373,6 +5307,7 @@ public class StandardContext extends ContainerBase
/**
* Deallocate resources and destroy proxy.
+ * @return <code>true</code> if no error occurred
*/
public boolean resourcesStop() {
@@ -5411,8 +5346,7 @@ public class StandardContext extends ContainerBase
super.setResources(null);
- return (ok);
-
+ return ok;
}
@@ -5422,6 +5356,7 @@ public class StandardContext extends ContainerBase
*
* @param children Array of wrappers for all currently defined
* servlets (including those not declared load on startup)
+ * @return <code>true</code> if load on startup was considered successful
*/
public boolean loadOnStartup(Container children[]) {
@@ -5572,13 +5507,12 @@ public class StandardContext extends ContainerBase
ClassLoader oldCCL = bindThread();
try {
-
if (ok) {
-
// Start our subordinate components, if any
Loader loader = getLoaderInternal();
- if ((loader != null) && (loader instanceof Lifecycle))
+ if (loader instanceof Lifecycle) {
((Lifecycle) loader).start();
+ }
// since the loader just started, the webapp classloader is now
// created.
@@ -5627,7 +5561,7 @@ public class StandardContext extends ContainerBase
Boolean.valueOf((getCluster() != null)),
Boolean.valueOf(distributable)));
}
- if ( (getCluster() != null) && distributable) {
+ if ((getCluster() != null) && distributable) {
try {
contextManager = getCluster().createManager(getName());
} catch (Exception ex) {
@@ -5726,7 +5660,7 @@ public class StandardContext extends ContainerBase
try {
// Start manager
Manager manager = getManagerInternal();
- if ((manager != null) && (manager instanceof Lifecycle)) {
+ if (manager instanceof Lifecycle) {
((Lifecycle) getManager()).start();
}
} catch(Exception e) {
@@ -5907,7 +5841,6 @@ public class StandardContext extends ContainerBase
ClassLoader oldCCL = bindThread();
try {
-
// Stop our child containers, if any
final Container[] children = findChildren();
@@ -6097,9 +6030,6 @@ public class StandardContext extends ContainerBase
log.debug("resetContext " + getObjectName());
}
- /**
- * Return a String representation of this component.
- */
@Override
public String toString() {
@@ -6118,7 +6048,6 @@ public class StandardContext extends ContainerBase
// ------------------------------------------------------ Protected Methods
-
/**
* Adjust the URL pattern to begin with a leading slash, if appropriate
* (i.e. we are running a servlet 2.2 application). Otherwise, return
@@ -6126,25 +6055,28 @@ public class StandardContext extends ContainerBase
*
* @param urlPattern The URL pattern to be adjusted (if needed)
* and returned
+ * @return the URL pattern with a leading slash if needed
*/
protected String adjustURLPattern(String urlPattern) {
if (urlPattern == null)
- return (urlPattern);
+ return urlPattern;
if (urlPattern.startsWith("/") || urlPattern.startsWith("*."))
- return (urlPattern);
+ return urlPattern;
if (!isServlet22())
- return (urlPattern);
+ return urlPattern;
if(log.isDebugEnabled())
log.debug(sm.getString("standardContext.urlPattern.patternWarning",
urlPattern));
- return ("/" + urlPattern);
+ return "/" + urlPattern;
}
/**
* Are we processing a version 2.2 deployment descriptor?
+ *
+ * @return <code>true</code> if running a legacy Servlet 2.2 application
*/
@Override
public boolean isServlet22() {
@@ -6220,8 +6152,8 @@ public class StandardContext extends ContainerBase
/**
- * Return a File object representing the base directory for the
- * entire servlet container (i.e. the Engine container if present).
+ * @return a File object representing the base directory for the
+ * entire servlet container (i.e. the Engine container if present)
*/
protected File engineBase() {
String base=System.getProperty(Globals.CATALINA_BASE_PROP);
@@ -6235,7 +6167,7 @@ public class StandardContext extends ContainerBase
/**
* Bind current thread, both for CL purposes and for JNDI ENC support
- * during : startup, shutdown and realoading of the context.
+ * during : startup, shutdown and reloading of the context.
*
* @return the previous context class loader
*/
@@ -6264,12 +6196,13 @@ public class StandardContext extends ContainerBase
}
return oldContextClassLoader;
-
}
/**
- * Unbind thread.
+ * Unbind thread and restore the specified context classloader.
+ *
+ * @param oldContextClassLoader the previous classloader
*/
protected void unbindThread(ClassLoader oldContextClassLoader) {
@@ -6285,7 +6218,7 @@ public class StandardContext extends ContainerBase
/**
- * Get base path.
+ * @return base path.
*/
protected String getBasePath() {
String docBase = null;
@@ -6315,7 +6248,7 @@ public class StandardContext extends ContainerBase
/**
- * Get app base.
+ * @return app base.
*/
protected String getAppBase() {
String appBase = null;
@@ -6334,6 +6267,8 @@ public class StandardContext extends ContainerBase
/**
* Get naming context full name.
+ *
+ * @return the context name
*/
private String getNamingContextName() {
if (namingContextName == null) {
@@ -6360,6 +6295,8 @@ public class StandardContext extends ContainerBase
/**
* Naming context listener accessor.
+ *
+ * @return the naming context listener associated with the webapp
*/
public NamingContextListener getNamingContextListener() {
return namingContextListener;
@@ -6368,6 +6305,8 @@ public class StandardContext extends ContainerBase
/**
* Naming context listener setter.
+ *
+ * @param namingContextListener the new naming context listener
*/
public void setNamingContextListener(NamingContextListener namingContextListener) {
this.namingContextListener = namingContextListener;
@@ -6375,17 +6314,16 @@ public class StandardContext extends ContainerBase
/**
- * Return the request processing paused flag for this Context.
+ * @return the request processing paused flag for this Context.
*/
@Override
public boolean getPaused() {
-
- return (this.paused);
-
+ return this.paused;
}
/**
+ * @return Hostname
* @deprecated Unused. Will be removed in Tomcat 8.0.x.
*/
@Deprecated
@@ -6623,13 +6561,14 @@ public class StandardContext extends ContainerBase
* for conformance with specification requirements.
*
* @param urlPattern URL pattern to be validated
+ * @return <code>true</code> if the URL pattern is conformant
*/
private boolean validateURLPattern(String urlPattern) {
if (urlPattern == null)
- return (false);
+ return false;
if (urlPattern.indexOf('\n') >= 0 || urlPattern.indexOf('\r') >= 0) {
- return (false);
+ return false;
}
if (urlPattern.equals("")) {
return true;
@@ -6637,16 +6576,15 @@ public class StandardContext extends ContainerBase
if (urlPattern.startsWith("*.")) {
if (urlPattern.indexOf('/') < 0) {
checkUnusualURLPattern(urlPattern);
- return (true);
+ return true;
} else
- return (false);
+ return false;
}
- if ( (urlPattern.startsWith("/")) &&
- (urlPattern.indexOf("*.") < 0)) {
+ if (urlPattern.startsWith("/") && !urlPattern.contains("*.")) {
checkUnusualURLPattern(urlPattern);
- return (true);
+ return true;
} else
- return (false);
+ return false;
}
@@ -6847,7 +6785,8 @@ public class StandardContext extends ContainerBase
}
- /* Add a JMX-NotificationListener
+ /**
+ * Add a JMX NotificationListener
* @see javax.management.NotificationBroadcaster#addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
*/
@Override
@@ -6870,9 +6809,8 @@ public class StandardContext extends ContainerBase
// ------------------------------------------------------------- Attributes
-
/**
- * Return the naming resources associated with this web application.
+ * @return the naming resources associated with this web application.
*/
@Deprecated
public javax.naming.directory.DirContext getStaticResources() {
@@ -6883,8 +6821,8 @@ public class StandardContext extends ContainerBase
/**
- * Return the naming resources associated with this web application.
* FIXME: Fooling introspection ...
+ * @return the naming resources associated with this web application.
*/
@Deprecated
public javax.naming.directory.DirContext findStaticResources() {
@@ -6895,7 +6833,7 @@ public class StandardContext extends ContainerBase
/**
- * Return the naming resources associated with this web application.
+ * @return the naming resources associated with this web application.
*/
public String[] getWelcomeFiles() {
@@ -6905,37 +6843,37 @@ public class StandardContext extends ContainerBase
@Override
- public boolean getXmlNamespaceAware(){
+ public boolean getXmlNamespaceAware() {
return webXmlNamespaceAware;
}
@Override
- public void setXmlNamespaceAware(boolean webXmlNamespaceAware){
+ public void setXmlNamespaceAware(boolean webXmlNamespaceAware) {
this.webXmlNamespaceAware = webXmlNamespaceAware;
}
@Override
- public void setXmlValidation(boolean webXmlValidation){
+ public void setXmlValidation(boolean webXmlValidation) {
this.webXmlValidation = webXmlValidation;
}
@Override
- public boolean getXmlValidation(){
+ public boolean getXmlValidation() {
return webXmlValidation;
}
@Override
- public boolean getTldNamespaceAware(){
+ public boolean getTldNamespaceAware() {
return true;
}
@Override
- public void setTldNamespaceAware(boolean tldNamespaceAware){
+ public void setTldNamespaceAware(boolean tldNamespaceAware) {
// NO-OP;
}
@@ -6953,13 +6891,13 @@ public class StandardContext extends ContainerBase
@Override
- public void setTldValidation(boolean tldValidation){
+ public void setTldValidation(boolean tldValidation) {
this.tldValidation = tldValidation;
}
@Override
- public boolean getTldValidation(){
+ public boolean getTldValidation() {
return tldValidation;
}
@@ -6975,7 +6913,7 @@ public class StandardContext extends ContainerBase
/**
- * Returns the processTlds attribute value.
+ * @return the processTlds attribute value.
*/
public boolean getProcessTlds() {
return processTlds;
@@ -6983,7 +6921,7 @@ public class StandardContext extends ContainerBase
/**
- * Support for "stateManageable" JSR77
+ * @return Support for "stateManageable" JSR77
*/
public boolean isStateManageable() {
return true;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org