JBossWeb SVN: r964 - in trunk/java/javax/servlet: http and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-18 20:54:32 -0400 (Wed, 18 Mar 2009)
New Revision: 964
Added:
trunk/java/javax/servlet/LocalStrings.properties
trunk/java/javax/servlet/LocalStrings_fr.properties
trunk/java/javax/servlet/LocalStrings_ja.properties
trunk/java/javax/servlet/http/LocalStrings.properties
trunk/java/javax/servlet/http/LocalStrings_es.properties
trunk/java/javax/servlet/http/LocalStrings_fr.properties
trunk/java/javax/servlet/http/LocalStrings_ja.properties
Log:
- Add missing strings.
Added: trunk/java/javax/servlet/LocalStrings.properties
===================================================================
--- trunk/java/javax/servlet/LocalStrings.properties (rev 0)
+++ trunk/java/javax/servlet/LocalStrings.properties 2009-03-19 00:54:32 UTC (rev 964)
@@ -0,0 +1,29 @@
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+
+##
+## $Rev: 600957 $ $Date: 2007-12-04 15:01:31 +0100 (Tue, 04 Dec 2007) $
+##
+
+# Default localized string information
+# Localized for Locale en_US
+
+err.not_iso8859_1=Not an ISO 8859-1 character: {0}
+value.true=true
+value.false=false
Added: trunk/java/javax/servlet/LocalStrings_fr.properties
===================================================================
--- trunk/java/javax/servlet/LocalStrings_fr.properties (rev 0)
+++ trunk/java/javax/servlet/LocalStrings_fr.properties 2009-03-19 00:54:32 UTC (rev 964)
@@ -0,0 +1,31 @@
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+
+##
+## $Rev: 600957 $ $Date: 2007-12-04 15:01:31 +0100 (Tue, 04 Dec 2007) $
+##
+
+# Default localized string information
+# Localized for Locale fr_FR
+
+err.not_iso8859_1={0} n''est pas un caract�re ISO 8859-1
+value.true=true
+value.false=false
+
+
Added: trunk/java/javax/servlet/LocalStrings_ja.properties
===================================================================
--- trunk/java/javax/servlet/LocalStrings_ja.properties (rev 0)
+++ trunk/java/javax/servlet/LocalStrings_ja.properties 2009-03-19 00:54:32 UTC (rev 964)
@@ -0,0 +1,29 @@
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+
+##
+## $Rev: 600957 $ $Date: 2007-12-04 15:01:31 +0100 (Tue, 04 Dec 2007) $
+##
+
+# Default localized string information
+# Localized for Locale ja_JP
+
+err.not_iso8859_1=ISO 8859-1 \u306e\u6587\u5b57\u3067\u306f\u3042\u308a\u307e\u305b\u3093: {0}
+value.true=true
+value.false=false
Added: trunk/java/javax/servlet/http/LocalStrings.properties
===================================================================
--- trunk/java/javax/servlet/http/LocalStrings.properties (rev 0)
+++ trunk/java/javax/servlet/http/LocalStrings.properties 2009-03-19 00:54:32 UTC (rev 964)
@@ -0,0 +1,36 @@
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+
+##
+## $Rev: 600957 $ $Date: 2007-12-04 15:01:31 +0100 (Tue, 04 Dec 2007) $
+##
+
+# Default localized string information
+# Localized for Locale en_US
+
+err.cookie_name_is_token=Cookie name \"{0}\" is a reserved token
+err.io.negativelength=Negative Length given in write method
+err.io.short_read=Short Read
+
+http.method_not_implemented=Method {0} is not defined in RFC 2068 and is not supported by the Servlet API
+
+http.method_get_not_supported=HTTP method GET is not supported by this URL
+http.method_post_not_supported=HTTP method POST is not supported by this URL
+http.method_put_not_supported=HTTP method PUT is not supported by this URL
+http.method_delete_not_supported=Http method DELETE is not supported by this URL
Added: trunk/java/javax/servlet/http/LocalStrings_es.properties
===================================================================
--- trunk/java/javax/servlet/http/LocalStrings_es.properties (rev 0)
+++ trunk/java/javax/servlet/http/LocalStrings_es.properties 2009-03-19 00:54:32 UTC (rev 964)
@@ -0,0 +1,36 @@
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+
+##
+## $Rev: 600957 $ $Date: 2007-12-04 15:01:31 +0100 (Tue, 04 Dec 2007) $
+##
+
+# Default localized string information
+# Localized para Locale es_ES
+
+err.cookie_name_is_token=El Nombre de Cookie {0} es una palabra reservada
+err.io.negativelength=Longitud Negativa en el metodo write
+err.io.short_read=Lectura Corta
+
+http.method_not_implemented=El Metodo {0} no esta definido en la especificacion RFC 2068 y no es soportado por la API Servlet
+
+http.method_get_not_supported=El Metodo HTTP GET no es soportado por esta URL
+http.method_post_not_supported=El Metodo HTTP POST no es soportado por esta URL
+http.method_put_not_supported=El Metodo HTTP PUT no es soportado por esta URL
+http.method_delete_not_supported=El Metodo HTTP DELETE no es soportado por esta URL
Added: trunk/java/javax/servlet/http/LocalStrings_fr.properties
===================================================================
--- trunk/java/javax/servlet/http/LocalStrings_fr.properties (rev 0)
+++ trunk/java/javax/servlet/http/LocalStrings_fr.properties 2009-03-19 00:54:32 UTC (rev 964)
@@ -0,0 +1,36 @@
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+
+##
+## $Rev: 600957 $ $Date: 2007-12-04 15:01:31 +0100 (Tue, 04 Dec 2007) $
+##
+
+# Default localized string information
+# Localized for Locale fr_FR
+
+err.cookie_name_is_token=Le nom de cookie \"{0}\" est un \"token\" r�serv�
+err.io.negativelength=Taille n�gative donn�e dans la m�thode \"write\"
+err.io.short_read=Lecture partielle
+
+http.method_not_implemented=Le m�thode {0} n''est pas d�finie dans la RFC 2068 et n''est pas support�e par l''API Servlet
+
+http.method_get_not_supported=La m�thode HTTP GET n''est pas support�e par cette URL
+http.method_post_not_supported=La m�thode HTTP POST n''est pas support�e par cette URL
+http.method_put_not_supported=La m�thode HTTP PUT n''est pas support�e par cette URL
+http.method_delete_not_supported=La m�thode HTTP DELETE n''est pas support�e par cette URL
Added: trunk/java/javax/servlet/http/LocalStrings_ja.properties
===================================================================
--- trunk/java/javax/servlet/http/LocalStrings_ja.properties (rev 0)
+++ trunk/java/javax/servlet/http/LocalStrings_ja.properties 2009-03-19 00:54:32 UTC (rev 964)
@@ -0,0 +1,36 @@
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+
+##
+## $Rev: 600957 $ $Date: 2007-12-04 15:01:31 +0100 (Tue, 04 Dec 2007) $
+##
+
+# Default localized string information
+# Localized for Locale ja_JP
+
+err.cookie_name_is_token=\u30af\u30c3\u30ad\u30fc\u540d \"{0}\" \u306f\u4e88\u7d04\u6e08\u306e\u30c8\u30fc\u30af\u30f3\u3067\u3059\u3002
+err.io.negativelength=write\u30e1\u30bd\u30c3\u30c9\u306b\u8ca0\u306e\u9577\u3055\u304c\u6307\u5b9a\u3055\u308c\u307e\u3057\u305f\u3002
+err.io.short_read=\u8aad\u307f\u8fbc\u307f\u304c\u3059\u3050\u306b\u7d42\u308f\u308a\u307e\u3057\u305f\u3002
+
+http.method_not_implemented=\u30e1\u30bd\u30c3\u30c9 {0} \u306fRFC 2068\u306b\u306f\u5b9a\u7fa9\u3055\u308c\u3066\u304a\u3089\u305a\u3001\u30b5\u30fc\u30d6\u30ec\u30c3\u30c8API\u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093\u3002
+
+http.method_get_not_supported=HTTP\u306eGET\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u3053\u306eURL\u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002
+http.method_post_not_supported=HTTP\u306ePOST\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u3053\u306eURL\u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002
+http.method_put_not_supported=HTTP\u306ePUT\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u3053\u306eURL\u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002
+http.method_delete_not_supported=HTTP\u306eDELETE\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u3053\u306eURL\u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002
15 years, 12 months
JBossWeb SVN: r963 - in trunk: java/org/apache/catalina/core and 3 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-18 20:43:13 -0400 (Wed, 18 Mar 2009)
New Revision: 963
Modified:
trunk/java/org/apache/catalina/Wrapper.java
trunk/java/org/apache/catalina/core/ApplicationContext.java
trunk/java/org/apache/catalina/core/StandardWrapper.java
trunk/java/org/apache/catalina/deploy/FilterMap.java
trunk/java/org/apache/catalina/startup/ContextConfig.java
trunk/webapps/docs/changelog.xml
Log:
- Finish up some simple FIXMEs.
Modified: trunk/java/org/apache/catalina/Wrapper.java
===================================================================
--- trunk/java/org/apache/catalina/Wrapper.java 2009-03-18 16:19:55 UTC (rev 962)
+++ trunk/java/org/apache/catalina/Wrapper.java 2009-03-19 00:43:13 UTC (rev 963)
@@ -21,6 +21,7 @@
import javax.servlet.Servlet;
import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
import javax.servlet.UnavailableException;
@@ -244,6 +245,12 @@
/**
+ * Get the facade ServletRegistration.
+ */
+ public ServletRegistration getFacade();
+
+
+ /**
* Return the associated servlet instance.
*/
public Servlet getServlet();
Modified: trunk/java/org/apache/catalina/core/ApplicationContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-03-18 16:19:55 UTC (rev 962)
+++ trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-03-19 00:43:13 UTC (rev 963)
@@ -34,7 +34,6 @@
import javax.naming.Binding;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;
-import javax.servlet.DispatcherType;
import javax.servlet.FilterRegistration;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
@@ -51,7 +50,6 @@
import org.apache.catalina.Wrapper;
import org.apache.catalina.deploy.ApplicationParameter;
import org.apache.catalina.deploy.FilterDef;
-import org.apache.catalina.deploy.FilterMap;
import org.apache.catalina.deploy.SessionCookie;
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.RequestUtil;
@@ -810,20 +808,6 @@
}
- // FIXME: removed
- public void addServletMapping(String servletName, String[] urlPatterns) {
- if (context.initialized) {
- //TODO Spec breaking enhancement to ignore this restriction
- throw new IllegalStateException(sm.getString(
- "applicationContext.addServletMapping", getContextPath()));
- }
- for (String urlPattern : urlPatterns) {
- boolean jspWildCard = ("*.jsp".equals(urlPattern));
- context.addServletMapping(servletName, urlPattern, jspWildCard);
- }
- }
-
-
public FilterRegistration addFilter(String filterName, String className)
throws IllegalArgumentException, IllegalStateException {
if (context.isInitialized()) {
@@ -840,8 +824,11 @@
public ServletRegistration addServlet(String servletName, String className)
throws IllegalArgumentException, IllegalStateException {
- // TODO Auto-generated method stub
- return null;
+ Wrapper wrapper = context.createWrapper();
+ wrapper.setName(servletName);
+ wrapper.setServletClass(className);
+ context.addChild(wrapper);
+ return wrapper.getFacade();
}
@@ -856,8 +843,12 @@
public ServletRegistration findServletRegistration(String servletName) {
- // TODO Auto-generated method stub
- return null;
+ Wrapper wrapper = (Wrapper) context.findChild(servletName);
+ if (wrapper != null) {
+ return wrapper.getFacade();
+ } else {
+ return null;
+ }
}
Modified: trunk/java/org/apache/catalina/core/StandardWrapper.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapper.java 2009-03-18 16:19:55 UTC (rev 962)
+++ trunk/java/org/apache/catalina/core/StandardWrapper.java 2009-03-19 00:43:13 UTC (rev 963)
@@ -38,6 +38,7 @@
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.SingleThreadModel;
@@ -626,6 +627,14 @@
}
+
+ /**
+ * Get the facade ServletRegistration.
+ */
+ public ServletRegistration getFacade() {
+ return facade;
+ }
+
/**
* Gets the names of the methods supported by the underlying servlet.
Modified: trunk/java/org/apache/catalina/deploy/FilterMap.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/FilterMap.java 2009-03-18 16:19:55 UTC (rev 962)
+++ trunk/java/org/apache/catalina/deploy/FilterMap.java 2009-03-19 00:43:13 UTC (rev 963)
@@ -49,10 +49,10 @@
public static final int ERROR = 1;
public static final int FORWARD = 2;
- public static final int FORWARD_ERROR =3;
+ public static final int FORWARD_ERROR = 3;
public static final int INCLUDE = 4;
public static final int INCLUDE_ERROR = 5;
- public static final int INCLUDE_ERROR_FORWARD =6;
+ public static final int INCLUDE_ERROR_FORWARD = 6;
public static final int INCLUDE_FORWARD = 7;
public static final int REQUEST = 8;
public static final int REQUEST_ERROR = 9;
@@ -62,10 +62,27 @@
public static final int REQUEST_FORWARD = 13;
public static final int REQUEST_INCLUDE = 14;
public static final int REQUEST_FORWARD_INCLUDE= 15;
+ public static final int ASYNC = 16;
+ public static final int ASYNC_ERROR = 17;
+ public static final int ASYNC_FORWARD = 18;
+ public static final int ASYNC_FORWARD_ERROR = 19;
+ public static final int ASYNC_INCLUDE = 20;
+ public static final int ASYNC_INCLUDE_ERROR = 21;
+ public static final int ASYNC_INCLUDE_ERROR_FORWARD = 22;
+ public static final int ASYNC_INCLUDE_FORWARD = 23;
+ public static final int ASYNC_REQUEST = 24;
+ public static final int ASYNC_REQUEST_ERROR = 25;
+ public static final int ASYNC_REQUEST_ERROR_FORWARD = 26;
+ public static final int ASYNC_REQUEST_ERROR_FORWARD_INCLUDE = 27;
+ public static final int ASYNC_REQUEST_ERROR_INCLUDE = 28;
+ public static final int ASYNC_REQUEST_FORWARD = 29;
+ public static final int ASYNC_REQUEST_INCLUDE = 30;
+ public static final int ASYNC_REQUEST_FORWARD_INCLUDE= 31;
// represents nothing having been set. This will be seen
// as equal to a REQUEST
private static final int NOT_SET = -1;
+ private static final int ALL = ASYNC_REQUEST_ERROR_FORWARD_INCLUDE;
private int dispatcherMapping=NOT_SET;
@@ -176,6 +193,13 @@
case REQUEST_ERROR : dispatcherMapping = REQUEST_ERROR_FORWARD; break;
case REQUEST_ERROR_INCLUDE : dispatcherMapping = REQUEST_ERROR_FORWARD_INCLUDE; break;
case REQUEST_INCLUDE : dispatcherMapping = REQUEST_FORWARD_INCLUDE; break;
+ case ASYNC_ERROR : dispatcherMapping = ASYNC_FORWARD_ERROR; break;
+ case ASYNC_INCLUDE : dispatcherMapping = ASYNC_INCLUDE_FORWARD; break;
+ case ASYNC_INCLUDE_ERROR : dispatcherMapping = ASYNC_INCLUDE_ERROR_FORWARD; break;
+ case ASYNC_REQUEST : dispatcherMapping = ASYNC_REQUEST_FORWARD; break;
+ case ASYNC_REQUEST_ERROR : dispatcherMapping = ASYNC_REQUEST_ERROR_FORWARD; break;
+ case ASYNC_REQUEST_ERROR_INCLUDE : dispatcherMapping = ASYNC_REQUEST_ERROR_FORWARD_INCLUDE; break;
+ case ASYNC_REQUEST_INCLUDE : dispatcherMapping = ASYNC_REQUEST_FORWARD_INCLUDE; break;
}
} else if (dispatcher.equals(DispatcherType.INCLUDE.name())) {
// apply INCLUDE to the global dispatcherMapping.
@@ -188,6 +212,13 @@
case REQUEST_ERROR : dispatcherMapping = REQUEST_ERROR_INCLUDE; break;
case REQUEST_ERROR_FORWARD : dispatcherMapping = REQUEST_ERROR_FORWARD_INCLUDE; break;
case REQUEST_FORWARD : dispatcherMapping = REQUEST_FORWARD_INCLUDE; break;
+ case ASYNC_ERROR : dispatcherMapping = ASYNC_INCLUDE_ERROR; break;
+ case ASYNC_FORWARD : dispatcherMapping = ASYNC_INCLUDE_FORWARD; break;
+ case ASYNC_FORWARD_ERROR : dispatcherMapping = ASYNC_INCLUDE_ERROR_FORWARD; break;
+ case ASYNC_REQUEST : dispatcherMapping = ASYNC_REQUEST_INCLUDE; break;
+ case ASYNC_REQUEST_ERROR : dispatcherMapping = ASYNC_REQUEST_ERROR_INCLUDE; break;
+ case ASYNC_REQUEST_ERROR_FORWARD : dispatcherMapping = ASYNC_REQUEST_ERROR_FORWARD_INCLUDE; break;
+ case ASYNC_REQUEST_FORWARD : dispatcherMapping = ASYNC_REQUEST_FORWARD_INCLUDE; break;
}
} else if (dispatcher.equals(DispatcherType.REQUEST.name())) {
// apply REQUEST to the global dispatcherMapping.
@@ -200,6 +231,13 @@
case INCLUDE_ERROR : dispatcherMapping = REQUEST_ERROR_INCLUDE; break;
case INCLUDE_FORWARD : dispatcherMapping = REQUEST_FORWARD_INCLUDE; break;
case INCLUDE_ERROR_FORWARD : dispatcherMapping = REQUEST_ERROR_FORWARD_INCLUDE; break;
+ case ASYNC_ERROR : dispatcherMapping = ASYNC_REQUEST_ERROR; break;
+ case ASYNC_FORWARD : dispatcherMapping = ASYNC_REQUEST_FORWARD; break;
+ case ASYNC_FORWARD_ERROR : dispatcherMapping = ASYNC_REQUEST_ERROR_FORWARD; break;
+ case ASYNC_INCLUDE : dispatcherMapping = ASYNC_REQUEST_INCLUDE; break;
+ case ASYNC_INCLUDE_ERROR : dispatcherMapping = ASYNC_REQUEST_ERROR_INCLUDE; break;
+ case ASYNC_INCLUDE_FORWARD : dispatcherMapping = ASYNC_REQUEST_FORWARD_INCLUDE; break;
+ case ASYNC_INCLUDE_ERROR_FORWARD : dispatcherMapping = ASYNC_REQUEST_ERROR_FORWARD_INCLUDE; break;
}
} else if (dispatcher.equals(DispatcherType.ERROR.name())) {
// apply ERROR to the global dispatcherMapping.
@@ -212,7 +250,34 @@
case REQUEST_INCLUDE : dispatcherMapping = REQUEST_ERROR_INCLUDE; break;
case REQUEST_FORWARD : dispatcherMapping = REQUEST_ERROR_FORWARD; break;
case REQUEST_FORWARD_INCLUDE : dispatcherMapping = REQUEST_ERROR_FORWARD_INCLUDE; break;
+ case ASYNC_FORWARD : dispatcherMapping = ASYNC_FORWARD_ERROR; break;
+ case ASYNC_INCLUDE : dispatcherMapping = ASYNC_INCLUDE_ERROR; break;
+ case ASYNC_INCLUDE_FORWARD : dispatcherMapping = ASYNC_INCLUDE_ERROR_FORWARD; break;
+ case ASYNC_REQUEST : dispatcherMapping = ASYNC_REQUEST_ERROR; break;
+ case ASYNC_REQUEST_INCLUDE : dispatcherMapping = ASYNC_REQUEST_ERROR_INCLUDE; break;
+ case ASYNC_REQUEST_FORWARD : dispatcherMapping = ASYNC_REQUEST_ERROR_FORWARD; break;
+ case ASYNC_REQUEST_FORWARD_INCLUDE : dispatcherMapping = ASYNC_REQUEST_ERROR_FORWARD_INCLUDE; break;
}
+ } else if (dispatcher.equals(DispatcherType.ASYNC.name())) {
+ // apply ASYNC to the global dispatcherMapping.
+ switch (dispatcherMapping) {
+ case NOT_SET : dispatcherMapping = ASYNC; break;
+ case ERROR : dispatcherMapping = ASYNC_ERROR; break;
+ case FORWARD : dispatcherMapping = ASYNC_FORWARD; break;
+ case FORWARD_ERROR : dispatcherMapping = ASYNC_FORWARD_ERROR; break;
+ case INCLUDE : dispatcherMapping = ASYNC_INCLUDE; break;
+ case INCLUDE_ERROR : dispatcherMapping = ASYNC_INCLUDE_ERROR; break;
+ case INCLUDE_ERROR_FORWARD : dispatcherMapping = ASYNC_INCLUDE_ERROR_FORWARD; break;
+ case INCLUDE_FORWARD : dispatcherMapping = ASYNC_INCLUDE_FORWARD; break;
+ case REQUEST : dispatcherMapping = ASYNC_REQUEST; break;
+ case REQUEST_ERROR : dispatcherMapping = ASYNC_REQUEST_ERROR; break;
+ case REQUEST_ERROR_FORWARD : dispatcherMapping = ASYNC_REQUEST_ERROR_FORWARD; break;
+ case REQUEST_ERROR_FORWARD_INCLUDE : dispatcherMapping = ASYNC_REQUEST_ERROR_FORWARD_INCLUDE; break;
+ case REQUEST_ERROR_INCLUDE : dispatcherMapping = ASYNC_REQUEST_ERROR_INCLUDE; break;
+ case REQUEST_FORWARD : dispatcherMapping = ASYNC_REQUEST_FORWARD; break;
+ case REQUEST_INCLUDE : dispatcherMapping = ASYNC_REQUEST_INCLUDE; break;
+ case REQUEST_FORWARD_INCLUDE : dispatcherMapping = ASYNC_REQUEST_FORWARD_INCLUDE; break;
+ }
}
}
Modified: trunk/java/org/apache/catalina/startup/ContextConfig.java
===================================================================
--- trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-03-18 16:19:55 UTC (rev 962)
+++ trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-03-19 00:43:13 UTC (rev 963)
@@ -29,6 +29,7 @@
import java.util.Map;
import java.util.Properties;
+import javax.servlet.DispatcherType;
import javax.servlet.ServletContext;
import javax.servlet.http.annotation.FilterMapping;
import javax.servlet.http.annotation.InitParam;
@@ -307,27 +308,72 @@
if (clazz.isAnnotationPresent(InitParam.class)) {
InitParam annotation = clazz.getAnnotation(InitParam.class);
// Add init param
- // FIXME
+ context.addParameter(annotation.name(), annotation.value());
}
+ String filterName = null;
if (clazz.isAnnotationPresent(ServletFilter.class)) {
ServletFilter annotation = clazz.getAnnotation(ServletFilter.class);
// Add servlet filter
- // FIXME
+ filterName = annotation.filterName();
+ FilterDef filterDef = new FilterDef();
+ filterDef.setFilterName(annotation.filterName());
+ filterDef.setFilterClass(clazz.getName());
+ InitParam[] params = annotation.initParams();
+ for (int i = 0; i < params.length; i++) {
+ filterDef.addInitParameter(params[i].name(), params[i].value());
+ }
+ context.addFilterDef(filterDef);
}
if (clazz.isAnnotationPresent(FilterMapping.class)) {
FilterMapping annotation = clazz.getAnnotation(FilterMapping.class);
// Add filter mapping
- // FIXME
+ if (filterName != null) {
+ FilterMap filterMap = new FilterMap();
+ filterMap.setFilterName(filterName);
+ String[] urlPatterns = annotation.urlPattern();
+ if (urlPatterns != null) {
+ for (int i = 0; i < urlPatterns.length; i++) {
+ filterMap.addURLPattern(urlPatterns[i]);
+ }
+ }
+ String[] servletNames = annotation.servletNames();
+ if (servletNames != null) {
+ for (int i = 0; i < servletNames.length; i++) {
+ filterMap.addServletName(servletNames[i]);
+ }
+ }
+ DispatcherType[] dispatcherTypes = annotation.dispatcherTypes();
+ if (dispatcherTypes != null) {
+ for (int i = 0; i < dispatcherTypes.length; i++) {
+ filterMap.setDispatcher(dispatcherTypes[i].toString());
+ }
+ }
+ context.addFilterMap(filterMap);
+ }
}
if (clazz.isAnnotationPresent(Servlet.class)) {
Servlet annotation = clazz.getAnnotation(Servlet.class);
// Add servlet
- // FIXME
+ Wrapper wrapper = context.createWrapper();
+ wrapper.setName(annotation.name());
+ wrapper.setServletClass(clazz.getName());
+ wrapper.setLoadOnStartup(annotation.loadOnStartup());
+ InitParam[] params = annotation.initParams();
+ for (int i = 0; i < params.length; i++) {
+ wrapper.addInitParameter(params[i].name(), params[i].value());
+ }
+ context.addChild(wrapper);
+ String[] urlMappings = annotation.urlMappings();
+ if (urlMappings != null) {
+ for (int i = 0; i < urlMappings.length; i++) {
+ context.addServletMapping(urlMappings[i], annotation.name());
+ }
+ }
}
if (clazz.isAnnotationPresent(ServletContextListener.class)) {
ServletContextListener annotation = clazz.getAnnotation(ServletContextListener.class);
// Add listener
- // FIXME
+ context.addApplicationListener(clazz.getName());
}
}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-03-18 16:19:55 UTC (rev 962)
+++ trunk/webapps/docs/changelog.xml 2009-03-19 00:43:13 UTC (rev 963)
@@ -41,6 +41,10 @@
<fix>
<bug>46866</bug>: Use nanoTime rather that a weaker init for the Random fallback. (remm)
</fix>
+ <update>
+ Add support for events to all connectors (IO events are only available on
+ the APR HTTP connector, of course). (remm)
+ </update>
</changelog>
</subsection>
<subsection name="Coyote">
15 years, 12 months
JBossWeb SVN: r962 - in trunk: java/org/apache/catalina/connector and 2 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-18 12:19:55 -0400 (Wed, 18 Mar 2009)
New Revision: 962
Modified:
trunk/ROADMAP.txt
trunk/java/org/apache/catalina/connector/Connector.java
trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
trunk/java/org/apache/catalina/core/StandardWrapperValve.java
trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
Log:
- Use the ioEvents flag (true only for the APR HTTP connector).
- Functionality with no IO events will be exposed through the Servlet 3.0 async API.
Modified: trunk/ROADMAP.txt
===================================================================
--- trunk/ROADMAP.txt 2009-03-18 12:46:31 UTC (rev 961)
+++ trunk/ROADMAP.txt 2009-03-18 16:19:55 UTC (rev 962)
@@ -2,13 +2,13 @@
Main development:
- Setup standalone TCK environment for testing compliance with the new features
-- Implement Servlet 3.0 async over current IO events
+- Servlet 3.0 async API over IO events
- Update digester XML parsing rules for web.xml updates
-- Implement new APIs for programmatic deployment descriptor access
-- Implement annotation scanning for JBoss Web standalone (likely disabled by default using conf/web.xml)
-- Implement any other Servlet 3.0 changes (web.xml fragments, security, etc)
-- Implement JSP 2.2 changes
-- Implement EL 1.1 changes
+- Annotation scanning for JBoss Web standalone (likely disabled by default using conf/web.xml)
+- Multipart support (and remove fileupload)
+- Other Servlet 3.0 changes (web.xml fragments, security, etc)
+- JSP 2.2 changes
+- EL 1.1 changes
- Coordinate with AS 6 to implement new web.xml parsing (out of tree)
- JBoss Metadata parsing of .tld files (out of tree)
- Coordinate with AS 6 for annotation updates (out of tree)
Modified: trunk/java/org/apache/catalina/connector/Connector.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Connector.java 2009-03-18 12:46:31 UTC (rev 961)
+++ trunk/java/org/apache/catalina/connector/Connector.java 2009-03-18 16:19:55 UTC (rev 962)
@@ -879,6 +879,16 @@
/**
+ * Indicates if the protocol handler support IO events.
+ *
+ * @return true if IO events are supported
+ */
+ public boolean hasIoEvents() {
+ return protocolHandler.hasIoEvents();
+ }
+
+
+ /**
* Enables or disables the generation of an X-Powered-By header (with value
* Servlet/2.4) for all servlet-generated responses returned by this
* Connector.
Modified: trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
===================================================================
--- trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 2009-03-18 12:46:31 UTC (rev 961)
+++ trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 2009-03-18 16:19:55 UTC (rev 962)
@@ -315,7 +315,7 @@
}
if (connector.getXpoweredBy()) {
- response.addHeader("X-Powered-By", "Servlet/2.5");
+ response.addHeader("X-Powered-By", "Servlet/3.0");
}
boolean comet = false;
Modified: trunk/java/org/apache/catalina/core/StandardWrapperValve.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2009-03-18 12:46:31 UTC (rev 961)
+++ trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2009-03-18 16:19:55 UTC (rev 962)
@@ -157,10 +157,11 @@
servlet = null;
}
- // Identify if the request is Comet related now that the servlet has been allocated
+ // Identify if the request should be switched to event mode now that
+ // the servlet has been allocated
boolean comet = false;
if (servlet instanceof HttpEventServlet
- && request.getAttribute("org.apache.tomcat.comet.support") == Boolean.TRUE) {
+ && request.getConnector().hasIoEvents()) {
comet = true;
request.setComet(true);
}
Modified: trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2009-03-18 12:46:31 UTC (rev 961)
+++ trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2009-03-18 16:19:55 UTC (rev 962)
@@ -1475,8 +1475,6 @@
if (endpoint.getUseSendfile()) {
request.setAttribute("org.apache.tomcat.sendfile.support", Boolean.TRUE);
}
- // Advertise comet support through a request attribute
- request.setAttribute("org.apache.tomcat.comet.support", Boolean.TRUE);
}
15 years, 12 months
JBossWeb SVN: r961 - in trunk: java/org/apache/coyote/ajp and 2 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-18 08:46:31 -0400 (Wed, 18 Mar 2009)
New Revision: 961
Modified:
trunk/ROADMAP.txt
trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
trunk/java/org/apache/coyote/ajp/AjpProcessor.java
trunk/java/org/apache/coyote/ajp/AjpProtocol.java
trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
trunk/java/org/apache/coyote/http11/Http11Processor.java
trunk/java/org/apache/coyote/http11/Http11Protocol.java
trunk/java/org/apache/coyote/http11/InternalInputBuffer.java
trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
Log:
- Implement a portion of the event API for java.io HTTP and AJP. No READ, WRITE or any other IO events, only timeouts and resume.
Modified: trunk/ROADMAP.txt
===================================================================
--- trunk/ROADMAP.txt 2009-03-17 17:02:07 UTC (rev 960)
+++ trunk/ROADMAP.txt 2009-03-18 12:46:31 UTC (rev 961)
@@ -2,14 +2,11 @@
Main development:
- Setup standalone TCK environment for testing compliance with the new features
-- Implement Servlet 3.0 async for APR HTTP connector
+- Implement Servlet 3.0 async over current IO events
- Update digester XML parsing rules for web.xml updates
- Implement new APIs for programmatic deployment descriptor access
- Implement annotation scanning for JBoss Web standalone (likely disabled by default using conf/web.xml)
- Implement any other Servlet 3.0 changes (web.xml fragments, security, etc)
-- Implement Servlet 3.0 async for APR AJP connector
-- Implement Servlet 3.0 async for java.io HTTP connector
-- Implement Servlet 3.0 async for java.io AJP connector
- Implement JSP 2.2 changes
- Implement EL 1.1 changes
- Coordinate with AS 6 to implement new web.xml parsing (out of tree)
Modified: trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java 2009-03-17 17:02:07 UTC (rev 960)
+++ trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java 2009-03-18 12:46:31 UTC (rev 961)
@@ -1,18 +1,23 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.apache.coyote.ajp;
@@ -41,6 +46,8 @@
import org.apache.tomcat.util.http.HttpMessages;
import org.apache.tomcat.util.http.MimeHeaders;
import org.apache.tomcat.util.net.AprEndpoint;
+import org.apache.tomcat.util.net.SocketStatus;
+import org.apache.tomcat.util.net.AprEndpoint.Handler.SocketState;
import org.apache.tomcat.util.res.StringManager;
@@ -163,12 +170,6 @@
/**
- * State flag.
- */
- protected boolean started = false;
-
-
- /**
* Error flag.
*/
protected boolean error = false;
@@ -269,6 +270,20 @@
protected static final ByteBuffer flushMessageBuffer;
+ /**
+ * Comet used.
+ */
+ protected boolean comet = false;
+
+
+ /**
+ * Comet processing.
+ */
+ protected boolean cometProcessing = true;
+ public void startProcessing() { cometProcessing = true; }
+ public void endProcessing() { cometProcessing = false; }
+
+
// ----------------------------------------------------- Static Initializer
@@ -326,6 +341,21 @@
public void setRequiredSecret(String requiredSecret) { this.requiredSecret = requiredSecret; }
+ /**
+ * Timeout.
+ */
+ protected int timeout = -1;
+ public void setTimeout(int timeout) { this.timeout = timeout; }
+ public int getTimeout() { return timeout; }
+
+
+ /**
+ * A resume has been requested.
+ */
+ protected boolean resumeNotification = false;
+ public boolean getResumeNotification() { return resumeNotification; }
+
+
// --------------------------------------------------------- Public Methods
@@ -338,13 +368,51 @@
}
+ public SocketState event(SocketStatus status)
+ throws IOException {
+
+ RequestInfo rp = request.getRequestProcessor();
+ try {
+ if (status == SocketStatus.OPEN_CALLBACK) {
+ // The resume notification is now done
+ resumeNotification = false;
+ } else if (status == SocketStatus.ERROR) {
+ // Set error flag right away
+ error = true;
+ }
+ rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
+ error = !adapter.event(request, response, status);
+ } catch (InterruptedIOException e) {
+ error = true;
+ } catch (Throwable t) {
+ log.error(sm.getString("http11processor.request.process"), t);
+ // 500 - Internal Server Error
+ response.setStatus(500);
+ error = true;
+ }
+
+ rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
+
+ if (error) {
+ recycle();
+ return SocketState.CLOSED;
+ } else if (!comet) {
+ finish();
+ recycle();
+ return SocketState.OPEN;
+ } else {
+ return SocketState.LONG;
+ }
+ }
+
+
/**
* Process pipelined HTTP requests using the specified input and output
* streams.
*
* @throws IOException error during an I/O operation
*/
- public boolean process(long socket)
+ public SocketState process(long socket)
throws IOException {
RequestInfo rp = request.getRequestProcessor();
rp.setStage(org.apache.coyote.Constants.STAGE_PARSE);
@@ -360,7 +428,7 @@
boolean openSocket = true;
boolean keptAlive = false;
- while (started && !error) {
+ while (!error && !comet) {
// Parsing the request header
try {
@@ -370,6 +438,8 @@
// (long keepalive), so that the processor should be recycled
// and the method should return true
rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
+ // Add the socket to the poller
+ endpoint.getPoller().add(socket);
break;
}
// Check message type, process right away and break if
@@ -428,7 +498,7 @@
}
// Finish the response if not done yet
- if (!finished) {
+ if (!comet && !finished) {
try {
finish();
} catch (Throwable t) {
@@ -443,23 +513,28 @@
}
request.updateCounters();
+ if (!comet) {
+ recycle();
+ }
+
rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE);
- recycle();
}
- // Add the socket to the poller
- if (!error) {
- endpoint.getPoller().add(socket);
+ rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
+
+ if (comet) {
+ if (error) {
+ recycle();
+ return SocketState.CLOSED;
+ } else {
+ cometProcessing = false;
+ return SocketState.LONG;
+ }
} else {
- openSocket = false;
+ recycle();
+ return SocketState.CLOSED;
}
-
- rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
- recycle();
-
- return openSocket;
-
}
@@ -525,14 +600,6 @@
error = true;
}
- } else if (actionCode == ActionCode.ACTION_START) {
-
- started = true;
-
- } else if (actionCode == ActionCode.ACTION_STOP) {
-
- started = false;
-
} else if (actionCode == ActionCode.ACTION_REQ_SSL_ATTRIBUTE ) {
if (!certificates.isNull()) {
@@ -594,6 +661,21 @@
empty = false;
replay = true;
+ } else if (actionCode == ActionCode.ACTION_COMET_BEGIN) {
+ comet = true;
+ } else if (actionCode == ActionCode.ACTION_COMET_END) {
+ comet = false;
+ } else if (actionCode == ActionCode.ACTION_COMET_SUSPEND) {
+ // No action needed
+ } else if (actionCode == ActionCode.ACTION_COMET_RESUME) {
+ // An event is being processed already: adding for resume will be done
+ // when the socket gets back to the poller
+ if (!cometProcessing && !resumeNotification) {
+ endpoint.getCometPoller().add(socket, timeout, false, false, true, true);
+ }
+ resumeNotification = true;
+ } else if (actionCode == ActionCode.ACTION_COMET_TIMEOUT) {
+ timeout = ((Integer) param).intValue();
}
@@ -1189,6 +1271,9 @@
empty = true;
replay = false;
finished = false;
+ timeout = -1;
+ resumeNotification = false;
+ cometProcessing = true;
request.recycle();
response.recycle();
certificates.recycle();
Modified: trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java 2009-03-17 17:02:07 UTC (rev 960)
+++ trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java 2009-03-18 12:46:31 UTC (rev 961)
@@ -26,6 +26,7 @@
import java.net.URLEncoder;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicInteger;
@@ -35,8 +36,6 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import org.apache.coyote.ActionCode;
-import org.apache.coyote.ActionHook;
import org.apache.coyote.Adapter;
import org.apache.coyote.ProtocolHandler;
import org.apache.coyote.RequestGroupInfo;
@@ -352,6 +351,8 @@
protected AtomicLong registerCount = new AtomicLong(0);
protected RequestGroupInfo global = new RequestGroupInfo();
+ protected ConcurrentHashMap<Long, AjpAprProcessor> connections =
+ new ConcurrentHashMap<Long, AjpAprProcessor>();
protected ConcurrentLinkedQueue<AjpAprProcessor> recycledProcessors =
new ConcurrentLinkedQueue<AjpAprProcessor>() {
protected AtomicInteger size = new AtomicInteger(0);
@@ -392,9 +393,51 @@
this.proto = proto;
}
- // FIXME: Support async
public SocketState event(long socket, SocketStatus status) {
- return SocketState.CLOSED;
+ AjpAprProcessor result = connections.get(socket);
+ SocketState state = SocketState.CLOSED;
+ if (result != null) {
+ result.startProcessing();
+ // Call the appropriate event
+ try {
+ state = result.event(status);
+ } catch (java.net.SocketException e) {
+ // SocketExceptions are normal
+ AjpAprProcessor.log.debug
+ (sm.getString
+ ("ajpprotocol.proto.socketexception.debug"), e);
+ } catch (java.io.IOException e) {
+ // IOExceptions are normal
+ AjpAprProcessor.log.debug
+ (sm.getString
+ ("ajpprotocol.proto.ioexception.debug"), e);
+ }
+ // Future developers: if you discover any other
+ // rare-but-nonfatal exceptions, catch them here, and log as
+ // above.
+ catch (Throwable e) {
+ // any other exception or error is odd. Here we log it
+ // with "ERROR" level, so it will show up even on
+ // less-than-verbose logs.
+ AjpAprProcessor.log.error
+ (sm.getString("ajpprotocol.proto.error"), e);
+ } finally {
+ if (state != SocketState.LONG) {
+ connections.remove(socket);
+ recycledProcessors.offer(result);
+ if (proto.endpoint.isRunning() && state == SocketState.OPEN) {
+ proto.endpoint.getPoller().add(socket);
+ }
+ } else {
+ if (proto.endpoint.isRunning()) {
+ proto.endpoint.getCometPoller().add(socket, result.getTimeout(),
+ false, false, result.getResumeNotification(), false);
+ }
+ }
+ result.endProcessing();
+ }
+ }
+ return state;
}
public SocketState process(long socket) {
@@ -405,15 +448,18 @@
processor = createProcessor();
}
- if (processor instanceof ActionHook) {
- ((ActionHook) processor).action(ActionCode.ACTION_START, null);
- }
-
- if (processor.process(socket)) {
- return SocketState.OPEN;
+ SocketState state = processor.process(socket);
+ if (state == SocketState.LONG) {
+ // Associate the connection with the processor. The next request
+ // processed by this thread will use either a new or a recycled
+ // processor.
+ connections.put(socket, processor);
+ proto.endpoint.getCometPoller().add(socket, processor.getTimeout(), false,
+ false, processor.getResumeNotification(), false);
} else {
- return SocketState.CLOSED;
+ recycledProcessors.offer(processor);
}
+ return state;
} catch(java.net.SocketException e) {
// SocketExceptions are normal
@@ -435,12 +481,8 @@
// less-than-verbose logs.
AjpAprProtocol.log.error
(sm.getString("ajpprotocol.proto.error"), e);
- } finally {
- if (processor instanceof ActionHook) {
- ((ActionHook) processor).action(ActionCode.ACTION_STOP, null);
- }
- recycledProcessors.offer(processor);
}
+ recycledProcessors.offer(processor);
return SocketState.CLOSED;
}
Modified: trunk/java/org/apache/coyote/ajp/AjpProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpProcessor.java 2009-03-17 17:02:07 UTC (rev 960)
+++ trunk/java/org/apache/coyote/ajp/AjpProcessor.java 2009-03-18 12:46:31 UTC (rev 961)
@@ -1,18 +1,23 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.apache.coyote.ajp;
@@ -41,6 +46,8 @@
import org.apache.tomcat.util.http.HttpMessages;
import org.apache.tomcat.util.http.MimeHeaders;
import org.apache.tomcat.util.net.JIoEndpoint;
+import org.apache.tomcat.util.net.SocketStatus;
+import org.apache.tomcat.util.net.JIoEndpoint.Handler.SocketState;
import org.apache.tomcat.util.res.StringManager;
@@ -157,12 +164,6 @@
/**
- * State flag.
- */
- protected boolean started = false;
-
-
- /**
* Error flag.
*/
protected boolean error = false;
@@ -270,6 +271,20 @@
protected static final byte[] flushMessageArray;
+ /**
+ * Comet used.
+ */
+ protected boolean comet = false;
+
+
+ /**
+ * Comet processing.
+ */
+ protected boolean cometProcessing = true;
+ public void startProcessing() { cometProcessing = true; }
+ public void endProcessing() { cometProcessing = false; }
+
+
// ----------------------------------------------------- Static Initializer
@@ -336,6 +351,21 @@
public void setKeepAliveTimeout(int timeout) { keepAliveTimeout = timeout; }
+ /**
+ * Timeout.
+ */
+ protected int timeout = -1;
+ public void setTimeout(int timeout) { this.timeout = timeout; }
+ public int getTimeout() { return timeout; }
+
+
+ /**
+ * A resume has been requested.
+ */
+ protected boolean resumeNotification = false;
+ public boolean getResumeNotification() { return resumeNotification; }
+
+
// --------------------------------------------------------- Public Methods
@@ -348,13 +378,51 @@
}
+ public SocketState event(SocketStatus status)
+ throws IOException {
+
+ RequestInfo rp = request.getRequestProcessor();
+ try {
+ if (status == SocketStatus.OPEN_CALLBACK) {
+ // The resume notification is now done
+ resumeNotification = false;
+ } else if (status == SocketStatus.ERROR) {
+ // Set error flag right away
+ error = true;
+ }
+ rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
+ error = !adapter.event(request, response, status);
+ } catch (InterruptedIOException e) {
+ error = true;
+ } catch (Throwable t) {
+ log.error(sm.getString("http11processor.request.process"), t);
+ // 500 - Internal Server Error
+ response.setStatus(500);
+ error = true;
+ }
+
+ rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
+
+ if (error) {
+ recycle();
+ return SocketState.CLOSED;
+ } else if (!comet) {
+ finish();
+ recycle();
+ return SocketState.OPEN;
+ } else {
+ return SocketState.LONG;
+ }
+ }
+
+
/**
* Process pipelined HTTP requests using the specified input and output
* streams.
*
* @throws IOException error during an I/O operation
*/
- public void process(Socket socket)
+ public SocketState process(Socket socket)
throws IOException {
RequestInfo rp = request.getRequestProcessor();
rp.setStage(org.apache.coyote.Constants.STAGE_PARSE);
@@ -371,7 +439,7 @@
// Error flag
error = false;
- while (started && !error) {
+ while (!error && !comet) {
// Parsing the request header
try {
@@ -445,7 +513,7 @@
}
// Finish the response if not done yet
- if (!finished) {
+ if (!comet && !finished) {
try {
finish();
} catch (Throwable t) {
@@ -460,16 +528,32 @@
}
request.updateCounters();
+ if (!comet) {
+ recycle();
+ }
+
rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE);
- recycle();
}
rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
- recycle();
- input = null;
- output = null;
+ if (comet) {
+ if (error) {
+ input = null;
+ output = null;
+ recycle();
+ return SocketState.CLOSED;
+ } else {
+ cometProcessing = false;
+ return SocketState.LONG;
+ }
+ } else {
+ input = null;
+ output = null;
+ recycle();
+ return SocketState.CLOSED;
+ }
}
@@ -530,14 +614,6 @@
error = true;
}
- } else if (actionCode == ActionCode.ACTION_START) {
-
- started = true;
-
- } else if (actionCode == ActionCode.ACTION_STOP) {
-
- started = false;
-
} else if (actionCode == ActionCode.ACTION_REQ_SSL_ATTRIBUTE ) {
if (!certificates.isNull()) {
@@ -599,6 +675,21 @@
empty = false;
replay = true;
+ } else if (actionCode == ActionCode.ACTION_COMET_BEGIN) {
+ comet = true;
+ } else if (actionCode == ActionCode.ACTION_COMET_END) {
+ comet = false;
+ } else if (actionCode == ActionCode.ACTION_COMET_SUSPEND) {
+ // No action needed
+ } else if (actionCode == ActionCode.ACTION_COMET_RESUME) {
+ // An event is being processed already: adding for resume will be done
+ // when the socket gets back to the poller
+ if (!cometProcessing && !resumeNotification) {
+ endpoint.getPoller().add(socket, timeout, true, true);
+ }
+ resumeNotification = true;
+ } else if (actionCode == ActionCode.ACTION_COMET_TIMEOUT) {
+ timeout = ((Integer) param).intValue();
}
@@ -1135,6 +1226,9 @@
empty = true;
replay = false;
finished = false;
+ timeout = -1;
+ resumeNotification = false;
+ cometProcessing = true;
request.recycle();
response.recycle();
certificates.recycle();
Modified: trunk/java/org/apache/coyote/ajp/AjpProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpProtocol.java 2009-03-17 17:02:07 UTC (rev 960)
+++ trunk/java/org/apache/coyote/ajp/AjpProtocol.java 2009-03-18 12:46:31 UTC (rev 961)
@@ -27,6 +27,7 @@
import java.net.URLEncoder;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicInteger;
@@ -36,8 +37,6 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import org.apache.coyote.ActionCode;
-import org.apache.coyote.ActionHook;
import org.apache.coyote.Adapter;
import org.apache.coyote.ProtocolHandler;
import org.apache.coyote.RequestGroupInfo;
@@ -340,6 +339,8 @@
protected AtomicLong registerCount = new AtomicLong(0);
protected RequestGroupInfo global = new RequestGroupInfo();
+ protected ConcurrentHashMap<Socket, AjpProcessor> connections =
+ new ConcurrentHashMap<Socket, AjpProcessor>();
protected ConcurrentLinkedQueue<AjpProcessor> recycledProcessors =
new ConcurrentLinkedQueue<AjpProcessor>() {
protected AtomicInteger size = new AtomicInteger(0);
@@ -380,12 +381,57 @@
this.proto = proto;
}
- // FIXME: Support async
public SocketState event(Socket socket, SocketStatus status) {
- return SocketState.CLOSED;
+ AjpProcessor result = connections.get(socket);
+ SocketState state = SocketState.CLOSED;
+ if (result != null) {
+ result.startProcessing();
+ // Call the appropriate event
+ try {
+ state = result.event(status);
+ } catch (java.net.SocketException e) {
+ // SocketExceptions are normal
+ AjpProcessor.log.debug
+ (sm.getString
+ ("ajpprotocol.proto.socketexception.debug"), e);
+ } catch (java.io.IOException e) {
+ // IOExceptions are normal
+ AjpProcessor.log.debug
+ (sm.getString
+ ("ajpprotocol.proto.ioexception.debug"), e);
+ }
+ // Future developers: if you discover any other
+ // rare-but-nonfatal exceptions, catch them here, and log as
+ // above.
+ catch (Throwable e) {
+ // any other exception or error is odd. Here we log it
+ // with "ERROR" level, so it will show up even on
+ // less-than-verbose logs.
+ AjpProcessor.log.error
+ (sm.getString("ajpprotocol.proto.error"), e);
+ } finally {
+ if (state != SocketState.LONG) {
+ connections.remove(socket);
+ recycledProcessors.offer(result);
+ // FIXME: if the socket is still open, we should send it back to reprocess it
+ // as if it was an initial request, or the simple solution is to close after
+ // an async request; will see
+ if (proto.endpoint.isRunning() && state == SocketState.OPEN) {
+ //proto.endpoint.getPoller().add(socket);
+ }
+ } else {
+ if (proto.endpoint.isRunning()) {
+ proto.endpoint.getPoller().add(socket, result.getTimeout(),
+ result.getResumeNotification(), false);
+ }
+ }
+ result.endProcessing();
+ }
+ }
+ return state;
}
- public boolean process(Socket socket) {
+ public SocketState process(Socket socket) {
AjpProcessor processor = recycledProcessors.poll();
try {
@@ -393,13 +439,19 @@
processor = createProcessor();
}
- if (processor instanceof ActionHook) {
- ((ActionHook) processor).action(ActionCode.ACTION_START, null);
+ SocketState state = processor.process(socket);
+ if (state == SocketState.LONG) {
+ // Associate the connection with the processor. The next request
+ // processed by this thread will use either a new or a recycled
+ // processor.
+ connections.put(socket, processor);
+ proto.endpoint.getPoller().add(socket, processor.getTimeout(),
+ processor.getResumeNotification(), false);
+ } else {
+ recycledProcessors.offer(processor);
}
+ return state;
- processor.process(socket);
- return false;
-
} catch(java.net.SocketException e) {
// SocketExceptions are normal
AjpProtocol.log.debug
@@ -420,13 +472,9 @@
// less-than-verbose logs.
AjpProtocol.log.error
(sm.getString("ajpprotocol.proto.error"), e);
- } finally {
- if (processor instanceof ActionHook) {
- ((ActionHook) processor).action(ActionCode.ACTION_STOP, null);
- }
- recycledProcessors.offer(processor);
}
- return false;
+ recycledProcessors.offer(processor);
+ return SocketState.CLOSED;
}
protected AjpProcessor createProcessor() {
Modified: trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2009-03-17 17:02:07 UTC (rev 960)
+++ trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2009-03-18 12:46:31 UTC (rev 961)
@@ -259,12 +259,6 @@
/**
- * Maximum timeout on uploads. 5 minutes as in Apache HTTPD server.
- */
- protected int timeout = 300000;
-
-
- /**
* Flag to disable setting a different time-out on uploads.
*/
protected boolean disableUploadTimeout = false;
@@ -324,7 +318,6 @@
protected String server = null;
- protected int cometTimeout = -1;
protected boolean readNotifications = true;
protected boolean writeNotification = false;
protected boolean resumeNotification = false;
@@ -359,11 +352,6 @@
}
- public int getCometTimeout() {
- return cometTimeout;
- }
-
-
public boolean getAvailable() {
return inputBuffer.available();
}
@@ -507,7 +495,14 @@
}
+ /**
+ * Timeout.
+ */
+ protected int timeout = -1;
+ public void setTimeout(int timeout) { this.timeout = timeout; }
+ public int getTimeout() { return timeout; }
+
// --------------------------------------------------------- Public Methods
@@ -714,21 +709,8 @@
return socketBuffer;
}
- /**
- * Set the upload timeout.
- */
- public void setTimeout(int timeout) {
- this.timeout = timeout;
- }
/**
- * Get the upload timeout.
- */
- public int getTimeout() {
- return timeout;
- }
-
- /**
* Set the server header name.
*/
public void setServer( String server ) {
@@ -804,6 +786,7 @@
recycle();
return SocketState.CLOSED;
} else if (!comet) {
+ endRequest();
boolean pipelined = inputBuffer.nextRequest();
outputBuffer.nextRequest();
recycle();
@@ -1008,7 +991,7 @@
inputBuffer.recycle();
outputBuffer.recycle();
this.socket = 0;
- cometTimeout = -1;
+ timeout = -1;
readNotifications = true;
writeNotification = false;
resumeNotification = false;
@@ -1274,18 +1257,18 @@
// An event is being processed already: adding for resume will be done
// when the socket gets back to the poller
if (!cometProcessing && !resumeNotification) {
- endpoint.getCometPoller().add(socket, cometTimeout, false, false, true, true);
+ endpoint.getCometPoller().add(socket, timeout, false, false, true, true);
}
resumeNotification = true;
} else if (actionCode == ActionCode.ACTION_COMET_WRITE) {
// An event is being processed already: adding for write will be done
// when the socket gets back to the poller
if (!cometProcessing && !writeNotification) {
- endpoint.getCometPoller().add(socket, cometTimeout, false, true, false, true);
+ endpoint.getCometPoller().add(socket, timeout, false, true, false, true);
}
writeNotification = true;
} else if (actionCode == ActionCode.ACTION_COMET_TIMEOUT) {
- cometTimeout = ((Integer) param).intValue();
+ timeout = ((Integer) param).intValue();
}
}
Modified: trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2009-03-17 17:02:07 UTC (rev 960)
+++ trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2009-03-18 12:46:31 UTC (rev 961)
@@ -36,7 +36,6 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import org.apache.coyote.ActionCode;
import org.apache.coyote.Adapter;
import org.apache.coyote.ProtocolHandler;
import org.apache.coyote.RequestGroupInfo;
@@ -580,7 +579,7 @@
}
} else {
if (proto.endpoint.isRunning()) {
- proto.endpoint.getCometPoller().add(socket, result.getCometTimeout(),
+ proto.endpoint.getCometPoller().add(socket, result.getTimeout(),
result.getReadNotifications(), result.getWriteNotification(), result.getResumeNotification(), false);
}
}
@@ -597,8 +596,6 @@
processor = createProcessor();
}
- processor.action(ActionCode.ACTION_START, null);
-
SocketState state = processor.process(socket);
if (state == SocketState.LONG) {
// Associate the connection with the processor. The next request
@@ -609,8 +606,8 @@
// Call a read event right away
state = event(socket, SocketStatus.OPEN_READ);
} else {
- proto.endpoint.getCometPoller().add(socket, processor.getCometTimeout(),
- processor.getReadNotifications(), false, false, false);
+ proto.endpoint.getCometPoller().add(socket, processor.getTimeout(),
+ processor.getReadNotifications(), false, processor.getResumeNotification(), false);
}
} else {
recycledProcessors.offer(processor);
Modified: trunk/java/org/apache/coyote/http11/Http11Processor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11Processor.java 2009-03-17 17:02:07 UTC (rev 960)
+++ trunk/java/org/apache/coyote/http11/Http11Processor.java 2009-03-18 12:46:31 UTC (rev 961)
@@ -1,18 +1,23 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.apache.coyote.http11;
@@ -48,6 +53,8 @@
import org.apache.tomcat.util.http.MimeHeaders;
import org.apache.tomcat.util.net.JIoEndpoint;
import org.apache.tomcat.util.net.SSLSupport;
+import org.apache.tomcat.util.net.SocketStatus;
+import org.apache.tomcat.util.net.JIoEndpoint.Handler.SocketState;
import org.apache.tomcat.util.res.StringManager;
@@ -134,12 +141,6 @@
/**
- * State flag.
- */
- protected boolean started = false;
-
-
- /**
* Error flag.
*/
protected boolean error = false;
@@ -244,12 +245,6 @@
/**
- * Maximum timeout on uploads. 5 minutes as in Apache HTTPD server.
- */
- protected int timeout = 300000;
-
-
- /**
* Flag to disable setting a different time-out on uploads.
*/
protected boolean disableUploadTimeout = false;
@@ -308,7 +303,27 @@
*/
protected String server = null;
+
+ /**
+ * Comet used.
+ */
+ protected boolean comet = false;
+
+ /**
+ * True if a resume has been requested.
+ */
+ protected boolean resumeNotification = false;
+
+
+ /**
+ * Comet processing.
+ */
+ protected boolean cometProcessing = true;
+ public void startProcessing() { cometProcessing = true; }
+ public void endProcessing() { cometProcessing = false; }
+
+
// ------------------------------------------------------------- Properties
@@ -450,7 +465,14 @@
}
+ /**
+ * Timeout.
+ */
+ protected int timeout = -1;
+ public void setTimeout(int timeout) { this.timeout = timeout; }
+ public int getTimeout() { return timeout; }
+
// --------------------------------------------------------- Public Methods
@@ -666,6 +688,11 @@
return disableUploadTimeout;
}
+ public boolean getResumeNotification() {
+ return resumeNotification;
+ }
+
+
/**
* Set the socket buffer flag.
*/
@@ -681,22 +708,8 @@
return socketBuffer;
}
- /**
- * Set the upload timeout.
- */
- public void setTimeout( int timeouts ) {
- timeout = timeouts ;
- }
/**
- * Get the upload timeout.
- */
- public int getTimeout() {
- return timeout;
- }
-
-
- /**
* Set the server header name.
*/
public void setServer( String server ) {
@@ -723,6 +736,47 @@
return request;
}
+ public SocketState event(SocketStatus status)
+ throws IOException {
+
+ RequestInfo rp = request.getRequestProcessor();
+ try {
+ if (status == SocketStatus.OPEN_CALLBACK) {
+ // The resume notification is now done
+ resumeNotification = false;
+ } else if (status == SocketStatus.ERROR) {
+ // Set error flag right away
+ error = true;
+ }
+ rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
+ error = !adapter.event(request, response, status);
+ } catch (InterruptedIOException e) {
+ error = true;
+ } catch (Throwable t) {
+ log.error(sm.getString("http11processor.request.process"), t);
+ // 500 - Internal Server Error
+ response.setStatus(500);
+ error = true;
+ }
+
+ rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
+
+ if (error) {
+ inputBuffer.nextRequest();
+ outputBuffer.nextRequest();
+ recycle();
+ return SocketState.CLOSED;
+ } else if (!comet) {
+ endRequest();
+ boolean pipelined = inputBuffer.nextRequest();
+ outputBuffer.nextRequest();
+ recycle();
+ return (pipelined) ? SocketState.CLOSED : SocketState.OPEN;
+ } else {
+ return SocketState.LONG;
+ }
+ }
+
/**
* Process pipelined HTTP requests using the specified input and output
* streams.
@@ -732,7 +786,7 @@
* responses
* @throws IOException error during an I/O operation
*/
- public void process(Socket socket)
+ public SocketState process(Socket socket)
throws IOException {
RequestInfo rp = request.getRequestProcessor();
rp.setStage(org.apache.coyote.Constants.STAGE_PARSE);
@@ -775,7 +829,7 @@
boolean keptAlive = false;
- while (started && !error && keepAlive) {
+ while (!error && keepAlive && !comet) {
// Parsing the request header
try {
@@ -852,26 +906,9 @@
// If there is an unspecified error, the connection will be closed
inputBuffer.setSwallowInput(false);
}
- try {
- rp.setStage(org.apache.coyote.Constants.STAGE_ENDINPUT);
- inputBuffer.endRequest();
- } catch (IOException e) {
- error = true;
- } catch (Throwable t) {
- log.error(sm.getString("http11processor.request.finish"), t);
- // 500 - Internal Server Error
- response.setStatus(500);
- error = true;
+ if (!comet) {
+ endRequest();
}
- try {
- rp.setStage(org.apache.coyote.Constants.STAGE_ENDOUTPUT);
- outputBuffer.endRequest();
- } catch (IOException e) {
- error = true;
- } catch (Throwable t) {
- log.error(sm.getString("http11processor.response.finish"), t);
- error = true;
- }
// If there was an error, make sure the request is counted as
// and error, and update the statistics counter
@@ -880,23 +917,69 @@
}
request.updateCounters();
+ if (!comet) {
+ // Next request
+ inputBuffer.nextRequest();
+ outputBuffer.nextRequest();
+ }
+
rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE);
- // Next request
- inputBuffer.nextRequest();
- outputBuffer.nextRequest();
-
}
rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
- // Recycle
+ if (comet) {
+ if (error) {
+ inputBuffer.nextRequest();
+ outputBuffer.nextRequest();
+ recycle();
+ return SocketState.CLOSED;
+ } else {
+ cometProcessing = false;
+ return SocketState.LONG;
+ }
+ } else {
+ recycle();
+ return SocketState.CLOSED;
+ }
+
+ }
+
+
+ public void endRequest() {
+
+ // Finish the handling of the request
+ try {
+ inputBuffer.endRequest();
+ } catch (IOException e) {
+ error = true;
+ } catch (Throwable t) {
+ log.error(sm.getString("http11processor.request.finish"), t);
+ // 500 - Internal Server Error
+ response.setStatus(500);
+ error = true;
+ }
+ try {
+ outputBuffer.endRequest();
+ } catch (IOException e) {
+ error = true;
+ } catch (Throwable t) {
+ log.error(sm.getString("http11processor.response.finish"), t);
+ error = true;
+ }
+
+ }
+
+
+ public void recycle() {
inputBuffer.recycle();
outputBuffer.recycle();
-
- // Recycle socket
this.socket = null;
sslSupport = null;
+ timeout = -1;
+ resumeNotification = false;
+ cometProcessing = true;
}
@@ -971,14 +1054,6 @@
// Do nothing
- } else if (actionCode == ActionCode.ACTION_START) {
-
- started = true;
-
- } else if (actionCode == ActionCode.ACTION_STOP) {
-
- started = false;
-
} else if (actionCode == ActionCode.ACTION_REQ_SSL_ATTRIBUTE ) {
try {
@@ -1090,6 +1165,21 @@
InternalInputBuffer internalBuffer = (InternalInputBuffer)
request.getInputBuffer();
internalBuffer.addActiveFilter(savedBody);
+ } else if (actionCode == ActionCode.ACTION_COMET_BEGIN) {
+ comet = true;
+ } else if (actionCode == ActionCode.ACTION_COMET_END) {
+ comet = false;
+ } else if (actionCode == ActionCode.ACTION_COMET_SUSPEND) {
+ // No action needed
+ } else if (actionCode == ActionCode.ACTION_COMET_RESUME) {
+ // An event is being processed already: adding for resume will be done
+ // when the socket gets back to the poller
+ if (!cometProcessing && !resumeNotification) {
+ endpoint.getPoller().add(socket, timeout, true, true);
+ }
+ resumeNotification = true;
+ } else if (actionCode == ActionCode.ACTION_COMET_TIMEOUT) {
+ timeout = ((Integer) param).intValue();
}
}
Modified: trunk/java/org/apache/coyote/http11/Http11Protocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11Protocol.java 2009-03-17 17:02:07 UTC (rev 960)
+++ trunk/java/org/apache/coyote/http11/Http11Protocol.java 2009-03-18 12:46:31 UTC (rev 961)
@@ -27,6 +27,7 @@
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicInteger;
@@ -36,7 +37,6 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import org.apache.coyote.ActionCode;
import org.apache.coyote.Adapter;
import org.apache.coyote.ProtocolHandler;
import org.apache.coyote.RequestGroupInfo;
@@ -549,6 +549,8 @@
protected AtomicLong registerCount = new AtomicLong(0);
protected RequestGroupInfo global = new RequestGroupInfo();
+ protected ConcurrentHashMap<Socket, Http11Processor> connections =
+ new ConcurrentHashMap<Socket, Http11Processor>();
protected ConcurrentLinkedQueue<Http11Processor> recycledProcessors =
new ConcurrentLinkedQueue<Http11Processor>() {
protected AtomicInteger size = new AtomicInteger(0);
@@ -589,12 +591,57 @@
this.proto = proto;
}
- // FIXME: Support async
public SocketState event(Socket socket, SocketStatus status) {
- return SocketState.CLOSED;
+ Http11Processor result = connections.get(socket);
+ SocketState state = SocketState.CLOSED;
+ if (result != null) {
+ result.startProcessing();
+ // Call the appropriate event
+ try {
+ state = result.event(status);
+ } catch (java.net.SocketException e) {
+ // SocketExceptions are normal
+ Http11Protocol.log.debug
+ (sm.getString
+ ("http11protocol.proto.socketexception.debug"), e);
+ } catch (java.io.IOException e) {
+ // IOExceptions are normal
+ Http11Protocol.log.debug
+ (sm.getString
+ ("http11protocol.proto.ioexception.debug"), e);
+ }
+ // Future developers: if you discover any other
+ // rare-but-nonfatal exceptions, catch them here, and log as
+ // above.
+ catch (Throwable e) {
+ // any other exception or error is odd. Here we log it
+ // with "ERROR" level, so it will show up even on
+ // less-than-verbose logs.
+ Http11Protocol.log.error
+ (sm.getString("http11protocol.proto.error"), e);
+ } finally {
+ if (state != SocketState.LONG) {
+ connections.remove(socket);
+ recycledProcessors.offer(result);
+ // FIXME: if the socket is still open, we should send it back to reprocess it
+ // as if it was an initial request, or the simple solution is to close after
+ // an async request; will see
+ if (proto.endpoint.isRunning() && state == SocketState.OPEN) {
+ //proto.endpoint.getPoller().add(socket);
+ }
+ } else {
+ if (proto.endpoint.isRunning()) {
+ proto.endpoint.getPoller().add(socket, result.getTimeout(),
+ result.getResumeNotification(), false);
+ }
+ }
+ result.endProcessing();
+ }
+ }
+ return state;
}
- public boolean process(Socket socket) {
+ public SocketState process(Socket socket) {
Http11Processor processor = recycledProcessors.poll();
try {
@@ -602,8 +649,6 @@
processor = createProcessor();
}
- processor.action(ActionCode.ACTION_START, null);
-
if (proto.secure && (proto.sslImplementation != null)) {
processor.setSSLSupport
(proto.sslImplementation.getSSLSupport(socket));
@@ -611,8 +656,18 @@
processor.setSSLSupport(null);
}
- processor.process(socket);
- return false;
+ SocketState state = processor.process(socket);
+ if (state == SocketState.LONG) {
+ // Associate the connection with the processor. The next request
+ // processed by this thread will use either a new or a recycled
+ // processor.
+ connections.put(socket, processor);
+ proto.endpoint.getPoller().add(socket, processor.getTimeout(),
+ processor.getResumeNotification(), false);
+ } else {
+ recycledProcessors.offer(processor);
+ }
+ return state;
} catch(java.net.SocketException e) {
// SocketExceptions are normal
@@ -634,14 +689,9 @@
// less-than-verbose logs.
Http11Protocol.log.error
(sm.getString("http11protocol.proto.error"), e);
- } finally {
- // if(proto.adapter != null) proto.adapter.recycle();
- // processor.recycle();
-
- processor.action(ActionCode.ACTION_STOP, null);
- recycledProcessors.offer(processor);
}
- return false;
+ recycledProcessors.offer(processor);
+ return SocketState.CLOSED;
}
protected Http11Processor createProcessor() {
Modified: trunk/java/org/apache/coyote/http11/InternalInputBuffer.java
===================================================================
--- trunk/java/org/apache/coyote/http11/InternalInputBuffer.java 2009-03-17 17:02:07 UTC (rev 960)
+++ trunk/java/org/apache/coyote/http11/InternalInputBuffer.java 2009-03-18 12:46:31 UTC (rev 961)
@@ -292,7 +292,7 @@
* consumed. This method only resets all the pointers so that we are ready
* to parse the next HTTP request.
*/
- public void nextRequest() {
+ public boolean nextRequest() {
// Recycle Request object
request.recycle();
@@ -321,6 +321,8 @@
parsingHeader = true;
swallowInput = true;
+ return (lastValid > 0);
+
}
Modified: trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java 2009-03-17 17:02:07 UTC (rev 960)
+++ trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java 2009-03-18 12:46:31 UTC (rev 961)
@@ -29,6 +29,7 @@
import java.net.Socket;
import java.util.concurrent.Executor;
+import org.apache.tomcat.util.net.AprEndpoint.SocketInfo;
import org.apache.tomcat.util.res.StringManager;
import org.jboss.logging.Logger;
@@ -268,6 +269,15 @@
public ServerSocketFactory getServerSocketFactory() { return serverSocketFactory; }
+ /**
+ * The socket poller.
+ */
+ protected Poller poller = null;
+ public Poller getPoller() {
+ return poller;
+ }
+
+
public boolean isRunning() {
return running;
}
@@ -297,7 +307,7 @@
public enum SocketState {
OPEN, CLOSED, LONG
}
- public boolean process(Socket socket);
+ public SocketState process(Socket socket);
public SocketState event(Socket socket, SocketStatus status);
}
@@ -361,26 +371,11 @@
* with very little actual use.
*/
public static class SocketInfo {
+ public static final int RESUME = 4;
+ public static final int WAKEUP = 8;
public Socket socket;
public int timeout;
- public boolean wakeup;
- public boolean wakeup() {
- return wakeup;
- }
- public static boolean merge(boolean flag1, boolean flag2) {
- return (flag1 || flag2);
- }
- /*public static final int READ = 1;
- public static final int WRITE = 2;
- public static final int RESUME = 4;
- public static final int WAKEUP = 8;*/
- //public int flags;
- /*public boolean read() {
- return (flags & READ) == READ;
- }
- public boolean write() {
- return (flags & WRITE) == WRITE;
- }
+ public int flags;
public boolean resume() {
return (flags & RESUME) == RESUME;
}
@@ -388,11 +383,9 @@
return (flags & WAKEUP) == WAKEUP;
}
public static int merge(int flag1, int flag2) {
- return ((flag1 & READ) | (flag2 & READ))
- | ((flag1 & WRITE) | (flag2 & WRITE))
- | ((flag1 & RESUME) | (flag2 & RESUME))
+ return ((flag1 & RESUME) | (flag2 & RESUME))
| ((flag1 & WAKEUP) & (flag2 & WAKEUP));
- }*/
+ }
}
@@ -465,7 +458,7 @@
protected Socket[] sockets;
protected int[] timeouts;
- protected boolean[] wakeups;
+ protected int[] flags;
protected SocketInfo info = new SocketInfo();
@@ -474,7 +467,7 @@
pos = 0;
sockets = new Socket[size];
timeouts = new int[size];
- wakeups = new boolean[size];
+ flags = new int[size];
}
public int size() {
@@ -487,7 +480,7 @@
} else {
info.socket = sockets[pos];
info.timeout = timeouts[pos];
- info.wakeup = wakeups[pos];
+ info.flags = flags[pos];
pos++;
return info;
}
@@ -498,19 +491,19 @@
pos = 0;
}
- public boolean add(Socket socket, int timeout, boolean wakeup) {
+ public boolean add(Socket socket, int timeout, int flag) {
if (size == sockets.length) {
return false;
} else {
for (int i = 0; i < size; i++) {
if (sockets[i] == socket) {
- wakeups[i] = SocketInfo.merge(wakeups[i], wakeup);
+ flags[i] = SocketInfo.merge(flags[i], flag);
return true;
}
}
sockets[size] = socket;
timeouts[size] = timeout;
- wakeups[size] = wakeup;
+ flags[size] = flag;
size++;
return true;
}
@@ -521,7 +514,7 @@
copy.pos = pos;
System.arraycopy(sockets, 0, copy.sockets, 0, size);
System.arraycopy(timeouts, 0, copy.timeouts, 0, size);
- System.arraycopy(wakeups, 0, copy.wakeups, 0, size);
+ System.arraycopy(flags, 0, copy.flags, 0, size);
}
}
@@ -545,7 +538,7 @@
public void run() {
// Process the request from this socket
- if (!setSocketOptions(socket) || !handler.process(socket)) {
+ if (!setSocketOptions(socket) || (handler.process(socket) == Handler.SocketState.CLOSED)) {
// Close socket
try { socket.close(); } catch (IOException e) { }
}
@@ -665,8 +658,14 @@
}
addList.clear();
// Close all sockets still in the poller
- // FIXME: close all waiting for timeout
-
+ long future = System.currentTimeMillis() + Integer.MAX_VALUE;
+ Socket socket = timeouts.check(future);
+ while (socket != null) {
+ if (!processSocket(socket, SocketStatus.TIMEOUT)) {
+ try { socket.close(); } catch (IOException e) { }
+ }
+ socket = timeouts.check(future);
+ }
connectionCount = 0;
}
@@ -678,16 +677,19 @@
*
* @param socket to add to the poller
*/
- public void add(Socket socket, int timeout, boolean wakeup) {
- /*int timeout = keepAliveTimeout;
+ public void add(Socket socket, int timeout, boolean resume, boolean wakeup) {
if (timeout < 0) {
+ timeout = keepAliveTimeout;
+ }
+ if (timeout < 0) {
timeout = soTimeout;
- }*/
+ }
boolean ok = false;
synchronized (this) {
// Add socket to the list. Newly added sockets will wait
// at most for pollTime before being polled
- if (addList.add(socket, timeout, wakeup)) {
+ if (addList.add(socket, timeout, (resume ? SocketInfo.RESUME : 0)
+ | (wakeup ? SocketInfo.WAKEUP : 0))) {
ok = true;
this.notify();
}
@@ -723,24 +725,6 @@
}
/**
- * Displays the list of sockets in the pollers.
- *
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("Poller comet=[").append(comet).append("]");
- long[] res = new long[actualPollerSize * 2];
- for (int i = 0; i < pollers.length; i++) {
- int count = Poll.pollset(pollers[i], res);
- buf.append(" [ ");
- for (int j = 0; j < count; j++) {
- buf.append(desc[2*j+1]).append(" ");
- }
- buf.append("]");
- }
- return buf.toString();
- }*/
-
- /**
* The background thread that listens for incoming TCP/IP connections and
* hands them off to an appropriate processor.
*/
@@ -789,12 +773,22 @@
if (info.wakeup()) {
// Resume event if socket is present in the poller
if (timeouts.remove(info.socket)) {
+ if (info.resume()) {
+ if (!processSocket(info.socket, SocketStatus.OPEN_CALLBACK)) {
+ try { info.socket.close(); } catch (IOException e) { }
+ }
+ } else {
+ timeouts.add(info.socket, System.currentTimeMillis() + info.timeout);
+ }
+ }
+ } else {
+ if (info.resume()) {
if (!processSocket(info.socket, SocketStatus.OPEN_CALLBACK)) {
try { info.socket.close(); } catch (IOException e) { }
}
+ } else {
+ timeouts.add(info.socket, System.currentTimeMillis() + info.timeout);
}
- } else {
- timeouts.add(info.socket, System.currentTimeMillis() + info.timeout);
}
info = localAddList.get();
}
@@ -932,9 +926,10 @@
// Process the request from this socket
if ((status != null) && (handler.event(socket, status) == Handler.SocketState.CLOSED)) {
+ // FIXME: If handler.event returns Handler.SocketState.OPEN, then likely should process without socketOptions
// Close socket
try { socket.close(); } catch (IOException e) { }
- } else if ((status == null) && (!setSocketOptions(socket) || !handler.process(socket))) {
+ } else if ((status == null) && (!setSocketOptions(socket) || (handler.process(socket) == Handler.SocketState.CLOSED))) {
// Close socket
try { socket.close(); } catch (IOException e) { }
}
@@ -1014,6 +1009,14 @@
workers = new WorkerStack(maxThreads);
}
+ // Start poller thread
+ poller = new Poller();
+ poller.init();
+ Thread pollerThread = new Thread(poller, getName() + "-Poller");
+ pollerThread.setPriority(threadPriority);
+ pollerThread.setDaemon(true);
+ pollerThread.start();
+
// Start acceptor threads
for (int i = 0; i < acceptorThreadCount; i++) {
Thread acceptorThread = new Thread(new Acceptor(), getName() + "-Acceptor-" + i);
@@ -1041,6 +1044,8 @@
if (running) {
running = false;
unlockAccept();
+ poller.destroy();
+ poller = null;
}
}
15 years, 12 months
JBossWeb SVN: r960 - in trunk/java/org/apache: coyote/ajp and 3 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-17 13:02:07 -0400 (Tue, 17 Mar 2009)
New Revision: 960
Modified:
trunk/java/org/apache/coyote/ProtocolHandler.java
trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
trunk/java/org/apache/coyote/ajp/AjpProtocol.java
trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
trunk/java/org/apache/coyote/http11/Http11Protocol.java
trunk/java/org/apache/coyote/memory/MemoryProtocolHandler.java
trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
Log:
- Update so that all protocols have async capabilities, with one of them having additional IO driven events.
Modified: trunk/java/org/apache/coyote/ProtocolHandler.java
===================================================================
--- trunk/java/org/apache/coyote/ProtocolHandler.java 2009-03-17 13:26:02 UTC (rev 959)
+++ trunk/java/org/apache/coyote/ProtocolHandler.java 2009-03-17 17:02:07 UTC (rev 960)
@@ -1,18 +1,23 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.apache.coyote;
@@ -53,7 +58,10 @@
public Adapter getAdapter();
- /**
+ public boolean hasIoEvents();
+
+
+ /**
* Init the protocol.
*/
public void init()
Modified: trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java 2009-03-17 13:26:02 UTC (rev 959)
+++ trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java 2009-03-17 17:02:07 UTC (rev 960)
@@ -1,18 +1,23 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.apache.coyote.ajp;
@@ -149,6 +154,11 @@
}
+ public boolean hasIoEvents() {
+ return false;
+ }
+
+
/** Start the protocol
*/
public void init() throws Exception {
@@ -382,7 +392,7 @@
this.proto = proto;
}
- // FIXME: Support for this could be added in AJP as well
+ // FIXME: Support async
public SocketState event(long socket, SocketStatus status) {
return SocketState.CLOSED;
}
Modified: trunk/java/org/apache/coyote/ajp/AjpProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpProtocol.java 2009-03-17 13:26:02 UTC (rev 959)
+++ trunk/java/org/apache/coyote/ajp/AjpProtocol.java 2009-03-17 17:02:07 UTC (rev 960)
@@ -1,18 +1,23 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.apache.coyote.ajp;
@@ -39,6 +44,7 @@
import org.apache.coyote.RequestInfo;
import org.apache.tomcat.util.modeler.Registry;
import org.apache.tomcat.util.net.JIoEndpoint;
+import org.apache.tomcat.util.net.SocketStatus;
import org.apache.tomcat.util.net.JIoEndpoint.Handler;
import org.apache.tomcat.util.res.StringManager;
@@ -149,6 +155,11 @@
}
+ public boolean hasIoEvents() {
+ return false;
+ }
+
+
/** Start the protocol
*/
public void init() throws Exception {
@@ -369,6 +380,11 @@
this.proto = proto;
}
+ // FIXME: Support async
+ public SocketState event(Socket socket, SocketStatus status) {
+ return SocketState.CLOSED;
+ }
+
public boolean process(Socket socket) {
AjpProcessor processor = recycledProcessors.poll();
try {
Modified: trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2009-03-17 13:26:02 UTC (rev 959)
+++ trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2009-03-17 17:02:07 UTC (rev 960)
@@ -1,18 +1,23 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.apache.coyote.http11;
@@ -96,6 +101,11 @@
public Adapter getAdapter() { return adapter; }
+ public boolean hasIoEvents() {
+ return true;
+ }
+
+
/** Start the protocol
*/
public void init() throws Exception {
Modified: trunk/java/org/apache/coyote/http11/Http11Protocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11Protocol.java 2009-03-17 13:26:02 UTC (rev 959)
+++ trunk/java/org/apache/coyote/http11/Http11Protocol.java 2009-03-17 17:02:07 UTC (rev 960)
@@ -1,18 +1,23 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.apache.coyote.http11;
@@ -40,6 +45,7 @@
import org.apache.tomcat.util.net.JIoEndpoint;
import org.apache.tomcat.util.net.SSLImplementation;
import org.apache.tomcat.util.net.ServerSocketFactory;
+import org.apache.tomcat.util.net.SocketStatus;
import org.apache.tomcat.util.net.JIoEndpoint.Handler;
import org.apache.tomcat.util.res.StringManager;
@@ -141,6 +147,11 @@
public Adapter getAdapter() { return adapter; }
+ public boolean hasIoEvents() {
+ return false;
+ }
+
+
public void init() throws Exception {
endpoint.setName(getName());
endpoint.setHandler(cHandler);
@@ -578,6 +589,11 @@
this.proto = proto;
}
+ // FIXME: Support async
+ public SocketState event(Socket socket, SocketStatus status) {
+ return SocketState.CLOSED;
+ }
+
public boolean process(Socket socket) {
Http11Processor processor = recycledProcessors.poll();
try {
Modified: trunk/java/org/apache/coyote/memory/MemoryProtocolHandler.java
===================================================================
--- trunk/java/org/apache/coyote/memory/MemoryProtocolHandler.java 2009-03-17 13:26:02 UTC (rev 959)
+++ trunk/java/org/apache/coyote/memory/MemoryProtocolHandler.java 2009-03-17 17:02:07 UTC (rev 960)
@@ -71,6 +71,11 @@
}
+ public boolean hasIoEvents() {
+ return false;
+ }
+
+
// ------------------------------------------------ ProtocolHandler Methods
Modified: trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2009-03-17 13:26:02 UTC (rev 959)
+++ trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2009-03-17 17:02:07 UTC (rev 960)
@@ -1,18 +1,23 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.apache.tomcat.util.net;
@@ -307,14 +312,6 @@
/**
- * Allow comet request handling.
- */
- protected boolean useComet = true;
- public void setUseComet(boolean useComet) { this.useComet = useComet; }
- public boolean getUseComet() { return useComet; }
-
-
- /**
* The socket poller.
*/
protected Poller poller = null;
@@ -342,18 +339,6 @@
/**
- * Dummy maxSpareThreads property.
- */
- public int getMaxSpareThreads() { return 0; }
-
-
- /**
- * Dummy minSpareThreads property.
- */
- public int getMinSpareThreads() { return 0; }
-
-
- /**
* The server address.
*/
protected long serverAddress = 0;
Modified: trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java 2009-03-17 13:26:02 UTC (rev 959)
+++ trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java 2009-03-17 17:02:07 UTC (rev 960)
@@ -1,18 +1,23 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.apache.tomcat.util.net;
@@ -26,7 +31,6 @@
import org.apache.tomcat.util.res.StringManager;
import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
/**
* Handle incoming TCP connections.
@@ -165,6 +169,22 @@
/**
+ * Size of the socket poller.
+ */
+ protected int pollerSize = 32 * 1024;
+ public void setPollerSize(int pollerSize) { this.pollerSize = pollerSize; }
+ public int getPollerSize() { return pollerSize; }
+
+
+ /**
+ * Keep-Alive timeout.
+ */
+ protected int keepAliveTimeout = -1;
+ public int getKeepAliveTimeout() { return keepAliveTimeout; }
+ public void setKeepAliveTimeout(int keepAliveTimeout) { this.keepAliveTimeout = keepAliveTimeout; }
+
+
+ /**
* Server socket port.
*/
protected int port;
@@ -274,7 +294,11 @@
* thread local fields.
*/
public interface Handler {
+ public enum SocketState {
+ OPEN, CLOSED, LONG
+ }
public boolean process(Socket socket);
+ public SocketState event(Socket socket, SocketStatus status);
}
@@ -312,11 +336,7 @@
// Hand this socket off to an appropriate processor
if (!processSocket(socket)) {
// Close socket right away
- try {
- socket.close();
- } catch (IOException e) {
- // Ignore
- }
+ try { socket.close(); } catch (IOException e) { }
}
}catch ( IOException x ) {
if ( running ) log.error(sm.getString("endpoint.accept.fail"), x);
@@ -333,6 +353,180 @@
}
+ // ------------------------------------------------- SocketInfo Inner Class
+
+
+ /**
+ * Socket list class, used to avoid using a possibly large amount of objects
+ * with very little actual use.
+ */
+ public static class SocketInfo {
+ public Socket socket;
+ public int timeout;
+ public boolean wakeup;
+ public boolean wakeup() {
+ return wakeup;
+ }
+ public static boolean merge(boolean flag1, boolean flag2) {
+ return (flag1 || flag2);
+ }
+ /*public static final int READ = 1;
+ public static final int WRITE = 2;
+ public static final int RESUME = 4;
+ public static final int WAKEUP = 8;*/
+ //public int flags;
+ /*public boolean read() {
+ return (flags & READ) == READ;
+ }
+ public boolean write() {
+ return (flags & WRITE) == WRITE;
+ }
+ public boolean resume() {
+ return (flags & RESUME) == RESUME;
+ }
+ public boolean wakeup() {
+ return (flags & WAKEUP) == WAKEUP;
+ }
+ public static int merge(int flag1, int flag2) {
+ return ((flag1 & READ) | (flag2 & READ))
+ | ((flag1 & WRITE) | (flag2 & WRITE))
+ | ((flag1 & RESUME) | (flag2 & RESUME))
+ | ((flag1 & WAKEUP) & (flag2 & WAKEUP));
+ }*/
+ }
+
+
+ // --------------------------------------------- SocketTimeouts Inner Class
+
+
+ /**
+ * Socket list class, used to avoid using a possibly large amount of objects
+ * with very little actual use.
+ */
+ public class SocketTimeouts {
+ protected int size;
+
+ protected Socket[] sockets;
+ protected long[] timeouts;
+ protected int pos = 0;
+
+ public SocketTimeouts(int size) {
+ this.size = 0;
+ sockets = new Socket[size];
+ timeouts = new long[size];
+ }
+
+ public void add(Socket socket, long timeout) {
+ sockets[size] = socket;
+ timeouts[size] = timeout;
+ size++;
+ }
+
+ public boolean remove(Socket socket) {
+ for (int i = 0; i < size; i++) {
+ if (sockets[i] == socket) {
+ sockets[i] = sockets[size - 1];
+ timeouts[i] = timeouts[size - 1];
+ size--;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public Socket check(long date) {
+ while (pos < size) {
+ if (date >= timeouts[pos]) {
+ Socket result = sockets[pos];
+ sockets[pos] = sockets[size - 1];
+ timeouts[pos] = timeouts[size - 1];
+ size--;
+ return result;
+ }
+ pos++;
+ }
+ pos = 0;
+ return null;
+ }
+
+ }
+
+
+ // ------------------------------------------------- SocketList Inner Class
+
+
+ /**
+ * Socket list class, used to avoid using a possibly large amount of objects
+ * with very little actual use.
+ */
+ public class SocketList {
+ protected int size;
+ protected int pos;
+
+ protected Socket[] sockets;
+ protected int[] timeouts;
+ protected boolean[] wakeups;
+
+ protected SocketInfo info = new SocketInfo();
+
+ public SocketList(int size) {
+ this.size = 0;
+ pos = 0;
+ sockets = new Socket[size];
+ timeouts = new int[size];
+ wakeups = new boolean[size];
+ }
+
+ public int size() {
+ return this.size;
+ }
+
+ public SocketInfo get() {
+ if (pos == size) {
+ return null;
+ } else {
+ info.socket = sockets[pos];
+ info.timeout = timeouts[pos];
+ info.wakeup = wakeups[pos];
+ pos++;
+ return info;
+ }
+ }
+
+ public void clear() {
+ size = 0;
+ pos = 0;
+ }
+
+ public boolean add(Socket socket, int timeout, boolean wakeup) {
+ if (size == sockets.length) {
+ return false;
+ } else {
+ for (int i = 0; i < size; i++) {
+ if (sockets[i] == socket) {
+ wakeups[i] = SocketInfo.merge(wakeups[i], wakeup);
+ return true;
+ }
+ }
+ sockets[size] = socket;
+ timeouts[size] = timeout;
+ wakeups[size] = wakeup;
+ size++;
+ return true;
+ }
+ }
+
+ public void duplicate(SocketList copy) {
+ copy.size = size;
+ copy.pos = pos;
+ System.arraycopy(sockets, 0, copy.sockets, 0, size);
+ System.arraycopy(timeouts, 0, copy.timeouts, 0, size);
+ System.arraycopy(wakeups, 0, copy.wakeups, 0, size);
+ }
+
+ }
+
+
// ------------------------------------------- SocketProcessor Inner Class
@@ -353,10 +547,7 @@
// Process the request from this socket
if (!setSocketOptions(socket) || !handler.process(socket)) {
// Close socket
- try {
- socket.close();
- } catch (IOException e) {
- }
+ try { socket.close(); } catch (IOException e) { }
}
// Finish up this request
@@ -367,6 +558,281 @@
}
+ // --------------------------------------- SocketEventProcessor Inner Class
+
+
+ /**
+ * This class is the equivalent of the Worker, but will simply use in an
+ * external Executor thread pool.
+ */
+ protected class SocketEventProcessor implements Runnable {
+
+ protected Socket socket = null;
+ protected SocketStatus status = null;
+
+ public SocketEventProcessor(Socket socket, SocketStatus status) {
+ this.socket = socket;
+ this.status = status;
+ }
+
+ public void run() {
+
+ // Process the request from this socket
+ if (handler.event(socket, status) == Handler.SocketState.CLOSED) {
+ // Close socket
+ try { socket.close(); } catch (IOException e) { }
+ }
+ socket = null;
+
+ }
+
+ }
+
+
+ // ----------------------------------------------------- Poller Inner Class
+
+
+ /**
+ * Poller class.
+ */
+ public class Poller implements Runnable {
+
+ /**
+ * List of sockets to be added to the poller.
+ */
+ protected SocketList addList = null;
+
+ /**
+ * List of sockets to be added to the poller.
+ */
+ protected SocketList localAddList = null;
+
+ /**
+ * Structure used for storing timeouts.
+ */
+ protected SocketTimeouts timeouts = null;
+
+
+ /**
+ * Last run of maintain. Maintain will run usually every 5s.
+ */
+ protected long lastMaintain = System.currentTimeMillis();
+
+
+ /**
+ * Amount of connections inside this poller.
+ */
+ protected int connectionCount = 0;
+ public int getConnectionCount() { return connectionCount; }
+
+ public Poller() {
+ }
+
+ /**
+ * Create the poller. The java.io poller only deals with timeouts.
+ */
+ protected void init() {
+
+ timeouts = new SocketTimeouts(pollerSize);
+
+ connectionCount = 0;
+ addList = new SocketList(pollerSize);
+ localAddList = new SocketList(pollerSize);
+
+ }
+
+ /**
+ * Destroy the poller.
+ */
+ protected void destroy() {
+ // Wait for pollerTime before doing anything, so that the poller threads
+ // exit, otherwise parallel destruction of sockets which are still
+ // in the poller can cause problems
+ try {
+ synchronized (this) {
+ this.wait(2);
+ }
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ // Close all sockets in the add queue
+ SocketInfo info = addList.get();
+ while (info != null) {
+ if (!processSocket(info.socket, SocketStatus.STOP)) {
+ try { info.socket.close(); } catch (IOException e) { }
+ }
+ info = addList.get();
+ }
+ addList.clear();
+ // Close all sockets still in the poller
+ // FIXME: close all waiting for timeout
+
+ connectionCount = 0;
+ }
+
+ /**
+ * Add specified socket and associated pool to the poller. The socket will
+ * be added to a temporary array, and polled first after a maximum amount
+ * of time equal to pollTime (in most cases, latency will be much lower,
+ * however).
+ *
+ * @param socket to add to the poller
+ */
+ public void add(Socket socket, int timeout, boolean wakeup) {
+ /*int timeout = keepAliveTimeout;
+ if (timeout < 0) {
+ timeout = soTimeout;
+ }*/
+ boolean ok = false;
+ synchronized (this) {
+ // Add socket to the list. Newly added sockets will wait
+ // at most for pollTime before being polled
+ if (addList.add(socket, timeout, wakeup)) {
+ ok = true;
+ this.notify();
+ }
+ }
+ if (!ok) {
+ // Can't do anything: close the socket right away
+ if (!processSocket(socket, SocketStatus.ERROR)) {
+ try { socket.close(); } catch (IOException e) { }
+ }
+ }
+ }
+
+ /**
+ * Timeout checks.
+ */
+ protected void maintain() {
+
+ long date = System.currentTimeMillis();
+ // Maintain runs at most once every 5s, although it will likely get called more
+ if ((date - lastMaintain) < 5000L) {
+ return;
+ } else {
+ lastMaintain = date;
+ }
+ Socket socket = timeouts.check(date);
+ while (socket != null) {
+ if (!processSocket(socket, SocketStatus.TIMEOUT)) {
+ try { socket.close(); } catch (IOException e) { }
+ }
+ socket = timeouts.check(date);
+ }
+
+ }
+
+ /**
+ * Displays the list of sockets in the pollers.
+ *
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("Poller comet=[").append(comet).append("]");
+ long[] res = new long[actualPollerSize * 2];
+ for (int i = 0; i < pollers.length; i++) {
+ int count = Poll.pollset(pollers[i], res);
+ buf.append(" [ ");
+ for (int j = 0; j < count; j++) {
+ buf.append(desc[2*j+1]).append(" ");
+ }
+ buf.append("]");
+ }
+ return buf.toString();
+ }*/
+
+ /**
+ * The background thread that listens for incoming TCP/IP connections and
+ * hands them off to an appropriate processor.
+ */
+ public void run() {
+
+ int maintain = 0;
+ // Loop until we receive a shutdown command
+ while (running) {
+
+ // Loop if endpoint is paused
+ while (paused) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ }
+ // Check timeouts for suspended connections if the poller is empty
+ while (connectionCount < 1 && addList.size() < 1) {
+ // Reset maintain time.
+ try {
+ if (soTimeout > 0 && running) {
+ maintain();
+ }
+ synchronized (this) {
+ this.wait(10000);
+ }
+ } catch (InterruptedException e) {
+ // Ignore
+ } catch (Throwable t) {
+ log.error(sm.getString("endpoint.maintain.error"), t);
+ }
+ }
+
+ try {
+
+ // Add sockets which are waiting to the poller
+ if (addList.size() > 0) {
+ synchronized (this) {
+ // Duplicate to another list, so that the syncing is minimal
+ addList.duplicate(localAddList);
+ addList.clear();
+ }
+ SocketInfo info = localAddList.get();
+ while (info != null) {
+ if (info.wakeup()) {
+ // Resume event if socket is present in the poller
+ if (timeouts.remove(info.socket)) {
+ if (!processSocket(info.socket, SocketStatus.OPEN_CALLBACK)) {
+ try { info.socket.close(); } catch (IOException e) { }
+ }
+ }
+ } else {
+ timeouts.add(info.socket, System.currentTimeMillis() + info.timeout);
+ }
+ info = localAddList.get();
+ }
+ }
+
+ try {
+ Thread.sleep(2);
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+
+ // Process socket timeouts
+ if (soTimeout > 0 && maintain++ > 1000 && running) {
+ // This works and uses only one timeout mechanism for everything, but the
+ // non Comet poller might be a bit faster by using the old maintain.
+ maintain = 0;
+ maintain();
+ }
+
+ } catch (Throwable t) {
+ if (maintain == 0) {
+ log.error(sm.getString("endpoint.maintain.error"), t);
+ } else {
+ log.error(sm.getString("endpoint.poll.error"), t);
+ }
+ }
+
+ }
+
+ synchronized (this) {
+ this.notifyAll();
+ }
+
+ }
+
+ }
+
+
// ----------------------------------------------------- Worker Inner Class
@@ -375,6 +841,7 @@
protected Thread thread = null;
protected boolean available = false;
protected Socket socket = null;
+ protected SocketStatus status = null;
/**
@@ -386,7 +853,7 @@
*
* @param socket TCP socket to process
*/
- synchronized void assign(Socket socket) {
+ protected synchronized void assign(Socket socket) {
// Wait for the Processor to get the previous Socket
while (available) {
@@ -398,12 +865,32 @@
// Store the newly available Socket and notify our thread
this.socket = socket;
+ this.status = null;
available = true;
notifyAll();
}
+ protected synchronized void assign(Socket socket, SocketStatus status) {
+
+ // Wait for the Processor to get the previous Socket
+ while (available) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ }
+ }
+
+ // Store the newly available Socket and notify our thread
+ this.socket = socket;
+ this.status = status;
+ available = true;
+ notifyAll();
+
+ }
+
+
/**
* Await a newly assigned Socket from our Connector, or <code>null</code>
* if we are supposed to shut down.
@@ -444,16 +931,15 @@
continue;
// Process the request from this socket
- if (!setSocketOptions(socket) || !handler.process(socket)) {
+ if ((status != null) && (handler.event(socket, status) == Handler.SocketState.CLOSED)) {
// Close socket
- try {
- socket.close();
- } catch (IOException e) {
- }
+ try { socket.close(); } catch (IOException e) { }
+ } else if ((status == null) && (!setSocketOptions(socket) || !handler.process(socket))) {
+ // Close socket
+ try { socket.close(); } catch (IOException e) { }
}
// Finish up this request
- socket = null;
recycleWorkerThread(this);
}
@@ -748,6 +1234,26 @@
}
+ /**
+ * Process given socket for an event.
+ */
+ protected boolean processSocket(Socket socket, SocketStatus status) {
+ try {
+ if (executor == null) {
+ getWorkerThread().assign(socket, status);
+ } else {
+ executor.execute(new SocketEventProcessor(socket, status));
+ }
+ } catch (Throwable t) {
+ // This means we got an OOM or similar creating a thread, or that
+ // the pool and its queue are full
+ log.error(sm.getString("endpoint.process.fail"), t);
+ return false;
+ }
+ return true;
+ }
+
+
// ------------------------------------------------- WorkerStack Inner Class
15 years, 12 months
JBossWeb SVN: r959 - in trunk: java/org/apache/catalina/core and 3 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-17 09:26:02 -0400 (Tue, 17 Mar 2009)
New Revision: 959
Modified:
trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java
trunk/java/org/apache/catalina/core/StandardServer.java
trunk/java/org/apache/catalina/session/ManagerBase.java
trunk/java/org/apache/tomcat/bayeux/UUIDGenerator.java
trunk/webapps/docs/changelog.xml
Log:
- Base Random seeds on nanoTime, which is apparently better.
Modified: trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java
===================================================================
--- trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java 2009-03-16 17:48:50 UTC (rev 958)
+++ trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java 2009-03-17 13:26:02 UTC (rev 959)
@@ -629,19 +629,21 @@
protected synchronized Random getRandom() {
if (this.random == null) {
+ // Calculate the new random number generator seed
+ long seed = System.nanoTime();
+ char entropy[] = getEntropy().toCharArray();
+ for (int i = 0; i < entropy.length; i++) {
+ long update = ((byte) entropy[i]) << ((i % 8) * 8);
+ seed ^= update;
+ }
+ // Construct and seed a new random number generator
try {
Class clazz = Class.forName(randomClass);
this.random = (Random) clazz.newInstance();
- long seed = System.currentTimeMillis();
- char entropy[] = getEntropy().toCharArray();
- for (int i = 0; i < entropy.length; i++) {
- long update = ((byte) entropy[i]) << ((i % 8) * 8);
- seed ^= update;
- }
- this.random.setSeed(seed);
} catch (Exception e) {
this.random = new java.util.Random();
}
+ this.random.setSeed(seed);
}
return (this.random);
Modified: trunk/java/org/apache/catalina/core/StandardServer.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardServer.java 2009-03-16 17:48:50 UTC (rev 958)
+++ trunk/java/org/apache/catalina/core/StandardServer.java 2009-03-17 13:26:02 UTC (rev 959)
@@ -429,7 +429,7 @@
int expected = 1024; // Cut off to avoid DoS attack
while (expected < shutdown.length()) {
if (random == null)
- random = new Random(System.currentTimeMillis());
+ random = new Random();
expected += (random.nextInt() % 1024);
}
while (expected > 0) {
Modified: trunk/java/org/apache/catalina/session/ManagerBase.java
===================================================================
--- trunk/java/org/apache/catalina/session/ManagerBase.java 2009-03-16 17:48:50 UTC (rev 958)
+++ trunk/java/org/apache/catalina/session/ManagerBase.java 2009-03-17 13:26:02 UTC (rev 959)
@@ -543,30 +543,21 @@
public Random getRandom() {
if (this.random == null) {
// Calculate the new random number generator seed
- long seed = System.currentTimeMillis();
- long t1 = seed;
+ long seed = System.nanoTime();
char entropy[] = getEntropy().toCharArray();
for (int i = 0; i < entropy.length; i++) {
long update = ((byte) entropy[i]) << ((i % 8) * 8);
seed ^= update;
}
+ // Construct and seed a new random number generator
try {
- // Construct and seed a new random number generator
Class clazz = Class.forName(randomClass);
this.random = (Random) clazz.newInstance();
- this.random.setSeed(seed);
} catch (Exception e) {
- // Fall back to the simple case
- log.error(sm.getString("managerBase.random", randomClass),
- e);
+ log.warn(sm.getString("managerBase.random", randomClass), e);
this.random = new java.util.Random();
- this.random.setSeed(seed);
}
- if(log.isDebugEnabled()) {
- long t2=System.currentTimeMillis();
- if( (t2-t1) > 100 )
- log.debug(sm.getString("managerBase.seeding", randomClass) + " " + (t2-t1));
- }
+ this.random.setSeed(seed);
}
return (this.random);
Modified: trunk/java/org/apache/tomcat/bayeux/UUIDGenerator.java
===================================================================
--- trunk/java/org/apache/tomcat/bayeux/UUIDGenerator.java 2009-03-16 17:48:50 UTC (rev 958)
+++ trunk/java/org/apache/tomcat/bayeux/UUIDGenerator.java 2009-03-17 13:26:02 UTC (rev 959)
@@ -30,7 +30,7 @@
public static final int BITS_PER_BYTE = 8;
protected static SecureRandom secrand = null;
- protected static Random rand = new Random(System.currentTimeMillis());
+ protected static Random rand = new Random();
static {
secrand = new SecureRandom();
secrand.setSeed(rand.nextLong());
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-03-16 17:48:50 UTC (rev 958)
+++ trunk/webapps/docs/changelog.xml 2009-03-17 13:26:02 UTC (rev 959)
@@ -32,6 +32,15 @@
<update>
Cookie tracking and Servlet 3.0 cookie configuration. (markt, remm)
</update>
+ <update>
+ ServletRegistration and FilterRegistration implementation. (remm)
+ </update>
+ <fix>
+ XML validation fix. (markt)
+ </fix>
+ <fix>
+ <bug>46866</bug>: Use nanoTime rather that a weaker init for the Random fallback. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
15 years, 12 months
JBossWeb SVN: r958 - in trunk: java/org/apache/catalina/startup and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-16 13:48:50 -0400 (Mon, 16 Mar 2009)
New Revision: 958
Modified:
trunk/PATCHES.txt
trunk/java/org/apache/catalina/startup/DigesterFactory.java
trunk/java/org/apache/tomcat/util/digester/Digester.java
Log:
- Port validation fix.
Modified: trunk/PATCHES.txt
===================================================================
--- trunk/PATCHES.txt 2009-03-12 18:09:30 UTC (rev 957)
+++ trunk/PATCHES.txt 2009-03-16 17:48:50 UTC (rev 958)
@@ -53,6 +53,6 @@
751502
Per context validation (incomplete, and looks a bit useless anyway)
-752651
+752651, 752936
XmlBase configuration
Modified: trunk/java/org/apache/catalina/startup/DigesterFactory.java
===================================================================
--- trunk/java/org/apache/catalina/startup/DigesterFactory.java 2009-03-12 18:09:30 UTC (rev 957)
+++ trunk/java/org/apache/catalina/startup/DigesterFactory.java 2009-03-16 17:48:50 UTC (rev 958)
@@ -68,10 +68,6 @@
digester.setValidating(xmlValidation);
digester.setUseContextClassLoader(true);
- if (xmlValidation || xmlNamespaceAware){
- configureSchema(digester);
- }
-
SchemaResolver schemaResolver = new SchemaResolver(digester);
registerLocalSchema(schemaResolver);
@@ -189,18 +185,4 @@
}
- /**
- * Turn on DTD and/or validation (based on the parser implementation)
- */
- protected static void configureSchema(Digester digester){
- URL url = DigesterFactory.class
- .getResource(Constants.WebSchemaResourcePath_25);
-
- if(url == null) {
- log.error("Could not get url for "
- + Constants.WebSchemaResourcePath_25);
- } else {
- digester.setSchema(url.toString());
- }
- }
}
Modified: trunk/java/org/apache/tomcat/util/digester/Digester.java
===================================================================
--- trunk/java/org/apache/tomcat/util/digester/Digester.java 2009-03-12 18:09:30 UTC (rev 957)
+++ trunk/java/org/apache/tomcat/util/digester/Digester.java 2009-03-16 17:48:50 UTC (rev 958)
@@ -280,20 +280,8 @@
*/
protected Rules rules = null;
- /**
- * The XML schema language to use for validating an XML instance. By
- * default this value is set to <code>W3C_XML_SCHEMA</code>
- */
- protected String schemaLanguage = W3C_XML_SCHEMA;
-
-
+
/**
- * The XML schema to use for validating an XML instance.
- */
- protected String schemaLocation = null;
-
-
- /**
* The object stack being constructed.
*/
protected ArrayStack stack = new ArrayStack();
@@ -492,13 +480,28 @@
/**
* Return the SAXParserFactory we will use, creating one if necessary.
+ * @throws ParserConfigurationException
+ * @throws SAXNotSupportedException
+ * @throws SAXNotRecognizedException
*/
- public SAXParserFactory getFactory() {
+ public SAXParserFactory getFactory()
+ throws SAXNotRecognizedException, SAXNotSupportedException,
+ ParserConfigurationException {
if (factory == null) {
factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(namespaceAware);
factory.setValidating(validating);
+ if (validating) {
+ // Enable DTD validation
+ factory.setFeature(
+ "http://xml.org/sax/features/validation",
+ true);
+ // Enable schema validation
+ factory.setFeature(
+ "http://apache.org/xml/features/validation/schema",
+ true);
+ }
}
return (factory);
@@ -693,16 +696,7 @@
// Create a new parser
try {
- if (validating) {
- Properties properties = new Properties();
- properties.put("SAXParserFactory", getFactory());
- if (schemaLocation != null) {
- properties.put("schemaLocation", schemaLocation);
- properties.put("schemaLanguage", schemaLanguage);
- }
- parser = ParserFeatureSetterFactory.newSAXParser(properties); } else {
- parser = getFactory().newSAXParser();
- }
+ parser = getFactory().newSAXParser();
} catch (Exception e) {
log.error("Digester.getParser: ", e);
return (null);
@@ -808,50 +802,6 @@
/**
- * Return the XML Schema URI used for validating an XML instance.
- */
- public String getSchema() {
-
- return (this.schemaLocation);
-
- }
-
-
- /**
- * Set the XML Schema URI used for validating a XML Instance.
- *
- * @param schemaLocation a URI to the schema.
- */
- public void setSchema(String schemaLocation){
-
- this.schemaLocation = schemaLocation;
-
- }
-
-
- /**
- * Return the XML Schema language used when parsing.
- */
- public String getSchemaLanguage() {
-
- return (this.schemaLanguage);
-
- }
-
-
- /**
- * Set the XML Schema language used when parsing. By default, we use W3C.
- *
- * @param schemaLanguage a URI to the schema language.
- */
- public void setSchemaLanguage(String schemaLanguage){
-
- this.schemaLanguage = schemaLanguage;
-
- }
-
-
- /**
* Return the boolean as to whether the context classloader should be used.
*/
public boolean getUseContextClassLoader() {
@@ -1483,11 +1433,6 @@
entityURL = (String) entityValidator.get(publicId);
}
- // Redirect the schema location to a local destination
- if (schemaLocation != null && entityURL == null && systemId != null){
- entityURL = (String)entityValidator.get(systemId);
- }
-
if (entityURL == null) {
if (systemId == null) {
// cannot resolve
15 years, 12 months
JBossWeb SVN: r957 - in trunk/java/org/apache/catalina: core and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-12 14:09:30 -0400 (Thu, 12 Mar 2009)
New Revision: 957
Modified:
trunk/java/org/apache/catalina/Wrapper.java
trunk/java/org/apache/catalina/core/StandardWrapper.java
trunk/java/org/apache/catalina/core/StandardWrapperFacade.java
trunk/java/org/apache/catalina/startup/WebRuleSet.java
Log:
- Do some of the Servlet registration.
Modified: trunk/java/org/apache/catalina/Wrapper.java
===================================================================
--- trunk/java/org/apache/catalina/Wrapper.java 2009-03-12 16:05:46 UTC (rev 956)
+++ trunk/java/org/apache/catalina/Wrapper.java 2009-03-12 18:09:30 UTC (rev 957)
@@ -54,6 +54,20 @@
/**
+ * Return the async supported value.
+ */
+ public boolean getAsyncSupported();
+
+
+ /**
+ * Set the async supported value.
+ *
+ * @param value New async supported value
+ */
+ public void setAsyncSupported(boolean asyncSupported);
+
+
+ /**
* Return the available date/time for this servlet, in milliseconds since
* the epoch. If this date/time is in the future, any request for this
* servlet will return an SC_SERVICE_UNAVAILABLE error. If it is zero,
@@ -75,6 +89,18 @@
/**
+ * Return the Servlet description.
+ */
+ public String getDescription();
+
+
+ /**
+ * Set the description.
+ */
+ public void setDescription(String description);
+
+
+ /**
* Return the context-relative URI of the JSP file for this servlet.
*/
public String getJspFile();
Modified: trunk/java/org/apache/catalina/core/StandardWrapper.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapper.java 2009-03-12 16:05:46 UTC (rev 956)
+++ trunk/java/org/apache/catalina/core/StandardWrapper.java 2009-03-12 18:09:30 UTC (rev 957)
@@ -43,6 +43,7 @@
import javax.servlet.SingleThreadModel;
import javax.servlet.UnavailableException;
+import org.apache.InstanceManager;
import org.apache.PeriodicEventListener;
import org.apache.catalina.Container;
import org.apache.catalina.ContainerServlet;
@@ -52,7 +53,6 @@
import org.apache.catalina.InstanceListener;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Wrapper;
-import org.apache.InstanceManager;
import org.apache.catalina.security.SecurityUtil;
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.InstanceSupport;
@@ -96,8 +96,14 @@
// ----------------------------------------------------- Instance Variables
-
+
/**
+ * Async supported flag.
+ */
+ protected boolean asyncSupported = false;
+
+
+ /**
* The date and time at which this servlet will become available (in
* milliseconds since the epoch), or zero if the servlet is available.
* If this value equals Long.MAX_VALUE, the unavailability of this
@@ -115,6 +121,12 @@
*/
protected int countAllocated = 0;
+
+ /**
+ * Description.
+ */
+ protected String description = null;
+
/**
* The facade associated with this wrapper.
@@ -270,6 +282,44 @@
/**
+ * Return the async supported value.
+ */
+ public boolean getAsyncSupported() {
+ return asyncSupported;
+ }
+
+
+ /**
+ * Return the Servlet description.
+ */
+ public String getDescription() {
+ return description;
+ }
+
+
+ /**
+ * Set the async supported value.
+ *
+ * @param value New async supported value
+ */
+ public void setAsyncSupported(boolean value) {
+ boolean oldAsyncSupported = this.asyncSupported;
+ this.asyncSupported = value;
+ support.firePropertyChange("asyncSupported", oldAsyncSupported, asyncSupported);
+ }
+
+
+ /**
+ * Set the description.
+ */
+ public void setDescription(String description) {
+ String oldDescription = this.description;
+ this.description = description;
+ support.firePropertyChange("description", oldDescription, description);
+ }
+
+
+ /**
* Return the available date/time for this servlet, in milliseconds since
* the epoch. If this date/time is Long.MAX_VALUE, it is considered to mean
* that unavailability is permanent and any request for this servlet will return
Modified: trunk/java/org/apache/catalina/core/StandardWrapperFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapperFacade.java 2009-03-12 16:05:46 UTC (rev 956)
+++ trunk/java/org/apache/catalina/core/StandardWrapperFacade.java 2009-03-12 18:09:30 UTC (rev 957)
@@ -20,13 +20,17 @@
import java.util.Enumeration;
+import java.util.Iterator;
import java.util.Map;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletRegistration;
+import org.apache.catalina.Context;
+import org.apache.catalina.util.StringManager;
+
/**
* Facade for the <b>StandardWrapper</b> object.
*
@@ -38,6 +42,13 @@
implements ServletRegistration, ServletConfig {
+ /**
+ * The string manager for this package.
+ */
+ private static final StringManager sm =
+ StringManager.getManager(Constants.Package);
+
+
// ----------------------------------------------------------- Constructors
@@ -96,35 +107,47 @@
public void addMapping(String... urlPatterns) {
- // TODO Auto-generated method stub
-
+ if (((Context) wrapper.getParent()).isInitialized()) {
+ throw new IllegalStateException(sm.getString
+ ("servletRegistration.addServletMapping.ise", ((Context) wrapper.getParent()).getPath()));
+ }
+ if (urlPatterns == null) {
+ return;
+ }
+ for (int i = 0; i < urlPatterns.length; i++) {
+ ((Context) wrapper.getParent()).addServletMapping(urlPatterns[i], wrapper.getName());
+ }
}
public void setAsyncSupported(boolean asyncSupported) {
- // TODO Auto-generated method stub
+ wrapper.setAsyncSupported(asyncSupported);
}
public void setDescription(String description) {
- // TODO Auto-generated method stub
+ wrapper.setDescription(description);
}
public boolean setInitParameter(String name, String value) {
- // TODO Auto-generated method stub
- return false;
+ wrapper.addInitParameter(name, value);
+ // FIXME: return value
+ return true;
}
public void setInitParameters(Map<String, String> initParameters) {
- // TODO Auto-generated method stub
-
+ Iterator<String> parameterNames = initParameters.keySet().iterator();
+ while (parameterNames.hasNext()) {
+ String parameterName = parameterNames.next();
+ wrapper.addInitParameter(parameterName, initParameters.get(parameterName));
+ }
}
public void setLoadOnStartup(int loadOnStartup) {
- // TODO Auto-generated method stub
+ wrapper.setLoadOnStartup(loadOnStartup);
}
Modified: trunk/java/org/apache/catalina/startup/WebRuleSet.java
===================================================================
--- trunk/java/org/apache/catalina/startup/WebRuleSet.java 2009-03-12 16:05:46 UTC (rev 956)
+++ trunk/java/org/apache/catalina/startup/WebRuleSet.java 2009-03-12 18:09:30 UTC (rev 957)
@@ -264,6 +264,9 @@
"addChild",
"org.apache.catalina.Container");
+ digester.addCallMethod(prefix + "web-app/servlet/description",
+ "setDescription", 0);
+
digester.addCallMethod(prefix + "web-app/servlet/init-param",
"addInitParameter", 2);
digester.addCallParam(prefix + "web-app/servlet/init-param/param-name",
16 years
JBossWeb SVN: r956 - in trunk/java/org/apache/catalina: core and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-12 12:05:46 -0400 (Thu, 12 Mar 2009)
New Revision: 956
Modified:
trunk/java/org/apache/catalina/Context.java
trunk/java/org/apache/catalina/core/ApplicationContext.java
trunk/java/org/apache/catalina/core/LocalStrings.properties
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/catalina/core/StandardFilterFacade.java
trunk/java/org/apache/catalina/deploy/FilterDef.java
Log:
- Do the filter registration stuff.
Modified: trunk/java/org/apache/catalina/Context.java
===================================================================
--- trunk/java/org/apache/catalina/Context.java 2009-03-12 12:49:14 UTC (rev 955)
+++ trunk/java/org/apache/catalina/Context.java 2009-03-12 16:05:46 UTC (rev 956)
@@ -499,6 +499,14 @@
/**
+ * Add a filter mapping to this Context before current mappings.
+ *
+ * @param filterMap The filter mapping to be added
+ */
+ public void addFilterMapBefore(FilterMap filterMap);
+
+
+ /**
* Add the classname of an InstanceListener to be added to each
* Wrapper appended to this Context.
*
@@ -1013,6 +1021,16 @@
/**
+ * Return true if the Context has been initialized. This is lifecycle-ish, but
+ * needed by more and more Servlet API operations which are only permitted until
+ * the Context is initialized.
+ * @return true if the context is initialized.
+ *
+ */
+ public boolean isInitialized();
+
+
+ /**
* Set the validation feature of the XML parser used when
* parsing xml instances.
* @param xmlValidation true to enable xml instance validation
Modified: trunk/java/org/apache/catalina/core/ApplicationContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-03-12 12:49:14 UTC (rev 955)
+++ trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-03-12 16:05:46 UTC (rev 956)
@@ -811,78 +811,6 @@
// FIXME: removed
- public void addFilter(String filterName, String description,
- String className, Map<String, String> initParameters,
- boolean isAsyncSupported) {
-
- if (context.initialized) {
- //TODO Spec breaking enhancement to ignore this restriction
- throw new IllegalStateException(
- sm.getString("applicationContext.addFilter.ise",
- getContextPath()));
- }
- FilterDef filterDef = new FilterDef();
- filterDef.setFilterName(filterName);
- filterDef.setDescription(description);
- filterDef.setFilterClass(className);
- filterDef.getParameterMap().putAll(initParameters);
- context.addFilterDef(filterDef);
- // TODO SERVLET3 - ASync support
- }
-
-
- // FIXME: removed
- public void addFilterMappingForServletNames(String filterName,
- EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
- String... servletNames) {
- if (context.initialized) {
- //TODO Spec breaking enhancement to ignore this restriction
- throw new IllegalStateException(sm.getString(
- "applicationContext.addFilterMapping", getContextPath()));
- }
- FilterMap filterMap = new FilterMap();
- for (String servletName : servletNames) {
- filterMap.addServletName(servletName);
- }
- filterMap.setFilterName(filterName);
- for (DispatcherType dispatcherType: dispatcherTypes) {
- filterMap.setDispatcher(dispatcherType.name());
- }
- if (isMatchAfter) {
- context.addFilterMap(filterMap);
- } else {
- context.addFilterMapBefore(filterMap);
- }
- }
-
-
- // FIXME: removed
- public void addFilterMappingForUrlPatterns(String filterName,
- EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
- String... urlPatterns) {
-
- if (context.initialized) {
- //TODO Spec breaking enhancement to ignore this restriction
- throw new IllegalStateException(sm.getString(
- "applicationContext.addFilterMapping", getContextPath()));
- }
- FilterMap filterMap = new FilterMap();
- for (String urlPattern : urlPatterns) {
- filterMap.addURLPattern(urlPattern);
- }
- filterMap.setFilterName(filterName);
- for (DispatcherType dispatcherType: dispatcherTypes) {
- filterMap.setDispatcher(dispatcherType.name());
- }
- if (isMatchAfter) {
- context.addFilterMap(filterMap);
- } else {
- context.addFilterMapBefore(filterMap);
- }
- }
-
-
- // FIXME: removed
public void addServletMapping(String servletName, String[] urlPatterns) {
if (context.initialized) {
//TODO Spec breaking enhancement to ignore this restriction
@@ -898,8 +826,15 @@
public FilterRegistration addFilter(String filterName, String className)
throws IllegalArgumentException, IllegalStateException {
- // TODO Auto-generated method stub
- return null;
+ if (context.isInitialized()) {
+ throw new IllegalStateException(sm.getString("applicationContext.addFilter.ise",
+ getContextPath()));
+ }
+ FilterDef filterDef = new FilterDef();
+ filterDef.setFilterName(filterName);
+ filterDef.setFilterClass(className);
+ context.addFilterDef(filterDef);
+ return new StandardFilterFacade(context, filterDef);
}
@@ -911,8 +846,12 @@
public FilterRegistration findFilterRegistration(String filterName) {
- // TODO Auto-generated method stub
- return null;
+ FilterDef filterDef = context.findFilterDef(filterName);
+ if (filterDef == null) {
+ return null;
+ } else {
+ return new StandardFilterFacade(context, filterDef);
+ }
}
Modified: trunk/java/org/apache/catalina/core/LocalStrings.properties
===================================================================
--- trunk/java/org/apache/catalina/core/LocalStrings.properties 2009-03-12 12:49:14 UTC (rev 955)
+++ trunk/java/org/apache/catalina/core/LocalStrings.properties 2009-03-12 16:05:46 UTC (rev 956)
@@ -14,8 +14,6 @@
# limitations under the License.
applicationContext.addFilter.ise=Filters can not be added to context {0} at this time. See SRV.4.4.
-applicationContext.addFilterMapping.ise=Filter mappings can not be added to context {0} at this time. See SRV.4.4.
-applicationContext.addServletMapping.ise=Servlet mappings can not be added to context {0} at this time. See SRV.4.4.
applicationContext.attributeEvent=Exception thrown by attributes event listener
applicationContext.mapping.error=Error during mapping
applicationContext.requestDispatcher.iae=Path {0} does not start with a "/" character
@@ -219,4 +217,7 @@
defaultInstanceManager.privilegedServlet=Servlet of class {0} is privileged and cannot be loaded by this web application
defaultInstanceManager.restrictedFiltersResource=Restricted filters property file not found
defaultInstanceManager.privilegedFilter=Filter of class {0} is privileged and cannot be loaded by this web application
-defaultInstanceManager.restrictedListenersResources="Restricted listeners property file not found
\ No newline at end of file
+defaultInstanceManager.restrictedListenersResources="Restricted listeners property file not found
+
+filterRegistration.addFilterMapping.ise=Filter mappings can not be added to context {0} at this time. See SRV.4.4.
+servletRegistration.addServletMapping.ise=Servlet mappings can not be added to context {0} at this time. See SRV.4.4.
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2009-03-12 12:49:14 UTC (rev 955)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2009-03-12 16:05:46 UTC (rev 956)
@@ -5533,6 +5533,12 @@
}
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+
public ObjectName getParentName() throws MalformedObjectNameException {
// "Life" update
String path=oname.getKeyProperty("name");
Modified: trunk/java/org/apache/catalina/core/StandardFilterFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardFilterFacade.java 2009-03-12 12:49:14 UTC (rev 955)
+++ trunk/java/org/apache/catalina/core/StandardFilterFacade.java 2009-03-12 16:05:46 UTC (rev 956)
@@ -20,6 +20,7 @@
import java.util.EnumSet;
+import java.util.Iterator;
import java.util.Map;
import javax.servlet.DispatcherType;
@@ -27,11 +28,14 @@
import org.apache.catalina.Context;
import org.apache.catalina.deploy.FilterDef;
+import org.apache.catalina.deploy.FilterMap;
+import org.apache.catalina.util.StringManager;
/**
* Facade for the <b>FilterDef</b> object, with a hook to the Context to
- * store them automatically.
+ * store them automatically. The name of the class is not accurate, since
+ * there is no StandardFilter, but for consistency with StandardWrapper.
*
* @author Remy Maucharat
* @version $Revision: 947 $ $Date: 2009-03-10 05:02:22 +0100 (Tue, 10 Mar 2009) $
@@ -41,11 +45,18 @@
implements FilterRegistration {
+ /**
+ * The string manager for this package.
+ */
+ private static final StringManager sm =
+ StringManager.getManager(Constants.Package);
+
+
// ----------------------------------------------------------- Constructors
/**
- * Create a new facede around a StandardWrapper.
+ * Create a new facade around a FilterDef.
*/
public StandardFilterFacade(Context context, FilterDef filterDef) {
@@ -74,43 +85,77 @@
// --------------------------------------------- FilterRegistration Methods
- public void addMappingForServletNames(
- EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
- String... servletNames) {
- // TODO Auto-generated method stub
-
+ public void addMappingForServletNames(EnumSet<DispatcherType> dispatcherTypes,
+ boolean isMatchAfter, String... servletNames) {
+ if (context.isInitialized()) {
+ throw new IllegalStateException(sm.getString("filterRegistration.addFilterMapping.ise", context.getPath()));
+ }
+ FilterMap filterMap = new FilterMap();
+ for (String servletName : servletNames) {
+ filterMap.addServletName(servletName);
+ }
+ filterMap.setFilterName(filterDef.getFilterName());
+ for (DispatcherType dispatcherType: dispatcherTypes) {
+ filterMap.setDispatcher(dispatcherType.name());
+ }
+ if (isMatchAfter) {
+ context.addFilterMap(filterMap);
+ } else {
+ context.addFilterMapBefore(filterMap);
+ }
}
public void addMappingForUrlPatterns(
EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
String... urlPatterns) {
- // TODO Auto-generated method stub
-
+ if (context.isInitialized()) {
+ throw new IllegalStateException(sm.getString("filterRegistration.addFilterMapping.ise", context.getPath()));
+ }
+ FilterMap filterMap = new FilterMap();
+ for (String urlPattern : urlPatterns) {
+ filterMap.addURLPattern(urlPattern);
+ }
+ filterMap.setFilterName(filterDef.getFilterName());
+ for (DispatcherType dispatcherType: dispatcherTypes) {
+ filterMap.setDispatcher(dispatcherType.name());
+ }
+ if (isMatchAfter) {
+ context.addFilterMap(filterMap);
+ } else {
+ context.addFilterMapBefore(filterMap);
+ }
}
public void setAsyncSupported(boolean asyncSupported) {
- // TODO Auto-generated method stub
-
+ filterDef.setAsyncSupported(asyncSupported);
+ context.addFilterDef(filterDef);
}
public boolean setDescription(String description) {
- // TODO Auto-generated method stub
- return false;
+ filterDef.setDescription(description);
+ context.addFilterDef(filterDef);
+ // FIXME: return value ???
+ return true;
}
public boolean setInitParameter(String name, String value) {
- // TODO Auto-generated method stub
- return false;
+ filterDef.addInitParameter(name, value);
+ context.addFilterDef(filterDef);
+ // FIXME: return value ???
+ return true;
}
public void setInitParameters(Map<String, String> initParameters) {
- // TODO Auto-generated method stub
-
+ Iterator<String> parameterNames = initParameters.keySet().iterator();
+ while (parameterNames.hasNext()) {
+ String parameterName = parameterNames.next();
+ filterDef.addInitParameter(parameterName, initParameters.get(parameterName));
+ }
}
Modified: trunk/java/org/apache/catalina/deploy/FilterDef.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/FilterDef.java 2009-03-12 12:49:14 UTC (rev 955)
+++ trunk/java/org/apache/catalina/deploy/FilterDef.java 2009-03-12 16:05:46 UTC (rev 956)
@@ -35,10 +35,27 @@
public class FilterDef implements Serializable {
+ private static final long serialVersionUID = 8703643991210305617L;
+
+
// ------------------------------------------------------------- Properties
/**
+ * Async supported.
+ */
+ private boolean asyncSupported = false;
+
+ public boolean getAsyncSupported() {
+ return (this.asyncSupported);
+ }
+
+ public void setAsyncSupported(boolean asyncSupported) {
+ this.asyncSupported = asyncSupported;
+ }
+
+
+ /**
* The description of this filter.
*/
private String description = null;
16 years
JBossWeb SVN: r955 - in trunk/java: org/apache/catalina/startup and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-12 08:49:14 -0400 (Thu, 12 Mar 2009)
New Revision: 955
Added:
trunk/java/javax/servlet/resources/javaee_5.xsd
trunk/java/javax/servlet/resources/javaee_web_services_1_2.xsd
trunk/java/javax/servlet/resources/javaee_web_services_client_1_2.xsd
Modified:
trunk/java/org/apache/catalina/startup/DigesterFactory.java
Log:
- Copy the xsds over from jboss-metadata.
Added: trunk/java/javax/servlet/resources/javaee_5.xsd
===================================================================
--- trunk/java/javax/servlet/resources/javaee_5.xsd (rev 0)
+++ trunk/java/javax/servlet/resources/javaee_5.xsd 2009-03-12 12:49:14 UTC (rev 955)
@@ -0,0 +1,2095 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema
+ targetNamespace="http://java.sun.com/xml/ns/javaee"
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="5">
+ <xsd:annotation>
+ <xsd:documentation>
+ @(#)javaee_5.xsds 1.65 06/02/17
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Copyright 2003-2006 Sun Microsystems, Inc.
+ 4150 Network Circle
+ Santa Clara, California 95054
+ U.S.A
+ All rights reserved.
+
+ Sun Microsystems, Inc. has intellectual property rights
+ relating to technology described in this document. In
+ particular, and without limitation, these intellectual
+ property rights may include one or more of the U.S. patents
+ listed at http://www.sun.com/patents and one or more
+ additional patents or pending patent applications in the
+ U.S. and other countries.
+
+ This document and the technology which it describes are
+ distributed under licenses restricting their use, copying,
+ distribution, and decompilation. No part of this document
+ may be reproduced in any form by any means without prior
+ written authorization of Sun and its licensors, if any.
+
+ Third-party software, including font technology, is
+ copyrighted and licensed from Sun suppliers.
+
+ Sun, Sun Microsystems, the Sun logo, Solaris, Java, J2EE,
+ JavaServer Pages, Enterprise JavaBeans and the Java Coffee
+ Cup logo are trademarks or registered trademarks of Sun
+ Microsystems, Inc. in the U.S. and other countries.
+
+ Federal Acquisitions: Commercial Software - Government Users
+ Subject to Standard License Terms and Conditions.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+<xsd:annotation>
+<xsd:documentation>
+
+The following definitions that appear in the common
+shareable schema(s) of J2EE deployment descriptors should be
+interpreted with respect to the context they are included:
+
+Deployment Component may indicate one of the following:
+ j2ee application;
+ application client;
+ web application;
+ enterprise bean;
+ resource adapter;
+
+Deployment File may indicate one of the following:
+ ear file;
+ war file;
+ jar file;
+ rar file;
+
+</xsd:documentation>
+</xsd:annotation>
+
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+
+ <xsd:include schemaLocation="javaee_web_services_client_1_2.xsd"/>
+
+
+<!-- **************************************************** -->
+
+ <xsd:group name="descriptionGroup">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This group keeps the usage of the contained description related
+ elements consistent across Java EE deployment descriptors.
+
+ All elements may occur multiple times with different languages,
+ to support localization of the content.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="display-name"
+ type="javaee:display-nameType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="icon"
+ type="javaee:iconType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:group>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="descriptionType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The description type is used by a description element to
+ provide text describing the parent element. The elements
+ that use this type should include any information that the
+ Deployment Component's Deployment File file producer wants
+ to provide to the consumer of the Deployment Component's
+ Deployment File (i.e., to the Deployer). Typically, the
+ tools used by such a Deployment File consumer will display
+ the description when processing the parent element that
+ contains the description.
+
+ The lang attribute defines the language that the
+ description is provided in. The default value is "en" (English).
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:xsdStringType">
+ <xsd:attribute ref="xml:lang"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="dewey-versionType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type defines a dewey decimal that is used
+ to describe versions of documents.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="\.?[0-9]+(\.[0-9]+)*"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="display-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The display-name type contains a short name that is intended
+ to be displayed by tools. It is used by display-name
+ elements. The display name need not be unique.
+
+ Example:
+
+ ...
+ <display-name xml:lang="en">
+ Employee Self Service
+ </display-name>
+
+ The value of the xml:lang attribute is "en" (English) by default.
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:string">
+ <xsd:attribute ref="xml:lang"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ejb-linkType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The ejb-linkType is used by ejb-link
+ elements in the ejb-ref or ejb-local-ref elements to specify
+ that an EJB reference is linked to enterprise bean.
+
+ The value of the ejb-link element must be the ejb-name of an
+ enterprise bean in the same ejb-jar file or in another ejb-jar
+ file in the same Java EE application unit.
+
+ Alternatively, the name in the ejb-link element may be
+ composed of a path name specifying the ejb-jar containing the
+ referenced enterprise bean with the ejb-name of the target
+ bean appended and separated from the path name by "#". The
+ path name is relative to the Deployment File containing
+ Deployment Component that is referencing the enterprise
+ bean. This allows multiple enterprise beans with the same
+ ejb-name to be uniquely identified.
+
+ Examples:
+
+ <ejb-link>EmployeeRecord</ejb-link>
+
+ <ejb-link>../products/product.jar#ProductEJB</ejb-link>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ejb-local-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-local-refType is used by ejb-local-ref elements for
+ the declaration of a reference to an enterprise bean's local
+ home or to the local business interface of a 3.0 bean.
+ The declaration consists of:
+
+ - an optional description
+ - the EJB reference name used in the code of the Deployment
+ Component that's referencing the enterprise bean.
+ - the optional expected type of the referenced enterprise bean
+ - the optional expected local interface of the referenced
+ enterprise bean or the local business interface of the
+ referenced enterprise bean.
+ - the optional expected local home interface of the referenced
+ enterprise bean. Not applicable if this ejb-local-ref refers
+ to the local business interface of a 3.0 bean.
+ - optional ejb-link information, used to specify the
+ referenced enterprise bean
+ - optional elements to define injection of the named enterprise
+ bean into a component field or property.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="ejb-ref-name"
+ type="javaee:ejb-ref-nameType"/>
+ <xsd:element name="ejb-ref-type"
+ type="javaee:ejb-ref-typeType"
+ minOccurs="0"/>
+ <xsd:element name="local-home"
+ type="javaee:local-homeType"
+ minOccurs="0"/>
+ <xsd:element name="local"
+ type="javaee:localType"
+ minOccurs="0"/>
+ <xsd:element name="ejb-link"
+ type="javaee:ejb-linkType"
+ minOccurs="0"/>
+ <xsd:group ref="javaee:resourceGroup"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ejb-ref-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The ejb-ref-name element contains the name of an EJB
+ reference. The EJB reference is an entry in the
+ Deployment Component's environment and is relative to the
+ java:comp/env context. The name must be unique within the
+ Deployment Component.
+
+ It is recommended that name is prefixed with "ejb/".
+
+ Example:
+
+ <ejb-ref-name>ejb/Payroll</ejb-ref-name>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:jndi-nameType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ejb-ref-typeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-ref-typeType contains the expected type of the
+ referenced enterprise bean.
+
+ The ejb-ref-type designates a value
+ that must be one of the following:
+
+ Entity
+ Session
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="Entity"/>
+ <xsd:enumeration value="Session"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ejb-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-refType is used by ejb-ref elements for the
+ declaration of a reference to an enterprise bean's home or
+ to the remote business interface of a 3.0 bean.
+ The declaration consists of:
+
+ - an optional description
+ - the EJB reference name used in the code of
+ the Deployment Component that's referencing the enterprise
+ bean.
+ - the optional expected type of the referenced enterprise bean
+ - the optional remote interface of the referenced enterprise bean
+ or the remote business interface of the referenced enterprise
+ bean
+ - the optional expected home interface of the referenced
+ enterprise bean. Not applicable if this ejb-ref
+ refers to the remote business interface of a 3.0 bean.
+ - optional ejb-link information, used to specify the
+ referenced enterprise bean
+ - optional elements to define injection of the named enterprise
+ bean into a component field or property
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="ejb-ref-name"
+ type="javaee:ejb-ref-nameType"/>
+ <xsd:element name="ejb-ref-type"
+ type="javaee:ejb-ref-typeType"
+ minOccurs="0"/>
+ <xsd:element name="home"
+ type="javaee:homeType"
+ minOccurs="0"/>
+ <xsd:element name="remote"
+ type="javaee:remoteType"
+ minOccurs="0"/>
+ <xsd:element name="ejb-link"
+ type="javaee:ejb-linkType"
+ minOccurs="0"/>
+ <xsd:group ref="javaee:resourceGroup"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="emptyType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type is used to designate an empty
+ element when used.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="env-entry-type-valuesType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ This type contains the fully-qualified Java type of the
+ environment entry value that is expected by the
+ application's code.
+
+ The following are the legal values of env-entry-type-valuesType:
+
+ java.lang.Boolean
+ java.lang.Byte
+ java.lang.Character
+ java.lang.String
+ java.lang.Short
+ java.lang.Integer
+ java.lang.Long
+ java.lang.Float
+ java.lang.Double
+
+ Example:
+
+ <env-entry-type>java.lang.Boolean</env-entry-type>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="java.lang.Boolean"/>
+ <xsd:enumeration value="java.lang.Byte"/>
+ <xsd:enumeration value="java.lang.Character"/>
+ <xsd:enumeration value="java.lang.String"/>
+ <xsd:enumeration value="java.lang.Short"/>
+ <xsd:enumeration value="java.lang.Integer"/>
+ <xsd:enumeration value="java.lang.Long"/>
+ <xsd:enumeration value="java.lang.Float"/>
+ <xsd:enumeration value="java.lang.Double"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="env-entryType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The env-entryType is used to declare an application's
+ environment entry. The declaration consists of an optional
+ description, the name of the environment entry, a type
+ (optional if the value is injected, otherwise required), and
+ an optional value.
+
+ It also includes optional elements to define injection of
+ the named resource into fields or JavaBeans properties.
+
+ If a value is not specified and injection is requested,
+ no injection will occur and no entry of the specified name
+ will be created. This allows an initial value to be
+ specified in the source code without being incorrectly
+ changed when no override has been specified.
+
+ If a value is not specified and no injection is requested,
+ a value must be supplied during deployment.
+
+ This type is used by env-entry elements.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="env-entry-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The env-entry-name element contains the name of a
+ Deployment Component's environment entry. The name
+ is a JNDI name relative to the java:comp/env
+ context. The name must be unique within a
+ Deployment Component. The uniqueness
+ constraints must be defined within the declared
+ context.
+
+ Example:
+
+ <env-entry-name>minAmount</env-entry-name>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="env-entry-type"
+ type="javaee:env-entry-type-valuesType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The env-entry-type element contains the Java language
+ type of the environment entry. If an injection target
+ is specified for the environment entry, the type may
+ be omitted, or must match the type of the injection
+ target. If no injection target is specified, the type
+ is required.
+
+ Example:
+
+ <env-entry-type>java.lang.Integer</env-entry-type>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="env-entry-value"
+ type="javaee:xsdStringType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The env-entry-value designates the value of a
+ Deployment Component's environment entry. The value
+ must be a String that is valid for the
+ constructor of the specified type that takes a
+ single String parameter, or for java.lang.Character,
+ a single character.
+
+ Example:
+
+ <env-entry-value>100.00</env-entry-value>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:group ref="javaee:resourceGroup"/>
+
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The elements that use this type designate the name of a
+ Java class or interface. The name is in the form of a
+ "binary name", as defined in the JLS. This is the form
+ of name used in Class.forName(). Tools that need the
+ canonical name (the name used in source code) will need
+ to convert this binary name to the canonical name.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="generic-booleanType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type defines four different values which can designate
+ boolean values. This includes values yes and no which are
+ not designated by xsd:boolean
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="true"/>
+ <xsd:enumeration value="false"/>
+ <xsd:enumeration value="yes"/>
+ <xsd:enumeration value="no"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="homeType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The homeType defines the fully-qualified name of
+ an enterprise bean's home interface.
+
+ Example:
+
+ <home>com.aardvark.payroll.PayrollHome</home>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="iconType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The icon type contains small-icon and large-icon elements
+ that specify the file names for small and large GIF, JPEG,
+ or PNG icon images used to represent the parent element in a
+ GUI tool.
+
+ The xml:lang attribute defines the language that the
+ icon file names are provided in. Its value is "en" (English)
+ by default.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="small-icon" type="javaee:pathType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The small-icon element contains the name of a file
+ containing a small (16 x 16) icon image. The file
+ name is a relative path within the Deployment
+ Component's Deployment File.
+
+ The image may be in the GIF, JPEG, or PNG format.
+ The icon can be used by tools.
+
+ Example:
+
+ <small-icon>employee-service-icon16x16.jpg</small-icon>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="large-icon" type="javaee:pathType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The large-icon element contains the name of a file
+ containing a large
+ (32 x 32) icon image. The file name is a relative
+ path within the Deployment Component's Deployment
+ File.
+
+ The image may be in the GIF, JPEG, or PNG format.
+ The icon can be used by tools.
+
+ Example:
+
+ <large-icon>employee-service-icon32x32.jpg</large-icon>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ </xsd:sequence>
+
+ <xsd:attribute ref="xml:lang"/>
+ <xsd:attribute name="id" type="xsd:ID"/>
+
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="injection-targetType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ An injection target specifies a class and a name within
+ that class into which a resource should be injected.
+
+ The injection target class specifies the fully qualified
+ class name that is the target of the injection. The
+ Java EE specifications describe which classes can be an
+ injection target.
+
+ The injection target name specifies the target within
+ the specified class. The target is first looked for as a
+ JavaBeans property name. If not found, the target is
+ looked for as a field name.
+
+ The specified resource will be injected into the target
+ during initialization of the class by either calling the
+ set method for the target property or by setting a value
+ into the named field.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="injection-target-class"
+ type="javaee:fully-qualified-classType"/>
+ <xsd:element name="injection-target-name"
+ type="javaee:java-identifierType"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="java-identifierType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The java-identifierType defines a Java identifier.
+ The users of this type should further verify that
+ the content does not contain Java reserved keywords.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:pattern value="($|_|\p{L})(\p{L}|\p{Nd}|_|$)*"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="java-typeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This is a generic type that designates a Java primitive
+ type or a fully qualified name of a Java interface/type,
+ or an array of such types.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:pattern value="[^\p{Z}]*"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The jndi-nameType type designates a JNDI name in the
+ Deployment Component's environment and is relative to the
+ java:comp/env context. A JNDI name must be unique within the
+ Deployment Component.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:group name="jndiEnvironmentRefsGroup">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This group keeps the usage of the contained JNDI environment
+ reference elements consistent across Java EE deployment descriptors.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="env-entry"
+ type="javaee:env-entryType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="ejb-ref"
+ type="javaee:ejb-refType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="ejb-local-ref"
+ type="javaee:ejb-local-refType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:group ref="javaee:service-refGroup"/>
+ <xsd:element name="resource-ref"
+ type="javaee:resource-refType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="resource-env-ref"
+ type="javaee:resource-env-refType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="message-destination-ref"
+ type="javaee:message-destination-refType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="persistence-context-ref"
+ type="javaee:persistence-context-refType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="persistence-unit-ref"
+ type="javaee:persistence-unit-refType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="post-construct"
+ type="javaee:lifecycle-callbackType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="pre-destroy"
+ type="javaee:lifecycle-callbackType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:group>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="lifecycle-callbackType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The lifecycle-callback type specifies a method on a
+ class to be called when a lifecycle event occurs.
+ Note that each class may have only one lifecycle callback
+ method for any given event and that the method may not
+ be overloaded.
+
+ If the lifefycle-callback-class element is missing then
+ the class defining the callback is assumed to be the
+ component class in scope at the place in the descriptor
+ in which the callback definition appears.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="lifecycle-callback-class"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0"/>
+ <xsd:element name="lifecycle-callback-method"
+ type="javaee:java-identifierType"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="listenerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The listenerType indicates the deployment properties for a web
+ application listener bean.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="listener-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The listener-class element declares a class in the
+ application must be registered as a web
+ application listener bean. The value is the fully
+ qualified classname of the listener class.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="local-homeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The local-homeType defines the fully-qualified
+ name of an enterprise bean's local home interface.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="localType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The localType defines the fully-qualified name of an
+ enterprise bean's local interface.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="message-destination-linkType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The message-destination-linkType is used to link a message
+ destination reference or message-driven bean to a message
+ destination.
+
+ The Assembler sets the value to reflect the flow of messages
+ between producers and consumers in the application.
+
+ The value must be the message-destination-name of a message
+ destination in the same Deployment File or in another
+ Deployment File in the same Java EE application unit.
+
+ Alternatively, the value may be composed of a path name
+ specifying a Deployment File containing the referenced
+ message destination with the message-destination-name of the
+ destination appended and separated from the path name by
+ "#". The path name is relative to the Deployment File
+ containing Deployment Component that is referencing the
+ message destination. This allows multiple message
+ destinations with the same name to be uniquely identified.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="message-destination-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The message-destination-ref element contains a declaration
+ of Deployment Component's reference to a message destination
+ associated with a resource in Deployment Component's
+ environment. It consists of:
+
+ - an optional description
+ - the message destination reference name
+ - an optional message destination type
+ - an optional specification as to whether
+ the destination is used for
+ consuming or producing messages, or both.
+ if not specified, "both" is assumed.
+ - an optional link to the message destination
+ - optional injection targets
+
+ The message destination type must be supplied unless an
+ injection target is specified, in which case the type
+ of the target is used. If both are specified, the type
+ must be assignment compatible with the type of the injection
+ target.
+
+ Examples:
+
+ <message-destination-ref>
+ <message-destination-ref-name>jms/StockQueue
+ </message-destination-ref-name>
+ <message-destination-type>javax.jms.Queue
+ </message-destination-type>
+ <message-destination-usage>Consumes
+ </message-destination-usage>
+ <message-destination-link>CorporateStocks
+ </message-destination-link>
+ </message-destination-ref>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="message-destination-ref-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The message-destination-ref-name element specifies
+ the name of a message destination reference; its
+ value is the environment entry name used in
+ Deployment Component code. The name is a JNDI name
+ relative to the java:comp/env context and must be
+ unique within an ejb-jar (for enterprise beans) or a
+ Deployment File (for others).
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="message-destination-type"
+ type="javaee:message-destination-typeType"
+ minOccurs="0"/>
+ <xsd:element name="message-destination-usage"
+ type="javaee:message-destination-usageType"
+ minOccurs="0"/>
+ <xsd:element name="message-destination-link"
+ type="javaee:message-destination-linkType"
+ minOccurs="0"/>
+
+ <xsd:group ref="javaee:resourceGroup"/>
+
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="message-destination-typeType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The message-destination-typeType specifies the type of
+ the destination. The type is specified by the Java interface
+ expected to be implemented by the destination.
+
+ Example:
+
+ <message-destination-type>javax.jms.Queue
+ </message-destination-type>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="message-destination-usageType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The message-destination-usageType specifies the use of the
+ message destination indicated by the reference. The value
+ indicates whether messages are consumed from the message
+ destination, produced for the destination, or both. The
+ Assembler makes use of this information in linking producers
+ of a destination with its consumers.
+
+ The value of the message-destination-usage element must be
+ one of the following:
+ Consumes
+ Produces
+ ConsumesProduces
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="Consumes"/>
+ <xsd:enumeration value="Produces"/>
+ <xsd:enumeration value="ConsumesProduces"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="message-destinationType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The message-destinationType specifies a message
+ destination. The logical destination described by this
+ element is mapped to a physical destination by the Deployer.
+
+ The message destination element contains:
+
+ - an optional description
+ - an optional display-name
+ - an optional icon
+ - a message destination name which must be unique
+ among message destination names within the same
+ Deployment File.
+ - an optional mapped name
+
+ Example:
+
+ <message-destination>
+ <message-destination-name>CorporateStocks
+ </message-destination-name>
+ </message-destination>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="message-destination-name"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The message-destination-name element specifies a
+ name for a message destination. This name must be
+ unique among the names of message destinations
+ within the Deployment File.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="mapped-name"
+ type="javaee:xsdStringType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ A product specific name that this message destination
+ should be mapped to. Each message-destination-ref
+ element that references this message destination will
+ define a name in the namespace of the referencing
+ component. (It's a name in the JNDI java:comp/env
+ namespace.) Many application servers provide a way to
+ map these local names to names of resources known to the
+ application server. This mapped name is often a global
+ JNDI name, but may be a name of any form. Each of the
+ local names should be mapped to this same global name.
+
+ Application servers are not required to support any
+ particular form or type of mapped name, nor the ability
+ to use mapped names. The mapped name is
+ product-dependent and often installation-dependent. No
+ use of a mapped name is portable.
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="param-valueType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type is a general type that can be used to declare
+ parameter/value lists.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="param-name"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The param-name element contains the name of a
+ parameter.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="param-value"
+ type="javaee:xsdStringType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The param-value element contains the value of a
+ parameter.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="pathType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The elements that use this type designate either a relative
+ path or an absolute path starting with a "/".
+
+ In elements that specify a pathname to a file within the
+ same Deployment File, relative filenames (i.e., those not
+ starting with "/") are considered relative to the root of
+ the Deployment File's namespace. Absolute filenames (i.e.,
+ those starting with "/") also specify names in the root of
+ the Deployment File's namespace. In general, relative names
+ are preferred. The exception is .war files where absolute
+ names are preferred for consistency with the Servlet API.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="persistence-context-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The persistence-context-ref element contains a declaration
+ of Deployment Component's reference to a persistence context
+ associated within a Deployment Component's
+ environment. It consists of:
+
+ - an optional description
+ - the persistence context reference name
+ - an optional persistence unit name. If not specified,
+ the default persistence unit is assumed.
+ - an optional specification as to whether
+ the persistence context type is Transaction or
+ Extended. If not specified, Transaction is assumed.
+ - an optional list of persistence properties
+ - optional injection targets
+
+ Examples:
+
+ <persistence-context-ref>
+ <persistence-context-ref-name>myPersistenceContext
+ </persistence-context-ref-name>
+ </persistence-context-ref>
+
+ <persistence-context-ref>
+ <persistence-context-ref-name>myPersistenceContext
+ </persistence-context-ref-name>
+ <persistence-unit-name>PersistenceUnit1
+ </persistence-unit-name>
+ <persistence-context-type>Extended</persistence-context-type>
+ </persistence-context-ref>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="persistence-context-ref-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The persistence-context-ref-name element specifies
+ the name of a persistence context reference; its
+ value is the environment entry name used in
+ Deployment Component code. The name is a JNDI name
+ relative to the java:comp/env context.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="persistence-unit-name"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The Application Assembler(or BeanProvider) may use the
+ following syntax to avoid the need to rename persistence
+ units to have unique names within a Java EE application.
+
+ The Application Assembler specifies the pathname of the
+ root of the persistence.xml file for the referenced
+ persistence unit and appends the name of the persistence
+ unit separated from the pathname by #. The pathname is
+ relative to the referencing application component jar file.
+ In this manner, multiple persistence units with the same
+ persistence unit name may be uniquely identified when the
+ Application Assembler cannot change persistence unit names.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="persistence-context-type"
+ type="javaee:persistence-context-typeType"
+ minOccurs="0"/>
+
+ <xsd:element name="persistence-property"
+ type="javaee:propertyType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Used to specify properties for the container or persistence
+ provider. Vendor-specific properties may be included in
+ the set of properties. Properties that are not recognized
+ by a vendor must be ignored. Entries that make use of the
+ namespace javax.persistence and its subnamespaces must not
+ be used for vendor-specific properties. The namespace
+ javax.persistence is reserved for use by the specification.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:group ref="javaee:resourceGroup"/>
+
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="persistence-context-typeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The persistence-context-typeType specifies the transactional
+ nature of a persistence context reference.
+
+ The value of the persistence-context-type element must be
+ one of the following:
+ Transaction
+ Extended
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="Transaction"/>
+ <xsd:enumeration value="Extended"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="persistence-unit-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The persistence-unit-ref element contains a declaration
+ of Deployment Component's reference to a persistence unit
+ associated within a Deployment Component's
+ environment. It consists of:
+
+ - an optional description
+ - the persistence unit reference name
+ - an optional persistence unit name. If not specified,
+ the default persistence unit is assumed.
+ - optional injection targets
+
+ Examples:
+
+ <persistence-unit-ref>
+ <persistence-unit-ref-name>myPersistenceUnit
+ </persistence-unit-ref-name>
+ </persistence-unit-ref>
+
+ <persistence-unit-ref>
+ <persistence-unit-ref-name>myPersistenceUnit
+ </persistence-unit-ref-name>
+ <persistence-unit-name>PersistenceUnit1
+ </persistence-unit-name>
+ </persistence-unit-ref>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="persistence-unit-ref-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The persistence-unit-ref-name element specifies
+ the name of a persistence unit reference; its
+ value is the environment entry name used in
+ Deployment Component code. The name is a JNDI name
+ relative to the java:comp/env context.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="persistence-unit-name"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The Application Assembler(or BeanProvider) may use the
+ following syntax to avoid the need to rename persistence
+ units to have unique names within a Java EE application.
+
+ The Application Assembler specifies the pathname of the
+ root of the persistence.xml file for the referenced
+ persistence unit and appends the name of the persistence
+ unit separated from the pathname by #. The pathname is
+ relative to the referencing application component jar file.
+ In this manner, multiple persistence units with the same
+ persistence unit name may be uniquely identified when the
+ Application Assembler cannot change persistence unit names.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:group ref="javaee:resourceGroup"/>
+
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="propertyType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Specifies a name/value pair.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="name"
+ type="javaee:xsdStringType">
+ </xsd:element>
+ <xsd:element name="value"
+ type="javaee:xsdStringType">
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="remoteType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The remote element contains the fully-qualified name
+ of the enterprise bean's remote interface.
+
+ Example:
+
+ <remote>com.wombat.empl.EmployeeService</remote>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="res-authType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The res-authType specifies whether the Deployment Component
+ code signs on programmatically to the resource manager, or
+ whether the Container will sign on to the resource manager
+ on behalf of the Deployment Component. In the latter case,
+ the Container uses information that is supplied by the
+ Deployer.
+
+ The value must be one of the two following:
+
+ Application
+ Container
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="Application"/>
+ <xsd:enumeration value="Container"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="res-sharing-scopeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The res-sharing-scope type specifies whether connections
+ obtained through the given resource manager connection
+ factory reference can be shared. The value, if specified,
+ must be one of the two following:
+
+ Shareable
+ Unshareable
+
+ The default value is Shareable.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="Shareable"/>
+ <xsd:enumeration value="Unshareable"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="resource-env-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The resource-env-refType is used to define
+ resource-env-type elements. It contains a declaration of a
+ Deployment Component's reference to an administered object
+ associated with a resource in the Deployment Component's
+ environment. It consists of an optional description, the
+ resource environment reference name, and an optional
+ indication of the resource environment reference type
+ expected by the Deployment Component code.
+
+ It also includes optional elements to define injection of
+ the named resource into fields or JavaBeans properties.
+
+ The resource environment type must be supplied unless an
+ injection target is specified, in which case the type
+ of the target is used. If both are specified, the type
+ must be assignment compatible with the type of the injection
+ target.
+
+ Example:
+
+ <resource-env-ref>
+ <resource-env-ref-name>jms/StockQueue
+ </resource-env-ref-name>
+ <resource-env-ref-type>javax.jms.Queue
+ </resource-env-ref-type>
+ </resource-env-ref>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="resource-env-ref-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The resource-env-ref-name element specifies the name
+ of a resource environment reference; its value is
+ the environment entry name used in
+ the Deployment Component code. The name is a JNDI
+ name relative to the java:comp/env context and must
+ be unique within a Deployment Component.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="resource-env-ref-type"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The resource-env-ref-type element specifies the type
+ of a resource environment reference. It is the
+ fully qualified name of a Java language class or
+ interface.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:group ref="javaee:resourceGroup"/>
+
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="resource-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The resource-refType contains a declaration of a
+ Deployment Component's reference to an external resource. It
+ consists of an optional description, the resource manager
+ connection factory reference name, an optional indication of
+ the resource manager connection factory type expected by the
+ Deployment Component code, an optional type of authentication
+ (Application or Container), and an optional specification of
+ the shareability of connections obtained from the resource
+ (Shareable or Unshareable).
+
+ It also includes optional elements to define injection of
+ the named resource into fields or JavaBeans properties.
+
+ The connection factory type must be supplied unless an
+ injection target is specified, in which case the type
+ of the target is used. If both are specified, the type
+ must be assignment compatible with the type of the injection
+ target.
+
+ Example:
+
+ <resource-ref>
+ <res-ref-name>jdbc/EmployeeAppDB</res-ref-name>
+ <res-type>javax.sql.DataSource</res-type>
+ <res-auth>Container</res-auth>
+ <res-sharing-scope>Shareable</res-sharing-scope>
+ </resource-ref>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="res-ref-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The res-ref-name element specifies the name of a
+ resource manager connection factory reference.
+ The name is a JNDI name relative to the
+ java:comp/env context.
+ The name must be unique within a Deployment File.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="res-type"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The res-type element specifies the type of the data
+ source. The type is specified by the fully qualified
+ Java language class or interface
+ expected to be implemented by the data source.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="res-auth"
+ type="javaee:res-authType"
+ minOccurs="0"/>
+
+ <xsd:element name="res-sharing-scope"
+ type="javaee:res-sharing-scopeType"
+ minOccurs="0"/>
+
+ <xsd:group ref="javaee:resourceGroup"/>
+
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:group name="resourceGroup">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This group collects elements that are common to all the
+ JNDI resource elements.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="mapped-name"
+ type="javaee:xsdStringType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ A product specific name that this resource should be
+ mapped to. The name of this resource, as defined by the
+ resource's name element or defaulted, is a name that is
+ local to the application component using the resource.
+ (It's a name in the JNDI java:comp/env namespace.) Many
+ application servers provide a way to map these local
+ names to names of resources known to the application
+ server. This mapped name is often a global JNDI name,
+ but may be a name of any form.
+
+ Application servers are not required to support any
+ particular form or type of mapped name, nor the ability
+ to use mapped names. The mapped name is
+ product-dependent and often installation-dependent. No
+ use of a mapped name is portable.
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="injection-target"
+ type="javaee:injection-targetType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:group>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="role-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The role-nameType designates the name of a security role.
+
+ The name must conform to the lexical rules for a token.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="run-asType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The run-asType specifies the run-as identity to be
+ used for the execution of a component. It contains an
+ optional description, and the name of a security role.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="role-name"
+ type="javaee:role-nameType"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="security-role-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The security-role-refType contains the declaration of a
+ security role reference in a component's or a
+ Deployment Component's code. The declaration consists of an
+ optional description, the security role name used in the
+ code, and an optional link to a security role. If the
+ security role is not specified, the Deployer must choose an
+ appropriate security role.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="role-name"
+ type="javaee:role-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The value of the role-name element must be the String used
+ as the parameter to the
+ EJBContext.isCallerInRole(String roleName) method or the
+ HttpServletRequest.isUserInRole(String role) method.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="role-link"
+ type="javaee:role-nameType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The role-link element is a reference to a defined
+ security role. The role-link element must contain
+ the name of one of the security roles defined in the
+ security-role elements.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="security-roleType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The security-roleType contains the definition of a security
+ role. The definition consists of an optional description of
+ the security role, and the security role name.
+
+ Example:
+
+ <security-role>
+ <description>
+ This role includes all employees who are authorized
+ to access the employee service application.
+ </description>
+ <role-name>employee</role-name>
+ </security-role>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="role-name"
+ type="javaee:role-nameType"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This is a special string datatype that is defined by Java EE as
+ a base type for defining collapsed strings. When schemas
+ require trailing/leading space elimination as well as
+ collapsing the existing whitespace, this base type may be
+ used.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:token">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="true-falseType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This simple type designates a boolean with only two
+ permissible values
+
+ - true
+ - false
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:xsdBooleanType">
+ <xsd:pattern value="(true|false)"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="url-patternType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The url-patternType contains the url pattern of the mapping.
+ It must follow the rules specified in Section 11.2 of the
+ Servlet API Specification. This pattern is assumed to be in
+ URL-decoded form and must not contain CR(#xD) or LF(#xA).
+ If it contains those characters, the container must inform
+ the developer with a descriptive error message.
+ The container must preserve all characters including whitespaces.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdAnyURIType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:anyURI.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:anyURI">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdBooleanType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:boolean.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:boolean">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdIntegerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:integer.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:integer">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdNMTOKENType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:NMTOKEN.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:NMTOKEN">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdNonNegativeIntegerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:nonNegativeInteger.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:nonNegativeInteger">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdPositiveIntegerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:positiveInteger.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:positiveInteger">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdQNameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:QName.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:QName">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdStringType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:string.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+</xsd:schema>
+
Added: trunk/java/javax/servlet/resources/javaee_web_services_1_2.xsd
===================================================================
--- trunk/java/javax/servlet/resources/javaee_web_services_1_2.xsd (rev 0)
+++ trunk/java/javax/servlet/resources/javaee_web_services_1_2.xsd 2009-03-12 12:49:14 UTC (rev 955)
@@ -0,0 +1,747 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://java.sun.com/xml/ns/javaee"
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="1.2">
+ <xsd:annotation>
+ <xsd:documentation>
+ @(#)javaee_web_services_1_2.xsds 1.18 02/13/06
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Copyright 2003-2006 Sun Microsystems, Inc.
+ 4150 Network Circle
+ Santa Clara, California 95054
+ U.S.A
+ All rights reserved.
+
+ Sun Microsystems, Inc. has intellectual property rights
+ relating to technology described in this document. In
+ particular, and without limitation, these intellectual
+ property rights may include one or more of the U.S. patents
+ listed at http://www.sun.com/patents and one or more
+ additional patents or pending patent applications in the
+ U.S. and other countries.
+
+ This document and the technology which it describes are
+ distributed under licenses restricting their use, copying,
+ distribution, and decompilation. No part of this document
+ may be reproduced in any form by any means without prior
+ written authorization of Sun and its licensors, if any.
+
+ Third-party software, including font technology, is
+ copyrighted and licensed from Sun suppliers.
+
+ Sun, Sun Microsystems, the Sun logo, Solaris, Java, J2EE,
+ JavaServer Pages, Enterprise JavaBeans and the Java Coffee
+ Cup logo are trademarks or registered trademarks of Sun
+ Microsystems, Inc. in the U.S. and other countries.
+
+ Federal Acquisitions: Commercial Software - Government Users
+ Subject to Standard License Terms and Conditions.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ (C) Copyright International Business Machines Corporation 2002
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The webservices element is the root element for the web services
+ deployment descriptor. It specifies the set of web service
+ descriptions that are to be deployed into the Java EE Application
+ Server and the dependencies they have on container resources and
+ services. The deployment descriptor must be named
+ "META-INF/webservices.xml" in the web services' jar file.
+
+ Used in: webservices.xml
+
+ All webservices deployment descriptors must indicate the
+ webservices schema by using the Java EE namespace:
+
+ http://java.sun.com/xml/ns/javaee
+
+ and by indicating the version of the schema by using the version
+ element as shown below:
+
+ <webservices xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/javaee_web_services_1_2.xsd"
+ version="1.2">
+ ...
+ </webservices>
+
+ The instance documents may indicate the published version of the
+ schema using the xsi:schemaLocation attribute for the Java EE
+ namespace with the following location:
+
+ http://java.sun.com/xml/ns/javaee/javaee_web_services_1_2.xsd
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The following conventions apply to all Java EE
+ deployment descriptor elements unless indicated otherwise.
+
+ - In elements that specify a pathname to a file within the
+ same JAR file, relative filenames (i.e., those not
+ starting with "/") are considered relative to the root of
+ the JAR file's namespace. Absolute filenames (i.e., those
+ starting with "/") also specify names in the root of the
+ JAR file's namespace. In general, relative names are
+ preferred. The exception is .war files where absolute
+ names are preferred for consistency with the Servlet API.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:include schemaLocation="javaee_5.xsd"/>
+
+
+<!-- **************************************************** -->
+
+ <xsd:element name="webservices" type="javaee:webservicesType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The webservices element is the root element for the web services
+ deployment descriptor. It specifies the set of web service
+ descriptions that are to be deployed into the Java EE Application Server
+ and the dependencies they have on container resources and services.
+
+ Used in: webservices.xml
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:key name="webservice-description-name-key">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The webservice-description-name identifies the collection of
+ port-components associated with a WSDL file and JAX-RPC mapping. The
+ name must be unique within the deployment descriptor.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:webservice-description"/>
+ <xsd:field xpath="javaee:webservice-description-name"/>
+ </xsd:key>
+ </xsd:element>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="handler-chainType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The handler-chain element defines the handlerchain.
+ Handlerchain can be defined such that the handlers in the
+ handlerchain operate,all ports of a service, on a specific
+ port or on a list of protocol-bindings. The choice of elements
+ service-name-pattern, port-name-pattern and protocol-bindings
+ are used to specify whether the handlers in handler-chain are
+ for a service, port or protocol binding. If none of these
+ choices are specified with the handler-chain element then the
+ handlers specified in the handler-chain will be applied on
+ everything.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+
+ <xsd:choice minOccurs="0" maxOccurs="1">
+ <xsd:element name="service-name-pattern"
+ type="javaee:qname-pattern" />
+ <xsd:element name="port-name-pattern"
+ type="javaee:qname-pattern" />
+ <xsd:element name="protocol-bindings"
+ type="javaee:protocol-bindingListType"/>
+ </xsd:choice>
+
+ <xsd:element name="handler"
+ type="javaee:port-component_handlerType"
+ minOccurs="1" maxOccurs="unbounded"/>
+ </xsd:sequence>
+
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="handler-chainsType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The handler-chains element defines the handlerchains associated
+ with this service or service endpoint.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="handler-chain"
+ type="javaee:handler-chainType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="port-componentType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The port-component element associates a WSDL port with a web service
+ interface and implementation. It defines the name of the port as a
+ component, optional description, optional display name, optional iconic
+ representations, WSDL port QName, Service Endpoint Interface, Service
+ Implementation Bean.
+
+ This element also associates a WSDL service with a JAX-WS Provider
+ implementation.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="display-name"
+ type="javaee:display-nameType"
+ minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="icon"
+ type="javaee:iconType"
+ minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="port-component-name"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The port-component-name element specifies a port component's
+ name. This name is assigned by the module producer to name
+ the service implementation bean in the module's deployment
+ descriptor. The name must be unique among the port component
+ names defined in the same module.
+
+ Used in: port-component
+
+ Example:
+ <port-component-name>EmployeeService
+ </port-component-name>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="wsdl-service"
+ type="javaee:xsdQNameType"
+ minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Defines the name space and local name part of the WSDL
+ service QName. This is required to be specified for
+ port components that are JAX-WS Provider implementations.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="wsdl-port"
+ type="javaee:xsdQNameType"
+ minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Defines the name space and local name part of the WSDL
+ port QName. This is not required to be specified for port
+ components that are JAX-WS Provider implementations
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="enable-mtom"
+ type="javaee:true-falseType"
+ minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Used to enable or disable SOAP MTOM/XOP mechanism for an
+ endpoint implementation.
+
+ Not to be specified for JAX-RPC runtime
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="protocol-binding"
+ type="javaee:protocol-bindingType"
+ minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Used to specify the protocol binding used by the port-component.
+ If this element is not specified, then the default binding is
+ used (SOAP 1.1 over HTTP)
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="service-endpoint-interface"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The service-endpoint-interface element contains the
+ fully-qualified name of the port component's Service Endpoint
+ Interface.
+
+ Used in: port-component
+
+ Example:
+ <remote>com.wombat.empl.EmployeeService</remote>
+
+ This may not be specified in case there is no Service
+ Enpoint Interface as is the case with directly using an
+ implementation class with the @WebService annotation.
+
+ When the port component is a Provider implementation
+ this is not specified.
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="service-impl-bean"
+ type="javaee:service-impl-beanType"/>
+
+ <xsd:choice>
+ <xsd:element name="handler"
+ type="javaee:port-component_handlerType"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+ To be used with JAX-RPC based runtime only.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="handler-chains"
+ type="javaee:handler-chainsType"
+ minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:documentation>
+ To be used with JAX-WS based runtime only.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:choice>
+
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="port-component_handlerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Declares the handler for a port-component. Handlers can access the
+ init-param name/value pairs using the HandlerInfo interface.
+
+ Used in: port-component
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="handler-name"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Defines the name of the handler. The name must be unique within the
+ module.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="handler-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Defines a fully qualified class name for the handler implementation.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="init-param"
+ type="javaee:param-valueType"
+ minOccurs="0" maxOccurs="unbounded"/>
+
+ <xsd:element name="soap-header"
+ type="javaee:xsdQNameType"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Defines the QName of a SOAP header that will be processed by the
+ handler.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="soap-role"
+ type="javaee:string"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The soap-role element contains a SOAP actor definition that the
+ Handler will play as a role.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="protocol-URIAliasType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Defines the type that is used for specifying tokens that
+ start with ## which are used to alias existing standard
+ protocol bindings and support aliases for new standard
+ binding URIs that are introduced in future specifications.
+
+ The following tokens alias the standard protocol binding
+ URIs:
+
+ ##SOAP11_HTTP = "http://schemas.xmlsoap.org/wsdl/soap/http"
+ ##SOAP11_HTTP_MTOM =
+ "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true"
+ ##SOAP12_HTTP = "http://www.w3.org/2003/05/soap/bindings/HTTP/"
+ ##SOAP12_HTTP_MTOM =
+ "http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true"
+ ##XML_HTTP = "http://www.w3.org/2004/08/wsdl/http"
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="##.+"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="protocol-bindingListType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Defines the type used for specifying a list of
+ protocol-bindingType(s). For e.g.
+
+ ##SOAP11_HTTP ##SOAP12_HTTP ##XML_HTTP
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:list itemType="javaee:protocol-bindingType"/>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="protocol-bindingType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Defines the type used for specifying the URI for the
+ protocol binding used by the port-component. For
+ portability one could use one of the following tokens that
+ alias the standard binding types:
+
+ ##SOAP11_HTTP
+ ##SOAP11_HTTP_MTOM
+ ##SOAP12_HTTP
+ ##SOAP12_HTTP_MTOM
+ ##XML_HTTP
+
+ Other specifications could define tokens that start with ##
+ to alias new standard binding URIs that are introduced.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:union memberTypes="xsd:anyURI javaee:protocol-URIAliasType"/>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="qname-pattern">
+ <xsd:annotation>
+ <xsd:documentation>
+ This is used to specify the QName pattern in the
+ attribute service-name-pattern and port-name-pattern in
+ the handler-chain element
+
+ For example, the various forms acceptable here for
+ service-name-pattern attribute in handler-chain element
+ are :
+
+ Exact Name: service-name-pattern="ns1:EchoService"
+
+ In this case, handlers specified in this
+ handler-chain element will apply to all ports with
+ this exact service name. The namespace prefix must
+ have been declared in a namespace declaration
+ attribute in either the start-tag of the element
+ where the prefix is used or in an an ancestor
+ element (i.e. an element in whose content the
+ prefixed markup occurs)
+
+ Pattern : service-name-pattern="ns1:EchoService*"
+
+ In this case, handlers specified in this
+ handler-chain element will apply to all ports whose
+ Service names are like EchoService1, EchoServiceFoo
+ etc. The namespace prefix must have been declared in
+ a namespace declaration attribute in either the
+ start-tag of the element where the prefix is used or
+ in an an ancestor element (i.e. an element in whose
+ content the prefixed markup occurs)
+
+ Wild Card : service-name-pattern="*"
+
+ In this case, handlers specified in this handler-chain
+ element will apply to ports of all service names.
+
+ The same can be applied to port-name attribute in
+ handler-chain element.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="\*|([\i-[:]][\c-[:]]*:)?[\i-[:]][\c-[:]]*\*?"/>
+ </xsd:restriction>
+
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="service-impl-beanType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The service-impl-bean element defines the web service implementation.
+ A service implementation can be an EJB bean class or JAX-RPC web
+ component. Existing EJB implementations are exposed as a web service
+ using an ejb-link.
+
+ Used in: port-component
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:choice>
+ <xsd:element name="ejb-link"
+ type="javaee:ejb-linkType"/>
+ <xsd:element name="servlet-link"
+ type="javaee:servlet-linkType"/>
+ </xsd:choice>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="servlet-linkType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The servlet-link element is used in the service-impl-bean element
+ to specify that a Service Implementation Bean is defined as a
+ JAX-RPC Service Endpoint.
+
+ The value of the servlet-link element must be the servlet-name of
+ a JAX-RPC Service Endpoint in the same WAR file.
+
+ Used in: service-impl-bean
+
+ Example:
+ <servlet-link>StockQuoteService</servlet-link>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="webservice-descriptionType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The webservice-description element defines a WSDL document file
+ and the set of Port components associated with the WSDL ports
+ defined in the WSDL document. There may be multiple
+ webservice-descriptions defined within a module.
+
+ All WSDL file ports must have a corresponding port-component element
+ defined.
+
+ Used in: webservices
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="display-name"
+ type="javaee:display-nameType"
+ minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="icon"
+ type="javaee:iconType"
+ minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="webservice-description-name"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The webservice-description-name identifies the collection of
+ port-components associated with a WSDL file and JAX-RPC
+ mapping. The name must be unique within the deployment descriptor.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="wsdl-file"
+ type="javaee:pathType"
+ minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The wsdl-file element contains the name of a WSDL file in the
+ module. The file name is a relative path within the module.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="jaxrpc-mapping-file"
+ type="javaee:pathType"
+ minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The jaxrpc-mapping-file element contains the name of a file that
+ describes the JAX-RPC mapping between the Java interaces used by
+ the application and the WSDL description in the wsdl-file. The
+ file name is a relative path within the module.
+
+ This is not required when JAX-WS based runtime is used.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="port-component"
+ type="javaee:port-componentType"
+ minOccurs="1" maxOccurs="unbounded">
+ <xsd:key name="port-component_handler-name-key">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Defines the name of the handler. The name must be unique
+ within the module.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:handler"/>
+ <xsd:field xpath="javaee:handler-name"/>
+ </xsd:key>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="webservicesType">
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="webservice-description"
+ type="javaee:webservice-descriptionType"
+ minOccurs="1" maxOccurs="unbounded">
+ <xsd:key name="port-component-name-key">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The port-component-name element specifies a port
+ component's name. This name is assigned by the module
+ producer to name the service implementation bean in the
+ module's deployment descriptor. The name must be unique
+ among the port component names defined in the same module.
+
+ Used in: port-component
+
+ Example:
+ <port-component-name>EmployeeService
+ </port-component-name>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:port-component"/>
+ <xsd:field xpath="javaee:port-component-name"/>
+ </xsd:key>
+ </xsd:element>
+ </xsd:sequence>
+
+ <xsd:attribute name="version"
+ type="javaee:dewey-versionType"
+ fixed="1.2"
+ use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The required value for the version is 1.2.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+</xsd:schema>
+
Added: trunk/java/javax/servlet/resources/javaee_web_services_client_1_2.xsd
===================================================================
--- trunk/java/javax/servlet/resources/javaee_web_services_client_1_2.xsd (rev 0)
+++ trunk/java/javax/servlet/resources/javaee_web_services_client_1_2.xsd 2009-03-12 12:49:14 UTC (rev 955)
@@ -0,0 +1,578 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://java.sun.com/xml/ns/javaee"
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="1.2">
+ <xsd:annotation>
+ <xsd:documentation>
+ @(#)javaee_web_services_client_1_2.xsds 1.19 02/13/06
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Copyright 2003-2006 Sun Microsystems, Inc.
+ 4150 Network Circle
+ Santa Clara, California 95054
+ U.S.A
+ All rights reserved.
+
+ Sun Microsystems, Inc. has intellectual property rights
+ relating to technology described in this document. In
+ particular, and without limitation, these intellectual
+ property rights may include one or more of the U.S. patents
+ listed at http://www.sun.com/patents and one or more
+ additional patents or pending patent applications in the
+ U.S. and other countries.
+
+ This document and the technology which it describes are
+ distributed under licenses restricting their use, copying,
+ distribution, and decompilation. No part of this document
+ may be reproduced in any form by any means without prior
+ written authorization of Sun and its licensors, if any.
+
+ Third-party software, including font technology, is
+ copyrighted and licensed from Sun suppliers.
+
+ Sun, Sun Microsystems, the Sun logo, Solaris, Java, J2EE,
+ JavaServer Pages, Enterprise JavaBeans and the Java Coffee
+ Cup logo are trademarks or registered trademarks of Sun
+ Microsystems, Inc. in the U.S. and other countries.
+
+ Federal Acquisitions: Commercial Software - Government Users
+ Subject to Standard License Terms and Conditions.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ (C) Copyright International Business Machines Corporation 2002
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="port-component-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The port-component-ref element declares a client dependency
+ on the container for resolving a Service Endpoint Interface
+ to a WSDL port. It optionally associates the Service Endpoint
+ Interface with a particular port-component. This is only used
+ by the container for a Service.getPort(Class) method call.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="service-endpoint-interface"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The service-endpoint-interface element defines a fully qualified
+ Java class that represents the Service Endpoint Interface of a
+ WSDL port.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="enable-mtom"
+ type="javaee:true-falseType"
+ minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Used to enable or disable SOAP MTOM/XOP mechanism on the client
+ side for a port-component.
+
+ Not to be specified for JAX-RPC runtime
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="port-component-link"
+ type="javaee:string"
+ minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The port-component-link element links a port-component-ref
+ to a specific port-component required to be made available
+ by a service reference.
+
+ The value of a port-component-link must be the
+ port-component-name of a port-component in the same module
+ or another module in the same application unit. The syntax
+ for specification follows the syntax defined for ejb-link
+ in the EJB 2.0 specification.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:group name="service-refGroup">
+ <xsd:sequence>
+ <xsd:element name="service-ref"
+ type="javaee:service-refType"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:key name="service-ref_handler-name-key">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Defines the name of the handler. The name must be unique
+ within the module.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:handler"/>
+ <xsd:field xpath="javaee:handler-name"/>
+ </xsd:key>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:group>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="service-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The service-ref element declares a reference to a Web
+ service. It contains optional description, display name and
+ icons, a declaration of the required Service interface,
+ an optional WSDL document location, an optional set
+ of JAX-RPC mappings, an optional QName for the service element,
+ an optional set of Service Endpoint Interfaces to be resolved
+ by the container to a WSDL port, and an optional set of handlers.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="service-ref-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The service-ref-name element declares logical name that the
+ components in the module use to look up the Web service. It
+ is recommended that all service reference names start with
+ "service/".
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="service-interface"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The service-interface element declares the fully qualified class
+ name of the JAX-RPC Service interface the client depends on.
+ In most cases the value will be javax.xml.rpc.Service. A JAX-RPC
+ generated Service Interface class may also be specified.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="service-ref-type"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The service-ref-type element declares the type of the service-ref
+ element that is injected or returned when a JNDI lookup is done.
+ This must be either a fully qualified name of Service class or
+ the fully qualified name of service endpoint interface class.
+ This is only used with JAX-WS runtime where the corresponding
+ @WebServiceRef annotation can be used to denote both a Service
+ or a Port.
+
+ If this is not specified, then the type of service-ref element
+ that is injected or returned when a JNDI lookup is done is
+ always a Service interface/class.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="wsdl-file"
+ type="javaee:xsdAnyURIType"
+ minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The wsdl-file element contains the URI location of a WSDL
+ file. The location is relative to the root of the module.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="jaxrpc-mapping-file"
+ type="javaee:pathType"
+ minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The jaxrpc-mapping-file element contains the name of a file that
+ describes the JAX-RPC mapping between the Java interaces used by
+ the application and the WSDL description in the wsdl-file. The
+ file name is a relative path within the module file.
+
+ This is not required when JAX-WS based runtime is used.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="service-qname"
+ type="javaee:xsdQNameType"
+ minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The service-qname element declares the specific WSDL service
+ element that is being refered to. It is not specified if no
+ wsdl-file is declared.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="port-component-ref"
+ type="javaee:port-component-refType"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The port-component-ref element declares a client dependency
+ on the container for resolving a Service Endpoint Interface
+ to a WSDL port. It optionally associates the Service Endpoint
+ Interface with a particular port-component. This is only used
+ by the container for a Service.getPort(Class) method call.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:choice>
+ <xsd:element name="handler"
+ type="javaee:service-ref_handlerType"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Declares the handler for a port-component. Handlers can
+ access the init-param name/value pairs using the
+ HandlerInfo interface. If port-name is not specified, the
+ handler is assumed to be associated with all ports of the
+ service.
+
+ To be used with JAX-RPC based runtime only.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="handler-chains"
+ type="javaee:service-ref_handler-chainsType"
+ minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:documentation>
+ To be used with JAX-WS based runtime only.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:choice>
+
+ <xsd:group ref="javaee:resourceGroup"/>
+
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="service-ref_handler-chainType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The handler-chain element defines the handlerchain.
+ Handlerchain can be defined such that the handlers in the
+ handlerchain operate,all ports of a service, on a specific
+ port or on a list of protocol-bindings. The choice of elements
+ service-name-pattern, port-name-pattern and protocol-bindings
+ are used to specify whether the handlers in handler-chain are
+ for a service, port or protocol binding. If none of these
+ choices are specified with the handler-chain element then the
+ handlers specified in the handler-chain will be applied on
+ everything.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+
+ <xsd:choice minOccurs="0" maxOccurs="1">
+ <xsd:element name="service-name-pattern"
+ type="javaee:service-ref_qname-pattern" />
+ <xsd:element name="port-name-pattern"
+ type="javaee:service-ref_qname-pattern" />
+ <xsd:element name="protocol-bindings"
+ type="javaee:service-ref_protocol-bindingListType"/>
+ </xsd:choice>
+
+ <xsd:element name="handler"
+ type="javaee:service-ref_handlerType"
+ minOccurs="1" maxOccurs="unbounded"/>
+ </xsd:sequence>
+
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="service-ref_handler-chainsType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The handler-chains element defines the handlerchains associated with this
+ service or service endpoint.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="handler-chain"
+ type="javaee:service-ref_handler-chainType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="service-ref_handlerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Declares the handler for a port-component. Handlers can access the
+ init-param name/value pairs using the HandlerInfo interface. If
+ port-name is not specified, the handler is assumed to be associated
+ with all ports of the service.
+
+ Used in: service-ref
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="handler-name"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Defines the name of the handler. The name must be unique
+ within the module.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="handler-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Defines a fully qualified class name for the handler
+ implementation.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="init-param"
+ type="javaee:param-valueType"
+ minOccurs="0" maxOccurs="unbounded"/>
+
+ <xsd:element name="soap-header"
+ type="javaee:xsdQNameType"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Defines the QName of a SOAP header that will be processed
+ by the handler.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="soap-role"
+ type="javaee:string"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The soap-role element contains a SOAP actor definition that
+ the Handler will play as a role.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="port-name"
+ type="javaee:string"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The port-name element defines the WSDL port-name that a
+ handler should be associated with.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="service-ref_protocol-URIAliasType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Defines the type that is used for specifying tokens that
+ start with ## which are used to alias existing standard
+ protocol bindings and support aliases for new standard
+ binding URIs that are introduced in future specifications.
+
+ The following tokens alias the standard protocol binding
+ URIs:
+
+ ##SOAP11_HTTP = "http://schemas.xmlsoap.org/wsdl/soap/http"
+ ##SOAP11_HTTP_MTOM =
+ "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true"
+ ##SOAP12_HTTP = "http://www.w3.org/2003/05/soap/bindings/HTTP/"
+ ##SOAP12_HTTP_MTOM =
+ "http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true"
+ ##XML_HTTP = "http://www.w3.org/2004/08/wsdl/http"
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="##.+"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="service-ref_protocol-bindingListType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Defines the type used for specifying a list of
+ protocol-bindingType(s). For e.g.
+
+ ##SOAP11_HTTP ##SOAP12_HTTP ##XML_HTTP
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:list itemType="javaee:service-ref_protocol-bindingType"/>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="service-ref_protocol-bindingType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Defines the type used for specifying the URI for the
+ protocol binding used by the port-component. For
+ portability one could use one of the following tokens that
+ alias the standard binding types:
+
+ ##SOAP11_HTTP
+ ##SOAP11_HTTP_MTOM
+ ##SOAP12_HTTP
+ ##SOAP12_HTTP_MTOM
+ ##XML_HTTP
+
+ Other specifications could define tokens that start with ##
+ to alias new standard binding URIs that are introduced.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:union memberTypes="xsd:anyURI javaee:service-ref_protocol-URIAliasType"/>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="service-ref_qname-pattern">
+ <xsd:annotation>
+ <xsd:documentation>
+ This is used to specify the QName pattern in the
+ attribute service-name-pattern and port-name-pattern in
+ the handler-chain element
+
+ For example, the various forms acceptable here for
+ service-name-pattern attribute in handler-chain element
+ are :
+
+ Exact Name: service-name-pattern="ns1:EchoService"
+
+ In this case, handlers specified in this
+ handler-chain element will apply to all ports with
+ this exact service name. The namespace prefix must
+ have been declared in a namespace declaration
+ attribute in either the start-tag of the element
+ where the prefix is used or in an an ancestor
+ element (i.e. an element in whose content the
+ prefixed markup occurs)
+
+ Pattern : service-name-pattern="ns1:EchoService*"
+
+ In this case, handlers specified in this
+ handler-chain element will apply to all ports whose
+ Service names are like EchoService1, EchoServiceFoo
+ etc. The namespace prefix must have been declared in
+ a namespace declaration attribute in either the
+ start-tag of the element where the prefix is used or
+ in an an ancestor element (i.e. an element in whose
+ content the prefixed markup occurs)
+
+ Wild Card : service-name-pattern="*"
+
+ In this case, handlers specified in this handler-chain
+ element will apply to ports of all service names.
+
+ The same can be applied to port-name attribute in
+ handler-chain element.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="\*|([\i-[:]][\c-[:]]*:)?[\i-[:]][\c-[:]]*\*?"/>
+ </xsd:restriction>
+
+ </xsd:simpleType>
+
+</xsd:schema>
+
Modified: trunk/java/org/apache/catalina/startup/DigesterFactory.java
===================================================================
--- trunk/java/org/apache/catalina/startup/DigesterFactory.java 2009-03-12 00:48:22 UTC (rev 954)
+++ trunk/java/org/apache/catalina/startup/DigesterFactory.java 2009-03-12 12:49:14 UTC (rev 955)
@@ -94,11 +94,9 @@
Constants.J2eeSchemaPublicId_14,
schemaResolver);
- /* FIXME: Add javaee_5.xsd
register(Constants.JavaeeSchemaResourcePath_5,
Constants.JavaeeSchemaPublicId_5,
schemaResolver);
- */
// W3C
register(Constants.W3cSchemaResourcePath_10,
@@ -165,7 +163,6 @@
Constants.J2eeWebServiceClientSchemaPublicId_11,
schemaResolver);
- /* FIXME
register(Constants.JavaeeWebServiceSchemaResourcePath_12,
Constants.JavaeeWebServiceSchemaPublicId_12,
schemaResolver);
@@ -173,7 +170,6 @@
register(Constants.JavaeeWebServiceClientSchemaResourcePath_12,
Constants.JavaeeWebServiceClientSchemaPublicId_12,
schemaResolver);
- */
}
16 years