Author: markt Date: Fri Oct 9 13:31:39 2015 New Revision: 1707724 URL: http://svn.apache.org/viewvc?rev=1707724&view=rev Log: Javadoc improvements. Use inherited Javadoc since it generally has more information. Fill in gaps using implementation Javadoc where available.
Modified: tomcat/trunk/java/javax/servlet/ServletContext.java tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java Modified: tomcat/trunk/java/javax/servlet/ServletContext.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/ServletContext.java?rev=1707724&r1=1707723&r2=1707724&view=diff ============================================================================== --- tomcat/trunk/java/javax/servlet/ServletContext.java (original) +++ tomcat/trunk/java/javax/servlet/ServletContext.java Fri Oct 9 13:31:39 2015 @@ -573,8 +573,7 @@ public interface ServletContext { * use this method. * @since Servlet 3.0 */ - public ServletRegistration.Dynamic addServlet(String servletName, - String className); + public ServletRegistration.Dynamic addServlet(String servletName, String className); /** * Register a servlet instance for use in this ServletContext. @@ -592,14 +591,15 @@ public interface ServletContext { * use this method. * @since Servlet 3.0 */ - public ServletRegistration.Dynamic addServlet(String servletName, - Servlet servlet); + public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet); /** - * TODO SERVLET3 - Add comments - * @param servletName TODO - * @param servletClass TODO - * @return TODO + * Add servlet to context. + * @param servletName Name of servlet to add + * @param servletClass Class of servlet to add + * @return <code>null</code> if the servlet has already been fully defined, + * else a {@link javax.servlet.ServletRegistration.Dynamic} object + * that can be used to further configure the servlet * @throws IllegalStateException * If the context has already been initialised * @throws UnsupportedOperationException If called from a @@ -668,7 +668,6 @@ public interface ServletContext { public Map<String, ? extends ServletRegistration> getServletRegistrations(); /** - /** * Add filter to context. * @param filterName Name of filter to add * @param className Name of filter class @@ -788,8 +787,9 @@ public interface ServletContext { public SessionCookieConfig getSessionCookieConfig(); /** - * TODO SERVLET3 - Add comments - * @param sessionTrackingModes TODO + * Configures the available session tracking modes for this web application. + * @param sessionTrackingModes The session tracking modes to use for this + * web application * @throws IllegalArgumentException * If sessionTrackingModes specifies * {@link SessionTrackingMode#SSL} in combination with any other @@ -809,8 +809,15 @@ public interface ServletContext { Set<SessionTrackingMode> sessionTrackingModes); /** - * TODO SERVLET3 - Add comments - * @return TODO + * Obtains the default session tracking modes for this web application. + * By default {@link SessionTrackingMode#URL} is always supported, {@link + * SessionTrackingMode#COOKIE} is supported unless the <code>cookies</code> + * attribute has been set to <code>false</code> for the context and {@link + * SessionTrackingMode#SSL} is supported if at least one of the connectors + * used by this context has the attribute <code>secure</code> set to + * <code>true</code>. + * @return The set of default session tracking modes for this web + * application * @throws UnsupportedOperationException If called from a * {@link ServletContextListener#contextInitialized(ServletContextEvent)} * method of a {@link ServletContextListener} that was not defined in a @@ -823,8 +830,10 @@ public interface ServletContext { public Set<SessionTrackingMode> getDefaultSessionTrackingModes(); /** - * TODO SERVLET3 - Add comments - * @return TODO + * Obtains the currently enabled session tracking modes for this web + * application. + * @return The value supplied via {@link #setSessionTrackingModes(Set)} if + * one was previously set, else return the defaults * @throws UnsupportedOperationException If called from a * {@link ServletContextListener#contextInitialized(ServletContextEvent)} * method of a {@link ServletContextListener} that was not defined in a Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=1707724&r1=1707723&r2=1707724&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java Fri Oct 9 13:31:39 2015 @@ -806,72 +806,25 @@ public class ApplicationContext } - /** - * Add servlet to context. - * @param servletName Name of servlet to add - * @param servletClass Name of servlet class - * @return <code>null</code> if the servlet has already been fully defined, - * else a {@link javax.servlet.ServletRegistration.Dynamic} object - * that can be used to further configure the servlet - * @throws IllegalStateException if the context has already been initialised - * @throws UnsupportedOperationException - if this context was passed to the - * {@link ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)} - * method of a {@link ServletContextListener} that was not declared - * in web.xml, a web-fragment or annotated with - * {@link javax.servlet.annotation.WebListener}. - */ @Override - public ServletRegistration.Dynamic addServlet(String servletName, - String servletClass) throws IllegalStateException { - - return addServlet(servletName, servletClass, null); + public ServletRegistration.Dynamic addServlet(String servletName, String className) { + return addServlet(servletName, className, null); } - /** - * Add servlet to context. - * @param servletName Name of servlet to add - * @param servlet Servlet instance to add - * @return <code>null</code> if the servlet has already been fully defined, - * else a {@link javax.servlet.ServletRegistration.Dynamic} object - * that can be used to further configure the servlet - * @throws IllegalStateException if the context has already been initialised - * @throws UnsupportedOperationException - if this context was passed to the - * {@link ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)} - * method of a {@link ServletContextListener} that was not declared - * in web.xml, a web-fragment or annotated with - * {@link javax.servlet.annotation.WebListener}. - */ @Override - public ServletRegistration.Dynamic addServlet(String servletName, - Servlet servlet) throws IllegalStateException { - + public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet) { return addServlet(servletName, null, servlet); } - /** - * Add servlet to context. - * @param servletName Name of servlet to add - * @param servletClass Class of servlet to add - * @return <code>null</code> if the servlet has already been fully defined, - * else a {@link javax.servlet.ServletRegistration.Dynamic} object - * that can be used to further configure the servlet - * @throws IllegalStateException if the context has already been initialised - * @throws UnsupportedOperationException - if this context was passed to the - * {@link ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)} - * method of a {@link ServletContextListener} that was not declared - * in web.xml, a web-fragment or annotated with - * {@link javax.servlet.annotation.WebListener}. - */ @Override public ServletRegistration.Dynamic addServlet(String servletName, - Class<? extends Servlet> servletClass) - throws IllegalStateException { - + Class<? extends Servlet> servletClass) { return addServlet(servletName, servletClass.getName(), null); } + private ServletRegistration.Dynamic addServlet(String servletName, String servletClass, Servlet servlet) throws IllegalStateException { @@ -951,19 +904,12 @@ public class ApplicationContext } - /** - * By default {@link SessionTrackingMode#URL} is always supported, {@link - * SessionTrackingMode#COOKIE} is supported unless the <code>cookies</code> - * attribute has been set to <code>false</code> for the context and {@link - * SessionTrackingMode#SSL} is supported if at least one of the connectors - * used by this context has the attribute <code>secure</code> set to - * <code>true</code>. - */ @Override public Set<SessionTrackingMode> getDefaultSessionTrackingModes() { return defaultSessionTrackingModes; } + private void populateSessionTrackingModes() { // URL re-writing is always enabled by default defaultSessionTrackingModes = EnumSet.of(SessionTrackingMode.URL); @@ -987,10 +933,7 @@ public class ApplicationContext } } - /** - * Return the supplied value if one was previously set, else return the - * defaults. - */ + @Override public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() { if (sessionTrackingModes != null) { @@ -1006,15 +949,8 @@ public class ApplicationContext } - /** - * @throws IllegalStateException if the context has already been initialised - * @throws IllegalArgumentException If SSL is requested in combination with - * anything else or if an unsupported - * tracking mode is requested - */ @Override - public void setSessionTrackingModes( - Set<SessionTrackingMode> sessionTrackingModes) { + public void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes) { if (!context.getState().equals(LifecycleState.STARTING_PREP)) { throw new IllegalStateException( --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org