tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: svn commit: r1356849 - /tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java
Date Tue, 03 Jul 2012 18:37:18 GMT
On 03/07/2012 18:54, fhanik@apache.org wrote:
> Author: fhanik
> Date: Tue Jul  3 17:54:25 2012
> New Revision: 1356849
> 
> URL: http://svn.apache.org/viewvc?rev=1356849&view=rev
> Log:
> Allow servlets to specify async support as annotation when added programatically
> 
> Modified:
>     tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java
> 
> Modified: tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java?rev=1356849&r1=1356848&r2=1356849&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java (original)
> +++ tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java Tue Jul  3 17:54:25 2012
> @@ -29,6 +29,7 @@ import java.util.logging.Logger;
>  
>  import javax.servlet.Servlet;
>  import javax.servlet.ServletException;
> +import javax.servlet.annotation.WebServlet;
>  
>  import org.apache.catalina.Container;
>  import org.apache.catalina.Context;
> @@ -801,11 +802,25 @@ public class Tomcat {
>          @SuppressWarnings("deprecation")
>          public ExistingStandardWrapper( Servlet existing ) {
>              this.existing = existing;
> +            this.asyncSupported = isAsyncSupported();

I don't get what the purpose of the above line is given that
asyncSupported is set again without apparently being used a few lines
later. What am I missing?

Mark


>              if (existing instanceof javax.servlet.SingleThreadModel) {
>                  singleThreadModel = true;
>                  instancePool = new Stack<Servlet>();
>              }
> +            this.asyncSupported = hasAsync();
>          }
> +
> +        public boolean hasAsync() {
> +            if (isAsyncSupported()) return true;
> +            boolean result = false;
> +            Class clazz = existing.getClass();
> +            if (clazz.isAnnotationPresent(WebServlet.class)) {
> +                WebServlet ws = (WebServlet)clazz.getAnnotation(WebServlet.class);
> +                result = ws.asyncSupported();
> +            }
> +            return result;
> +        }
> +
>          @Override
>          public synchronized Servlet loadServlet() throws ServletException {
>              if (singleThreadModel) {
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message