amyroh 2002/10/23 12:57:31 Modified: catalina/src/share/org/apache/catalina/core ApplicationContext.java StandardContext.java StandardContextMapper.java catalina/src/share/org/apache/catalina/servlets CGIServlet.java Log: Reduced visibility of fields/methods where appropriate. Revision Changes Path 1.4 +61 -62 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ApplicationContext.java 9 Oct 2002 08:01:11 -0000 1.3 +++ ApplicationContext.java 23 Oct 2002 19:57:30 -0000 1.4 @@ -333,32 +333,6 @@ /** - * Clear all application-created attributes. - */ - public void clearAttributes() { - - // Create list of attributes to be removed - ArrayList list = new ArrayList(); - synchronized (attributes) { - Iterator iter = attributes.keySet().iterator(); - while (iter.hasNext()) { - list.add(iter.next()); - } - } - - // Remove application originated attributes - // (read only attributes will be left in place) - Iterator keys = list.iterator(); - while (keys.hasNext()) { - String key = (String) keys.next(); - removeAttribute(key); - } - - - } - - - /** * Return the resources object that is mapped to a specified path. * The path must begin with a "/" and is interpreted as relative to the * current context root. @@ -370,19 +344,6 @@ } - /** - * Set an attribute as read only. - */ - public void setAttributeReadOnly(String name) { - - synchronized (attributes) { - if (attributes.containsKey(name)) - readOnlyAttributes.put(name, name); - } - - } - - // ------------------------------------------------- ServletContext Methods @@ -997,6 +958,31 @@ /** + * Clear all application-created attributes. + */ + void clearAttributes() { + + // Create list of attributes to be removed + ArrayList list = new ArrayList(); + synchronized (attributes) { + Iterator iter = attributes.keySet().iterator(); + while (iter.hasNext()) { + list.add(iter.next()); + } + } + + // Remove application originated attributes + // (read only attributes will be left in place) + Iterator keys = list.iterator(); + while (keys.hasNext()) { + String key = (String) keys.next(); + removeAttribute(key); + } + + } + + + /** * Return the facade associated with this ApplicationContext. */ ServletContext getFacade() { @@ -1006,6 +992,19 @@ } + /** + * Set an attribute as read only. + */ + void setAttributeReadOnly(String name) { + + synchronized (attributes) { + if (attributes.containsKey(name)) + readOnlyAttributes.put(name, name); + } + + } + + // -------------------------------------------------------- Private Methods @@ -1020,26 +1019,26 @@ */ private String normalize(String path) { - String normalized = path; + String normalized = path; - // Normalize the slashes and add leading slash if necessary - if (normalized.indexOf('\\') >= 0) - normalized = normalized.replace('\\', '/'); - - // Resolve occurrences of "/../" in the normalized path - while (true) { - int index = normalized.indexOf("/../"); - if (index < 0) - break; - if (index == 0) - return (null); // Trying to go outside our context - int index2 = normalized.lastIndexOf('/', index - 1); - normalized = normalized.substring(0, index2) + - normalized.substring(index + 3); - } + // Normalize the slashes and add leading slash if necessary + if (normalized.indexOf('\\') >= 0) + normalized = normalized.replace('\\', '/'); + + // Resolve occurrences of "/../" in the normalized path + while (true) { + int index = normalized.indexOf("/../"); + if (index < 0) + break; + if (index == 0) + return (null); // Trying to go outside our context + int index2 = normalized.lastIndexOf('/', index - 1); + normalized = normalized.substring(0, index2) + + normalized.substring(index + 3); + } - // Return the normalized path that we have completed - return (normalized); + // Return the normalized path that we have completed + return (normalized); } @@ -1124,7 +1123,7 @@ /** * Get full path, based on the host name and the context path. */ - public static String getJNDIUri(String hostName, String path) { + private static String getJNDIUri(String hostName, String path) { if (!path.startsWith("/")) return "/" + hostName + "/" + path; else 1.9 +25 -25 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- StandardContext.java 29 Sep 2002 15:21:21 -0000 1.8 +++ StandardContext.java 23 Oct 2002 19:57:30 -0000 1.9 @@ -496,13 +496,13 @@ /** * Caching allowed flag. */ - protected boolean cachingAllowed = true; + private boolean cachingAllowed = true; /** * Non proxied resources. */ - protected DirContext webappResources = null; + private DirContext webappResources = null; // ----------------------------------------------------- Context Properties @@ -4062,25 +4062,25 @@ * Get naming context full name. */ private String getNamingContextName() { - if (namingContextName == null) { - Container parent = getParent(); - if (parent == null) { - namingContextName = getName(); - } else { - Stack stk = new Stack(); - StringBuffer buff = new StringBuffer(); - while (parent != null) { - stk.push(parent.getName()); - parent = parent.getParent(); - } - while (!stk.empty()) { - buff.append("/" + stk.pop()); - } - buff.append(getName()); - namingContextName = buff.toString(); - } - } - return namingContextName; + if (namingContextName == null) { + Container parent = getParent(); + if (parent == null) { + namingContextName = getName(); + } else { + Stack stk = new Stack(); + StringBuffer buff = new StringBuffer(); + while (parent != null) { + stk.push(parent.getName()); + parent = parent.getParent(); + } + while (!stk.empty()) { + buff.append("/" + stk.pop()); + } + buff.append(getName()); + namingContextName = buff.toString(); + } + } + return namingContextName; } 1.3 +6 -6 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContextMapper.java Index: StandardContextMapper.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContextMapper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- StandardContextMapper.java 23 Aug 2002 16:02:31 -0000 1.2 +++ StandardContextMapper.java 23 Oct 2002 19:57:30 -0000 1.3 @@ -380,7 +380,7 @@ /** * JNDI resources name. */ - protected static final String RESOURCES_JNDI_NAME = "java:/comp/Resources"; + private static final String RESOURCES_JNDI_NAME = "java:/comp/Resources"; /** * Get resources. This method will try to retrieve the resources through @@ -389,7 +389,7 @@ * * @return A JNDI DirContext, or null. */ - protected DirContext getResources() { + private DirContext getResources() { DirContext result = null; 1.4 +8 -8 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java Index: CGIServlet.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- CGIServlet.java 5 Sep 2002 22:28:15 -0000 1.3 +++ CGIServlet.java 23 Oct 2002 19:57:31 -0000 1.4 @@ -289,7 +289,7 @@ */ -public class CGIServlet extends HttpServlet { +public final class CGIServlet extends HttpServlet { /* some vars below copied from Craig R. McClanahan's InvokerServlet */
-- To unsubscribe, e-mail: <mailto:tomcat-dev-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:tomcat-dev-help@;jakarta.apache.org>