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
The following commit(s) were added to refs/heads/7.0.x by this push: new 46f9902 Javadoc / trivial clean-up / align with 8.5.x/9.0.x 46f9902 is described below commit 46f99021a088206cf3ee34867cc2438a1d46d923 Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Feb 19 11:19:54 2020 +0000 Javadoc / trivial clean-up / align with 8.5.x/9.0.x --- .../catalina/core/ApplicationFilterConfig.java | 20 ++---- .../catalina/core/ApplicationFilterFactory.java | 78 ++++++++++------------ .../core/ApplicationSessionCookieConfig.java | 15 +++-- 3 files changed, 52 insertions(+), 61 deletions(-) diff --git a/java/org/apache/catalina/core/ApplicationFilterConfig.java b/java/org/apache/catalina/core/ApplicationFilterConfig.java index 47f65be..79523d1 100644 --- a/java/org/apache/catalina/core/ApplicationFilterConfig.java +++ b/java/org/apache/catalina/core/ApplicationFilterConfig.java @@ -14,8 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.apache.catalina.core; @@ -152,11 +150,11 @@ public final class ApplicationFilterConfig implements FilterConfig, Serializable */ @Override public String getFilterName() { - return (filterDef.getFilterName()); + return filterDef.getFilterName(); } /** - * Return the class of the filter we are configuring. + * @return The class of the filter we are configuring. */ public String getFilterClass() { return filterDef.getFilterClass(); @@ -174,7 +172,7 @@ public final class ApplicationFilterConfig implements FilterConfig, Serializable Map<String,String> map = filterDef.getParameterMap(); if (map == null) { - return (null); + return null; } return map.get(name); @@ -214,15 +212,13 @@ public final class ApplicationFilterConfig implements FilterConfig, Serializable */ @Override public String toString() { - StringBuilder sb = new StringBuilder("ApplicationFilterConfig["); sb.append("name="); sb.append(filterDef.getFilterName()); sb.append(", filterClass="); sb.append(filterDef.getFilterClass()); sb.append("]"); - return (sb.toString()); - + return sb.toString(); } // --------------------------------------------------------- Public Methods @@ -257,7 +253,7 @@ public final class ApplicationFilterConfig implements FilterConfig, Serializable // Return the existing filter instance, if any if (this.filter != null) - return (this.filter); + return this.filter; // Identify the class loader we will be using String filterClass = filterDef.getFilterClass(); @@ -265,7 +261,7 @@ public final class ApplicationFilterConfig implements FilterConfig, Serializable initFilter(); - return (this.filter); + return this.filter; } @@ -293,9 +289,7 @@ public final class ApplicationFilterConfig implements FilterConfig, Serializable * Return the filter definition we are configured for. */ FilterDef getFilterDef() { - - return (this.filterDef); - + return this.filterDef; } /** diff --git a/java/org/apache/catalina/core/ApplicationFilterFactory.java b/java/org/apache/catalina/core/ApplicationFilterFactory.java index 281f572..e97fc48 100644 --- a/java/org/apache/catalina/core/ApplicationFilterFactory.java +++ b/java/org/apache/catalina/core/ApplicationFilterFactory.java @@ -14,11 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.apache.catalina.core; - import javax.servlet.DispatcherType; import javax.servlet.Servlet; import javax.servlet.ServletRequest; @@ -37,13 +34,11 @@ import org.apache.tomcat.util.ExceptionUtils; * @author Greg Murray * @author Remy Maucherat */ - public final class ApplicationFilterFactory { // -------------------------------------------------------------- Constants - /** * @deprecated Use {@link Globals#DISPATCHER_TYPE_ATTR} */ @@ -63,15 +58,14 @@ public final class ApplicationFilterFactory { // ----------------------------------------------------------- Constructors private ApplicationFilterFactory() { - // Prevent instantiation outside of the getInstanceMethod(). + // Prevent instance creation. This is a utility class. } // --------------------------------------------------------- Public Methods - /** - * Return the factory instance. + * @return the factory instance. */ public static ApplicationFilterFactory getInstance() { if (factory == null) { @@ -87,7 +81,11 @@ public final class ApplicationFilterFactory { * a filter chain at all, return <code>null</code>. * * @param request The servlet request we are processing + * @param wrapper The wrapper managing the servlet instance * @param servlet The servlet instance to be wrapped + * + * @return The configured FilterChain instance or null if none is to be + * executed. */ public ApplicationFilterChain createFilterChain (ServletRequest request, Wrapper wrapper, Servlet servlet) { @@ -108,7 +106,7 @@ public final class ApplicationFilterFactory { // If there is no servlet to execute, return null if (servlet == null) - return (null); + return null; boolean comet = false; @@ -146,7 +144,7 @@ public final class ApplicationFilterFactory { // If there are no filter mappings, we are done if ((filterMaps == null) || (filterMaps.length == 0)) - return (filterChain); + return filterChain; // Acquire the information we will need to match filter mappings String servletName = wrapper.getName(); @@ -214,8 +212,7 @@ public final class ApplicationFilterFactory { } // Return the completed filter chain - return (filterChain); - + return filterChain; } @@ -230,27 +227,27 @@ public final class ApplicationFilterFactory { * @param filterMap Filter mapping being checked * @param requestPath Context-relative request path of this request */ - private boolean matchFiltersURL(FilterMap filterMap, String requestPath) { + private static boolean matchFiltersURL(FilterMap filterMap, String requestPath) { // Check the specific "*" special URL pattern, which also matches // named dispatches if (filterMap.getMatchAllUrlPatterns()) - return (true); + return true; if (requestPath == null) - return (false); + return false; // Match on context relative request path String[] testPaths = filterMap.getURLPatterns(); for (int i = 0; i < testPaths.length; i++) { if (matchFiltersURL(testPaths[i], requestPath)) { - return (true); + return true; } } // No match - return (false); + return false; } @@ -263,28 +260,28 @@ public final class ApplicationFilterFactory { * @param testPath URL mapping being checked * @param requestPath Context-relative request path of this request */ - private boolean matchFiltersURL(String testPath, String requestPath) { + private static boolean matchFiltersURL(String testPath, String requestPath) { if (testPath == null) - return (false); + return false; // Case 1 - Exact Match if (testPath.equals(requestPath)) - return (true); + return true; // Case 2 - Path Match ("/.../*") if (testPath.equals("/*")) - return (true); + return true; if (testPath.endsWith("/*")) { if (testPath.regionMatches(0, requestPath, 0, testPath.length() - 2)) { if (requestPath.length() == (testPath.length() - 2)) { - return (true); + return true; } else if ('/' == requestPath.charAt(testPath.length() - 2)) { - return (true); + return true; } } - return (false); + return false; } // Case 3 - Extension Match @@ -295,13 +292,13 @@ public final class ApplicationFilterFactory { && (period != requestPath.length() - 1) && ((requestPath.length() - period) == (testPath.length() - 1))) { - return (testPath.regionMatches(2, requestPath, period + 1, - testPath.length() - 2)); + return testPath.regionMatches(2, requestPath, period + 1, + testPath.length() - 2); } } // Case 4 - "Default" Match - return (false); // NOTE - Not relevant for selecting filters + return false; // NOTE - Not relevant for selecting filters } @@ -314,20 +311,20 @@ public final class ApplicationFilterFactory { * @param filterMap Filter mapping being checked * @param servletName Servlet name being checked */ - private boolean matchFiltersServlet(FilterMap filterMap, + private static boolean matchFiltersServlet(FilterMap filterMap, String servletName) { if (servletName == null) { - return (false); + return false; } // Check the specific "*" special servlet name else if (filterMap.getMatchAllServletNames()) { - return (true); + return true; } else { String[] servletNames = filterMap.getServletNames(); for (int i = 0; i < servletNames.length; i++) { if (servletName.equals(servletNames[i])) { - return (true); + return true; } } return false; @@ -340,41 +337,34 @@ public final class ApplicationFilterFactory { * Convenience method which returns true if the dispatcher type * matches the dispatcher types specified in the FilterMap */ - private boolean matchDispatcher(FilterMap filterMap, DispatcherType type) { + private static boolean matchDispatcher(FilterMap filterMap, DispatcherType type) { switch (type) { - case FORWARD : { + case FORWARD : if ((filterMap.getDispatcherMapping() & FilterMap.FORWARD) != 0) { return true; } break; - } - case INCLUDE : { + case INCLUDE : if ((filterMap.getDispatcherMapping() & FilterMap.INCLUDE) != 0) { return true; } break; - } - case REQUEST : { + case REQUEST : if ((filterMap.getDispatcherMapping() & FilterMap.REQUEST) != 0) { return true; } break; - } - case ERROR : { + case ERROR : if ((filterMap.getDispatcherMapping() & FilterMap.ERROR) != 0) { return true; } break; - } - case ASYNC : { + case ASYNC : if ((filterMap.getDispatcherMapping() & FilterMap.ASYNC) != 0) { return true; } break; - } } return false; } - - } diff --git a/java/org/apache/catalina/core/ApplicationSessionCookieConfig.java b/java/org/apache/catalina/core/ApplicationSessionCookieConfig.java index 1ec24aa..fad75d0 100644 --- a/java/org/apache/catalina/core/ApplicationSessionCookieConfig.java +++ b/java/org/apache/catalina/core/ApplicationSessionCookieConfig.java @@ -158,6 +158,7 @@ public class ApplicationSessionCookieConfig implements SessionCookieConfig { * @param sessionId The ID of the session for which the cookie will be * created * @param secure Should session cookie be configured as secure + * @return the cookie for the session */ public static Cookie createSessionCookie(Context context, String sessionId, boolean secure) { @@ -227,7 +228,10 @@ public class ApplicationSessionCookieConfig implements SessionCookieConfig { /** * Determine the name to use for the session cookie for the provided * context. - * @param context + * + * @param context The Context for the web application + * + * @return The name to use for the session cookie * * @deprecated Replaced by * {@link SessionConfig#getSessionCookieName(Context)}. This @@ -239,9 +243,12 @@ public class ApplicationSessionCookieConfig implements SessionCookieConfig { } /** - * Determine the name to use for the session cookie for the provided - * context. - * @param context + * Determine the name to use for the session ID URI parameter name for the + * provided context. + * + * @param context The Context for the web application + * + * @return The name to use for the URI parameter * * @deprecated Replaced by * {@link SessionConfig#getSessionUriParamName(Context)}. This --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org