JBossWeb SVN: r1171 - in branches/2.1.x: java/org/apache/coyote/http11 and 2 other directories.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-09-18 12:41:08 -0400 (Fri, 18 Sep 2009)
New Revision: 1171
Modified:
branches/2.1.x/java/org/apache/catalina/core/AprLifecycleListener.java
branches/2.1.x/java/org/apache/coyote/http11/Http11AprProcessor.java
branches/2.1.x/java/org/apache/tomcat/jni/SSLSocket.java
branches/2.1.x/webapps/docs/changelog.xml
Log:
Patch for ASF bugzilla 46950.
Modified: branches/2.1.x/java/org/apache/catalina/core/AprLifecycleListener.java
===================================================================
--- branches/2.1.x/java/org/apache/catalina/core/AprLifecycleListener.java 2009-09-17 09:03:16 UTC (rev 1170)
+++ branches/2.1.x/java/org/apache/catalina/core/AprLifecycleListener.java 2009-09-18 16:41:08 UTC (rev 1171)
@@ -58,8 +58,8 @@
protected static final int TCN_REQUIRED_MAJOR = 1;
protected static final int TCN_REQUIRED_MINOR = 1;
- protected static final int TCN_REQUIRED_PATCH = 8;
- protected static final int TCN_RECOMMENDED_PV = 12;
+ protected static final int TCN_REQUIRED_PATCH = 17;
+ protected static final int TCN_RECOMMENDED_PV = 17;
// ---------------------------------------------- Properties
Modified: branches/2.1.x/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- branches/2.1.x/java/org/apache/coyote/http11/Http11AprProcessor.java 2009-09-17 09:03:16 UTC (rev 1170)
+++ branches/2.1.x/java/org/apache/coyote/http11/Http11AprProcessor.java 2009-09-18 16:41:08 UTC (rev 1171)
@@ -1179,10 +1179,11 @@
request.setAttribute(AprEndpoint.CIPHER_SUITE_KEY, sslO);
}
// Get client certificate and the certificate chain if present
+ // certLength == -1 indicates an error
int certLength = SSLSocket.getInfoI(socket, SSL.SSL_INFO_CLIENT_CERT_CHAIN);
byte[] clientCert = SSLSocket.getInfoB(socket, SSL.SSL_INFO_CLIENT_CERT);
X509Certificate[] certs = null;
- if (clientCert != null) {
+ if (clientCert != null && certLength > -1) {
certs = new X509Certificate[certLength + 1];
CertificateFactory cf = CertificateFactory.getInstance("X.509");
certs[0] = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(clientCert));
@@ -1218,24 +1219,30 @@
inputBuffer.addActiveFilter(inputFilters[Constants.BUFFERED_FILTER]);
}
try {
+ // Configure connection to require a certificate
+ SSLSocket.setVerify(socket, SSL.SSL_CVERIFY_REQUIRE,
+ endpoint.getSSLVerifyDepth());
// Renegociate certificates
- SSLSocket.renegotiate(socket);
- // Get client certificate and the certificate chain if present
- int certLength = SSLSocket.getInfoI(socket, SSL.SSL_INFO_CLIENT_CERT_CHAIN);
- byte[] clientCert = SSLSocket.getInfoB(socket, SSL.SSL_INFO_CLIENT_CERT);
- X509Certificate[] certs = null;
- if (clientCert != null) {
- certs = new X509Certificate[certLength + 1];
- CertificateFactory cf = CertificateFactory.getInstance("X.509");
- certs[0] = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(clientCert));
- for (int i = 0; i < certLength; i++) {
- byte[] data = SSLSocket.getInfoB(socket, SSL.SSL_INFO_CLIENT_CERT_CHAIN + i);
- certs[i+1] = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(data));
+ if (SSLSocket.renegotiate(socket) == 0) {
+ // Don't look for certs unless we know renegotiation worked.
+ // Get client certificate and the certificate chain if present
+ // certLength == -1 indicates an error
+ int certLength = SSLSocket.getInfoI(socket, SSL.SSL_INFO_CLIENT_CERT_CHAIN);
+ byte[] clientCert = SSLSocket.getInfoB(socket, SSL.SSL_INFO_CLIENT_CERT);
+ X509Certificate[] certs = null;
+ if (clientCert != null && certLength > -1) {
+ certs = new X509Certificate[certLength + 1];
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+ certs[0] = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(clientCert));
+ for (int i = 0; i < certLength; i++) {
+ byte[] data = SSLSocket.getInfoB(socket, SSL.SSL_INFO_CLIENT_CERT_CHAIN + i);
+ certs[i+1] = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(data));
+ }
}
- }
- if (certs != null) {
- request.setAttribute(AprEndpoint.CERTIFICATE_KEY, certs);
- }
+ if (certs != null) {
+ request.setAttribute(AprEndpoint.CERTIFICATE_KEY, certs);
+ }
+ }
} catch (Exception e) {
log.warn(sm.getString("http11processor.socket.ssl"), e);
}
Modified: branches/2.1.x/java/org/apache/tomcat/jni/SSLSocket.java
===================================================================
--- branches/2.1.x/java/org/apache/tomcat/jni/SSLSocket.java 2009-09-17 09:03:16 UTC (rev 1170)
+++ branches/2.1.x/java/org/apache/tomcat/jni/SSLSocket.java 2009-09-18 16:41:08 UTC (rev 1171)
@@ -48,7 +48,7 @@
* response is sent. In more detail: the renegotiation happens after the
* request line and MIME headers were read, but _before_ the attached
* request body is read. The reason simply is that in the HTTP protocol
- * usually there is no acknowledgment step between the headers and the
+ * usually there is no acknowledgement step between the headers and the
* body (there is the 100-continue feature and the chunking facility
* only), so Apache has no API hook for this step.
*
@@ -57,7 +57,30 @@
public static native int renegotiate(long thesocket);
/**
- * Retrun SSL Info parameter as byte array.
+ * Set Type of Client Certificate verification and Maximum depth of CA
+ * Certificates in Client Certificate verification.
+ * <br />
+ * This is used to change the verification level for a connection prior to
+ * starting a re-negotiation.
+ * <br />
+ * The following levels are available for level:
+ * <PRE>
+ * SSL_CVERIFY_NONE - No client Certificate is required at all
+ * SSL_CVERIFY_OPTIONAL - The client may present a valid Certificate
+ * SSL_CVERIFY_REQUIRE - The client has to present a valid
+ * Certificate
+ * SSL_CVERIFY_OPTIONAL_NO_CA - The client may present a valid Certificate
+ * but it need not to be (successfully)
+ * verifiable
+ * </PRE>
+ * <br />
+ * @param sock The socket to change.
+ * @param level Type of Client Certificate verification.
+ */
+ public static native void setVerify(long sock, int level, int depth);
+
+ /**
+ * Return SSL Info parameter as byte array.
*
* @param sock The socket to read the data from.
* @param id Parameter id.
@@ -67,7 +90,7 @@
throws Exception;
/**
- * Retrun SSL Info parameter as String.
+ * Return SSL Info parameter as String.
*
* @param sock The socket to read the data from.
* @param id Parameter id.
@@ -77,7 +100,7 @@
throws Exception;
/**
- * Retrun SSL Info parameter as integer.
+ * Return SSL Info parameter as integer.
*
* @param sock The socket to read the data from.
* @param id Parameter id.
Modified: branches/2.1.x/webapps/docs/changelog.xml
===================================================================
--- branches/2.1.x/webapps/docs/changelog.xml 2009-09-17 09:03:16 UTC (rev 1170)
+++ branches/2.1.x/webapps/docs/changelog.xml 2009-09-18 16:41:08 UTC (rev 1171)
@@ -16,6 +16,16 @@
<body>
+<section name="JBoss Web 2.1.5.GA (remm)">
+ <subsection name="Coyote">
+ <changelog>
+ <fix>
+ <bug>46950</bug>: Allow renegotiation to work for client certificates. (markt)
+ </fix>
+ </changelog>
+ </subsection>
+</section>
+
<section name="JBoss Web 2.1.4.GA (remm)">
<subsection name="General">
<changelog>
14 years, 9 months
JBossWeb SVN: r1170 - in trunk: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-09-17 05:03:16 -0400 (Thu, 17 Sep 2009)
New Revision: 1170
Modified:
trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java
trunk/webapps/docs/changelog.xml
Log:
- Port patch: small mapper fix.
Modified: trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java 2009-09-15 16:41:32 UTC (rev 1169)
+++ trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java 2009-09-17 09:03:16 UTC (rev 1170)
@@ -730,7 +730,7 @@
if(mappingData.wrapper == null && noServletPath) {
// The path is empty, redirect to "/"
mappingData.redirectPath.setChars
- (path.getBuffer(), pathOffset, pathEnd);
+ (path.getBuffer(), pathOffset, pathEnd - pathOffset);
path.setEnd(pathEnd - 1);
return;
}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-09-15 16:41:32 UTC (rev 1169)
+++ trunk/webapps/docs/changelog.xml 2009-09-17 09:03:16 UTC (rev 1170)
@@ -152,6 +152,9 @@
<fix>
Add flag to set Expires for cookie expiration on IE. (markt)
</fix>
+ <fix>
+ <bug>47225</bug>: Fix bad length when redirecting in the mapper. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
14 years, 9 months
JBossWeb SVN: r1169 - in trunk/java: org/apache/catalina/connector and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-09-15 12:41:32 -0400 (Tue, 15 Sep 2009)
New Revision: 1169
Modified:
trunk/java/javax/servlet/AsyncContext.java
trunk/java/javax/servlet/AsyncEvent.java
trunk/java/javax/servlet/AsyncListener.java
trunk/java/javax/servlet/ServletRequest.java
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/core/StandardWrapperValve.java
Log:
- Update to latest spec.
Modified: trunk/java/javax/servlet/AsyncContext.java
===================================================================
--- trunk/java/javax/servlet/AsyncContext.java 2009-09-10 16:34:29 UTC (rev 1168)
+++ trunk/java/javax/servlet/AsyncContext.java 2009-09-15 16:41:32 UTC (rev 1169)
@@ -38,7 +38,7 @@
/**
* Class representing the execution context for an asynchronous operation
- * that was started on a ServletRequest.
+ * that was initiated on a ServletRequest.
*
* <p>An AsyncContext is created and initialized by a call to
* {@link ServletRequest#startAsync()} or
@@ -46,6 +46,20 @@
* Repeated invocations of these methods will return the same AsyncContext
* instance, reinitialized as appropriate.
*
+ * <p>In the event that an asynchronous operation has timed out, the
+ * container must run through these steps:
+ * <ol>
+ * <li>Invoke, at their {@link AsyncListener#onTimeout onTimeout} method, all
+ * {@link AsyncListener} instances registered with the ServletRequest
+ * on which the asynchronous operation was initiated.</li>
+ * <li>If none of the listeners called {@link #complete} or any of the
+ * {@link #dispatch} methods, perform an error dispatch with a status code
+ * equal to <tt>HttpServletResponse.SC_INTERNAL_SERVER_ERROR</tt>.</li>
+ * <li>If no matching error page was found, or the error page did not call
+ * {@link #complete} or any of the {@link #dispatch} methods, call
+ * {@link #complete}.</li>
+ * </ol>
+ *
* @since Servlet 3.0
*/
public interface AsyncContext {
@@ -181,6 +195,24 @@
* {@link ServletRequest#startAsync(ServletRequest, ServletResponse)}
* are called.
*
+ * <p>Any errors or exceptions that may occur during the execution
+ * of this method must be caught and handled by the container, as
+ * follows:
+ * <ol>
+ * <li>Invoke, at their {@link AsyncListener#onError onError} method, all
+ * {@link AsyncListener} instances registered with the ServletRequest
+ * for which this AsyncContext was created, and make the caught
+ * <tt>Throwable</tt> available via {@link AsyncEvent#getThrowable}.</li>
+ * <li>If none of the listeners called {@link #complete} or any of the
+ * {@link #dispatch} methods, perform an error dispatch with a status code
+ * equal to <tt>HttpServletResponse.SC_INTERNAL_SERVER_ERROR</tt>, and
+ * make the above <tt>Throwable</tt> available as the value of the
+ * <tt>RequestDispatcher.ERROR_EXCEPTION</tt> request attribute.</li>
+ * <li>If no matching error page was found, or the error page did not call
+ * {@link #complete} or any of the {@link #dispatch} methods, call
+ * {@link #complete}.</li>
+ * </ol>
+ *
* @exception IllegalStateException if {@link #complete} has already
* been called
*
@@ -207,7 +239,8 @@
* attributes will always reflect the original path elements, even under
* repeated dispatches.
*
- * <p>See {@link #dispatch()} for additional details.
+ * <p>See {@link #dispatch()} for additional details, including error
+ * handling.
*
* @param path the path of the dispatch target, scoped to the
* ServletContext from which this AsyncContext was initialized
@@ -237,7 +270,8 @@
* attributes will always reflect the original path elements, even under
* repeated dispatches.
*
- * <p>See {@link #dispatch()} for additional details.
+ * <p>See {@link #dispatch()} for additional details, including error
+ * handling.
*
* @param context the ServletContext of the dispatch target
* @param path the path of the dispatch target, scoped to the given
@@ -256,9 +290,10 @@
* that was used to initialze this AsyncContext, closing the response
* that was used to initialize this AsyncContext.
*
- * <p>Any listeners of type {@link AsyncListener} that were added to the
- * request that was used to initialize this AsyncContext will have their
- * {@link AsyncListener#onComplete(AsyncEvent)} method invoked.
+ * <p>Any listeners of type {@link AsyncListener} that were registered
+ * with the ServletRequest for which this AsyncContext was created will
+ * be invoked at their {@link AsyncListener#onComplete(AsyncEvent)
+ * onComplete} method.
*
* <p>It is legal to call this method any time after a call to
* {@link ServletRequest#startAsync()} or
Modified: trunk/java/javax/servlet/AsyncEvent.java
===================================================================
--- trunk/java/javax/servlet/AsyncEvent.java 2009-09-10 16:34:29 UTC (rev 1168)
+++ trunk/java/javax/servlet/AsyncEvent.java 2009-09-15 16:41:32 UTC (rev 1169)
@@ -38,47 +38,126 @@
package javax.servlet;
/**
- * Event that gets fired when a ServletRequest on which asynchronous
- * processing was started has finished processing through a call to
- * {@link AsyncContext#complete} or has timed out.
+ * Event that gets fired when the asynchronous operation initiated on a
+ * ServletRequest (via a call to {@link ServletRequest#startAsync} or
+ * {@link ServletRequest#startAsync(ServletRequest, ServletResponse)})
+ * has completed, timed out, or produced an error.
*
* @since Servlet 3.0
*/
public class AsyncEvent {
+ private AsyncContext context;
private ServletRequest request;
private ServletResponse response;
+ private Throwable throwable;
+
/**
- * Constructs an AsyncEvent from the given request and response objects.
+ * Constructs an AsyncEvent from the given AsyncContext.
*
- * @param request the ServletRequest
- * @param response the ServletResponse
+ * @param context the AsyncContex to be delivered with this AsyncEvent
*/
- public AsyncEvent(ServletRequest request, ServletResponse response) {
+ public AsyncEvent(AsyncContext context) {
+ this(context, null, null, null);
+ }
+
+ /**
+ * Constructs an AsyncEvent from the given AsyncContext, ServletRequest,
+ * and ServletResponse.
+ *
+ * @param context the AsyncContex to be delivered with this AsyncEvent
+ * @param request the ServletRequest to be delivered with this AsyncEvent
+ * @param response the ServletResponse to be delivered with this
+ * AsyncEvent
+ */
+ public AsyncEvent(AsyncContext context, ServletRequest request,
+ ServletResponse response) {
+ this(context, request, response, null);
+ }
+
+ /**
+ * Constructs an AsyncEvent from the given AsyncContext and Throwable.
+ *
+ * @param context the AsyncContex to be delivered with this AsyncEvent
+ * @param throwable the Throwable to be delivered with this AsyncEvent
+ */
+ public AsyncEvent(AsyncContext context, Throwable throwable) {
+ this(context, null, null, throwable);
+ }
+
+ /**
+ * Constructs an AsyncEvent from the given AsyncContext, ServletRequest,
+ * ServletResponse, and Throwable.
+ *
+ * @param context the AsyncContex to be delivered with this AsyncEvent
+ * @param request the ServletRequest to be delivered with this AsyncEvent
+ * @param response the ServletResponse to be delivered with this
+ * AsyncEvent
+ * @param throwable the Throwable to be delivered with this AsyncEvent
+ */
+ public AsyncEvent(AsyncContext context, ServletRequest request,
+ ServletResponse response, Throwable throwable) {
+ this.context = context;
this.request = request;
this.response = response;
+ this.throwable = throwable;
}
+ /**
+ * Gets the AsyncContext from this AsyncEvent.
+ *
+ * @return the AsyncContext that was used to initialize this AsyncEvent
+ */
+ public AsyncContext getAsyncContext() {
+ return context;
+ }
/**
- * Gets the ServletRequest from this event
+ * Gets the ServletRequest from this AsyncEvent.
*
- * @return the ServletRequest
+ * <p>If the AsyncListener to which this AsyncEvent is being delivered
+ * was added using {@link ServletRequest#addAsyncListener(AsyncListener,
+ * ServletRequest, ServletResponse)}, the returned ServletRequest
+ * will be the same as the one supplied to the above method.
+ * If the AsyncListener was added via
+ * {@link ServletRequest#addAsyncListener(AsyncListener)}, this method
+ * must return null.
+ *
+ * @return the ServletRequest that was used to initialize this AsyncEvent,
+ * or null if this AsyncEvent was initialized without any ServletRequest
*/
- public ServletRequest getRequest() {
+ public ServletRequest getSuppliedRequest() {
return request;
}
-
/**
- * Gets the ServletResponse from this event
+ * Gets the ServletResponse from this AsyncEvent.
*
- * @return the ServletResponse
+ * <p>If the AsyncListener to which this AsyncEvent is being delivered
+ * was added using {@link ServletRequest#addAsyncListener(AsyncListener,
+ * ServletRequest, ServletResponse)}, the returned ServletResponse
+ * will be the same as the one supplied to the above method.
+ * If the AsyncListener was added via
+ * {@link ServletRequest#addAsyncListener(AsyncListener)}, this method
+ * must return null.
+ *
+ * @return the ServletResponse that was used to initialize this AsyncEvent,
+ * or null if this AsyncEvent was initialized without any ServletResponse
*/
- public ServletResponse getResponse() {
+ public ServletResponse getSuppliedResponse() {
return response;
}
+ /**
+ * Gets the Throwable from this AsyncEvent.
+ *
+ * @return the Throwable that was used to initialize this AsyncEvent,
+ * or null if this AsyncEvent was initialized without any Throwable
+ */
+ public Throwable getThrowable() {
+ return throwable;
+ }
+
}
Modified: trunk/java/javax/servlet/AsyncListener.java
===================================================================
--- trunk/java/javax/servlet/AsyncListener.java 2009-09-10 16:34:29 UTC (rev 1168)
+++ trunk/java/javax/servlet/AsyncListener.java 2009-09-15 16:41:32 UTC (rev 1169)
@@ -40,10 +40,9 @@
import java.util.EventListener;
/**
- * Listener that will be notified when an asynchronous operation that was
- * started on a ServletRequest by a call to {@link ServletRequest#startAsync}
- * or {@link ServletRequest#startAsync(ServletRequest, ServletResponse)}
- * completes or times out.
+ * Listener that will be notified in the event that an asynchronous
+ * operation initiated on a ServletRequest to which the listener had been
+ * added has completed, timed out, or resulted in an error.
*
* @since Servlet 3.0
*/
@@ -51,35 +50,79 @@
/**
* Notifies this AsyncListener that an asynchronous operation
- * started on the ServletRequest with which this AsyncListener was
- * registered has been completed.
+ * has been completed.
*
- * @param event the AsyncEvent containing the request and response
- * objects that were used when this AsyncListener was registered via a
- * call to {@link ServletRequest#addAsyncListener(AsyncListener)}
- * or {@link ServletRequest#addAsyncListener(AsyncListener,
- * ServletRequest, ServletResponse)}
+ * <p>The {@link AsyncContext} corresponding to the asynchronous
+ * operation that has been completed may be obtained by calling
+ * {@link AsyncEvent#getAsyncContext getAsyncContext} on the given
+ * <tt>event</tt>.
*
- * @throws IOException if an I/O exception occurred during the processing
- * of the given AsyncEvent
+ * <p>In addition, if this AsyncListener had been registered via a call
+ * to {@link ServletRequest#addAsyncListener(AsyncListener,
+ * ServletRequest, ServletResponse)}, the supplied ServletRequest and
+ * ServletResponse objects may be retrieved by calling
+ * {@link AsyncEvent#getSuppliedRequest getSuppliedRequest} and
+ * {@link AsyncEvent#getSuppliedResponse getSuppliedResponse},
+ * respectively, on the given <tt>event</tt>.
+ *
+ * @param event the AsyncEvent indicating that an asynchronous
+ * operation has been completed
+ *
+ * @throws IOException if an I/O related error has occurred during the
+ * processing of the given AsyncEvent
*/
public void onComplete(AsyncEvent event) throws IOException;
/**
* Notifies this AsyncListener that an asynchronous operation
- * started on the ServletRequest with which this AsyncListener was
- * registered has timed out.
+ * has timed out.
*
- * @param event the AsyncEvent containing the request and response
- * objects that were used when this AsyncListener was registered via a
- * call to {@link ServletRequest#addAsyncListener(AsyncListener)}
- * or {@link ServletRequest#addAsyncListener(AsyncListener,
- * ServletRequest, ServletResponse)}
+ * <p>The {@link AsyncContext} corresponding to the asynchronous
+ * operation that has timed out may be obtained by calling
+ * {@link AsyncEvent#getAsyncContext getAsyncContext} on the given
+ * <tt>event</tt>.
*
- * @throws IOException if an I/O exception occurred during the processing
- * of the given AsyncEvent
+ * <p>In addition, if this AsyncListener had been registered via a call
+ * to {@link ServletRequest#addAsyncListener(AsyncListener,
+ * ServletRequest, ServletResponse)}, the supplied ServletRequest and
+ * ServletResponse objects may be retrieved by calling
+ * {@link AsyncEvent#getSuppliedRequest getSuppliedRequest} and
+ * {@link AsyncEvent#getSuppliedResponse getSuppliedResponse},
+ * respectively, on the given <tt>event</tt>.
+ *
+ * @param event the AsyncEvent indicating that an asynchronous
+ * operation has timed out
+ *
+ * @throws IOException if an I/O related error has occurred during the
+ * processing of the given AsyncEvent
*/
public void onTimeout(AsyncEvent event) throws IOException;
+
+ /**
+ * Notifies this AsyncListener that an asynchronous operation
+ * has failed to complete.
+ *
+ * <p>The {@link AsyncContext} corresponding to the asynchronous
+ * operation that failed to complete may be obtained by calling
+ * {@link AsyncEvent#getAsyncContext getAsyncContext} on the given
+ * <tt>event</tt>.
+ *
+ * <p>In addition, if this AsyncListener had been registered via a call
+ * to {@link ServletRequest#addAsyncListener(AsyncListener,
+ * ServletRequest, ServletResponse)}, the supplied ServletRequest and
+ * ServletResponse objects may be retrieved by calling
+ * {@link AsyncEvent#getSuppliedRequest getSuppliedRequest} and
+ * {@link AsyncEvent#getSuppliedResponse getSuppliedResponse},
+ * respectively, on the given <tt>event</tt>.
+ *
+ * @param event the AsyncEvent indicating that an asynchronous
+ * operation has failed to complete
+ *
+ * @throws IOException if an I/O related error has occurred during the
+ * processing of the given AsyncEvent
+ */
+ public void onError(AsyncEvent event) throws IOException;
+
}
Modified: trunk/java/javax/servlet/ServletRequest.java
===================================================================
--- trunk/java/javax/servlet/ServletRequest.java 2009-09-10 16:34:29 UTC (rev 1168)
+++ trunk/java/javax/servlet/ServletRequest.java 2009-09-15 16:41:32 UTC (rev 1169)
@@ -608,19 +608,17 @@
* and ServletResponse objects and the timeout as returned by
* {@link #getAsyncTimeout}.
*
- * <p>This will delay committal of the associated response until
- * {@link AsyncContext#complete} is called on the returned
- * {@link AsyncContext}, or the AsyncContext times out.
+ * <p>Calling this method will cause committal of the associated
+ * response to be delayed until {@link AsyncContext#complete} is
+ * called on the returned {@link AsyncContext}, or the asynchronous
+ * operation has timed out.
*
- * <p>The timer for async timeouts will not start until the
+ * <p>The timer for asynchronous timeouts will not start until the
* container-initiated dispatch that called <tt>startAsync</tt>
* has returned to the container.
*
- * <p>If a timeout occurs and none of the
- * {@link AsyncListener#onTimeout(AsyncEvent)} handlers call
- * {@link AsyncContext#complete} or one of the
- * {@link AsyncContext#dispatch} methods, the container must call
- * {@link AsyncContext#complete}.
+ * <p>See {@link AsyncContext} for a description of how timeouts of
+ * asynchronous operations are handled by the container.
*
* <p>Calling {@link AsyncContext#hasOriginalRequestAndResponse()} on
* the returned AsyncContext will return <code>true</code>. Any filters
@@ -654,25 +652,24 @@
* {@link AsyncContext} with the given request and response objects
* and the timeout as returned by {@link #getAsyncTimeout}.
*
- * <p>The ServletRequest and ServletResponse parameters must be either
- * the same objects as were passed to the calling servlet's service
- * (or calling filter's doFilter) method, or be subclasses of the
- * {@link ServletRequestWrapper} or {@link ServletResponseWrapper}
- * classes that wrap them.
+ * <p>The ServletRequest and ServletResponse arguments must be
+ * the same instances, or instances of {@link ServletRequestWrapper} and
+ * {@link ServletResponseWrapper} that wrap them, that were passed to the
+ * {@link Servlet#service service} method of the Servlet or the
+ * {@link Filter#doFilter doFilter} method of the Filter, respectively,
+ * in whose scope this method is being called.
*
- * <p>This will delay committal of the response until
- * {@link AsyncContext#complete} is called on the returned
- * {@link AsyncContext}, or the AsyncContext times out.
+ * <p>Calling this method will cause committal of the associated
+ * response to be delayed until {@link AsyncContext#complete} is
+ * called on the returned {@link AsyncContext}, or the asynchronous
+ * operation has timed out.
*
- * <p>The timer for async timeouts will not start until the
+ * <p>The timer for asynchronous timeouts will not start until the
* container-initiated dispatch that called <tt>startAsync</tt>
* has returned to the container.
*
- * <p>If a timeout occurs and none of the
- * {@link AsyncListener#onTimeout(AsyncEvent)} handlers call
- * {@link AsyncContext#complete} or one of the
- * {@link AsyncContext#dispatch} methods, the container must call
- * {@link AsyncContext#complete}.
+ * <p>See {@link AsyncContext} for a description of how timeouts of
+ * asynchronous operations are handled by the container.
*
* <p>Calling {@link AsyncContext#hasOriginalRequestAndResponse()} on
* the returned AsyncContext will return <code>false</code>,
@@ -776,16 +773,11 @@
/**
- * Registers the given {@link AsyncListener} with this request for
- * asynchronous complete and timeout events.
+ * Registers the given {@link AsyncListener} with this request.
*
- * <p>If {@link #startAsync} or
- * {@link #startAsync(ServletRequest,ServletResponse)} is called on this
- * request, an {@link AsyncEvent} will be sent to this AsyncListener as
- * soon as the asynchronous operation has completed or timed out.
- * The AsyncEvent will contain the ServletRequest and ServletResponse
- * objects that were used to initialize the {@link AsyncContext}
- * returned by the call to startAsync.
+ * <p>If this request is put into asynchronous mode, the given
+ * AsyncListener will receive an {@link AsyncEvent} when the
+ * asynchronous operation completes, times out, or fails to complete.
*
* <p>AsyncListener instances will be notified in the order
* in which they were added to this request.
@@ -799,26 +791,24 @@
/**
* Registers the given {@link AsyncListener} with this request for
- * asynchronous complete and timeout events.
+ * asynchronous complete, timeout, and error events.
*
- * <p>If {@link #startAsync} or
- * {@link #startAsync(ServletRequest,ServletResponse)} is called on this
- * request, an {@link AsyncEvent} will be sent to this AsyncListener as
- * soon as the asynchronous operation has completed or timed out.
- * The AsyncEvent will contain the given ServletRequest and
- * ServletResponse objects.
+ * <p>If this request is put into asynchronous mode, the given
+ * AsyncListener will receive an {@link AsyncEvent} when the
+ * asynchronous operation completes, times out, or fails to complete.
*
* <p>AsyncListener instances will be notified in the order
* in which they were added to this request.
*
- * <p>The specified request and response objects, which will be included
- * in the AsyncEvent that will be delivered to the given AsyncListener,
- * should not be read from or written to, respectively, at the time
- * when the AsyncEvent is delivered, because additional wrapping may have
- * occurred after this method was called. One of the main reasons for
- * allowing request and response objects to be passed to this method is
- * to allow the AsyncListener to release any resources associated with
- * them when the AsyncEvent is delivered.
+ * <p>The given ServletRequest and ServletResponse objects will
+ * be made available to the given AsyncListener via the
+ * {@link AsyncEvent#getSuppliedRequest getSuppliedRequest} and
+ * {@link AsyncEvent#getSuppliedResponse getSuppliedResponse} methods,
+ * respectively, of the {@link AsyncEvent} delivered to it. These objects
+ * should not be read from or written to, respectively, at the time the
+ * AsyncEvent is delivered, because additional wrapping may have
+ * occurred since the given AsyncListener was registered, but may be used
+ * in order to release any resources associated with them.
*
* @param listener the AsyncListener to be registered
* @param servletRequest the ServletRequest that will be included
@@ -844,14 +834,8 @@
* A timeout value of 0 or less indicates that the asynchronous
* operations will never time out.
*
- * <p>If neither {@link AsyncContext#complete} nor
- * {@link AsyncContext#dispatch} is called within the
- * specified timeout, any listeners of type {@link AsyncListener} that
- * were added to this request via a call to
- * {@link #addAsyncListener(AsyncListener)}
- * or {@link #addAsyncListener(AsyncListener, ServletRequest,
- * ServletResponse)} will have their
- * {@link AsyncListener#onTimeout(AsyncEvent)} method invoked.
+ * <p>See {@link AsyncContext} for a description of how timeouts of
+ * asynchronous operations are handled by the container.
*
* <p>This method raises an <code>IllegalStateException</code> if
* called after {@link #startAsync}, unless it is called within the
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-09-10 16:34:29 UTC (rev 1168)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-09-15 16:41:32 UTC (rev 1169)
@@ -2974,7 +2974,7 @@
public void addAsyncListener(AsyncListener listener,
ServletRequest servletRequest, ServletResponse servletResponse) {
- AsyncEvent event = new AsyncEvent(servletRequest, servletResponse);
+ AsyncEvent event = new AsyncEvent(asyncContext, servletRequest, servletResponse);
asyncListeners.put(event, listener);
}
Modified: trunk/java/org/apache/catalina/core/StandardWrapperValve.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2009-09-10 16:34:29 UTC (rev 1168)
+++ trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2009-09-15 16:41:32 UTC (rev 1169)
@@ -406,6 +406,7 @@
|| event.getType() == EventType.TIMEOUT) {
// Invoke the listeners with onComplete or onTimeout
boolean timeout = (event.getType() == EventType.TIMEOUT) ? true : false;
+ boolean error = (event.getType() == EventType.ERROR) ? true : false;
Iterator<AsyncEvent> asyncEvents = asyncContext.getAsyncListeners().keySet().iterator();
if (timeout && !asyncEvents.hasNext()) {
// FIXME: MUST do an ERROR dispatch to the original URI and MUST set the response code to 500
@@ -416,6 +417,11 @@
try {
if (timeout) {
asyncListener.onTimeout(asyncEvent);
+ } else if (error) {
+ Throwable t = (Throwable) request.getAttribute(Globals.EXCEPTION_ATTR);
+ AsyncEvent asyncEvent2 = new AsyncEvent(asyncEvent.getAsyncContext(),
+ asyncEvent.getSuppliedRequest(), asyncEvent.getSuppliedResponse(), t);
+ asyncListener.onError(asyncEvent2);
} else {
asyncListener.onComplete(asyncEvent);
}
@@ -455,6 +461,7 @@
container.getLogger().error(sm.getString("standardWrapper.async.dispatchError",
getContainer().getName()), e);
exception(request, response, e);
+ // TODO: the exception must be sent to error
}
// If there is no new startAsync, then close the response
if (!asyncContext.isReady()) {
14 years, 9 months
JBossWeb SVN: r1168 - tags.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-09-10 12:34:29 -0400 (Thu, 10 Sep 2009)
New Revision: 1168
Added:
tags/JBOSSWEB_2_1_4_GA/
Log:
- Jboss Web 2.1.4 GA.
Copied: tags/JBOSSWEB_2_1_4_GA (from rev 1167, branches/2.1.x)
14 years, 9 months
JBossWeb SVN: r1167 - in branches/2.1.x: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-09-10 12:32:40 -0400 (Thu, 10 Sep 2009)
New Revision: 1167
Modified:
branches/2.1.x/build.properties.default
branches/2.1.x/webapps/docs/changelog.xml
Log:
- Jboss Web 2.1.4 GA.
Modified: branches/2.1.x/build.properties.default
===================================================================
--- branches/2.1.x/build.properties.default 2009-09-10 16:14:25 UTC (rev 1166)
+++ branches/2.1.x/build.properties.default 2009-09-10 16:32:40 UTC (rev 1167)
@@ -59,12 +59,12 @@
commons-collections-src.loc=${base-commons.loc}/collections/source/commons-collections-3.2.1-src.tar.gz
# ----- NSIS, version 2.0 or later -----
-nsis.home=${base.path}/nsis-2.43
+nsis.home=${base.path}/nsis-2.45
nsis.exe=${nsis.home}/makensis.exe
nsis.installoptions.dll=${nsis.home}/Plugins/InstallOptions.dll
nsis.nsexec.dll=${nsis.home}/Plugins/nsExec.dll
nsis.nsisdl.dll=${nsis.home}/Plugins/NSISdl.dll
-nsis.loc=${base-sf.loc}/nsis/nsis-2.43.zip
+nsis.loc=${base-sf.loc}/nsis/nsis-2.45.zip
# ----- JBoss Native, version 2.0 or later -----
jbossnative.home=${base.path}/jboss-native-2.0.6
Modified: branches/2.1.x/webapps/docs/changelog.xml
===================================================================
--- branches/2.1.x/webapps/docs/changelog.xml 2009-09-10 16:14:25 UTC (rev 1166)
+++ branches/2.1.x/webapps/docs/changelog.xml 2009-09-10 16:32:40 UTC (rev 1167)
@@ -19,6 +19,9 @@
<section name="JBoss Web 2.1.4.GA (remm)">
<subsection name="General">
<changelog>
+ <update>
+ NSIS 2.45. (remm)
+ </update>
</changelog>
</subsection>
<subsection name="Catalina">
14 years, 9 months
JBossWeb SVN: r1166 - in branches/2.1.x: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-09-10 12:14:25 -0400 (Thu, 10 Sep 2009)
New Revision: 1166
Modified:
branches/2.1.x/build.properties.default
branches/2.1.x/webapps/docs/changelog.xml
Log:
- Changelog update.
Modified: branches/2.1.x/build.properties.default
===================================================================
--- branches/2.1.x/build.properties.default 2009-09-10 12:30:19 UTC (rev 1165)
+++ branches/2.1.x/build.properties.default 2009-09-10 16:14:25 UTC (rev 1166)
@@ -12,7 +12,7 @@
# ----- Version Control Flags -----
version.major=2
version.minor=1
-version.build=3
+version.build=4
version.patch=0
version.tag=SNAPSHOT
Modified: branches/2.1.x/webapps/docs/changelog.xml
===================================================================
--- branches/2.1.x/webapps/docs/changelog.xml 2009-09-10 12:30:19 UTC (rev 1165)
+++ branches/2.1.x/webapps/docs/changelog.xml 2009-09-10 16:14:25 UTC (rev 1166)
@@ -29,6 +29,9 @@
<fix>
<bug>29936</bug>: Create digesters and parsers earlier so we aren't using the webapp class loader when we create them. (markt)
</fix>
+ <add>
+ Add the PING/PING_RSP logic to cluster listener. (jfclere)
+ </add>
</changelog>
</subsection>
<subsection name="Coyote">
14 years, 9 months
JBossWeb SVN: r1165 - trunk/java/org/apache/catalina/startup.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-09-10 08:30:19 -0400 (Thu, 10 Sep 2009)
New Revision: 1165
Modified:
trunk/java/org/apache/catalina/startup/WebAnnotationSet.java
Log:
- Oops.
Modified: trunk/java/org/apache/catalina/startup/WebAnnotationSet.java
===================================================================
--- trunk/java/org/apache/catalina/startup/WebAnnotationSet.java 2009-09-10 12:19:50 UTC (rev 1164)
+++ trunk/java/org/apache/catalina/startup/WebAnnotationSet.java 2009-09-10 12:30:19 UTC (rev 1165)
@@ -33,7 +33,6 @@
import javax.annotation.security.RunAs;
import javax.annotation.security.TransportProtected;
import javax.servlet.annotation.MultipartConfig;
-import javax.servlet.annotation.WebInitParam;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -141,7 +140,7 @@
(MultipartConfig) classClass.getAnnotation(MultipartConfig.class);
Multipart multipartConfig = new Multipart();
multipartConfig.setLocation(annotation.location());
- multipartConfig.setMaxRequestSize(annotation.maxFileSize());
+ multipartConfig.setMaxRequestSize(annotation.maxRequestSize());
multipartConfig.setMaxFileSize(annotation.maxFileSize());
multipartConfig.setFileSizeThreshold(annotation.fileSizeThreshold());
wrapper.setMultipartConfig(multipartConfig);
14 years, 9 months
JBossWeb SVN: r1164 - in trunk/java/org/apache/catalina: connector and 3 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-09-10 08:19:50 -0400 (Thu, 10 Sep 2009)
New Revision: 1164
Modified:
trunk/java/org/apache/catalina/Wrapper.java
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/core/StandardWrapper.java
trunk/java/org/apache/catalina/deploy/Multipart.java
trunk/java/org/apache/catalina/startup/ContextConfig.java
trunk/java/org/apache/catalina/startup/WebAnnotationSet.java
Log:
- Add proper configuration for multipart.
Modified: trunk/java/org/apache/catalina/Wrapper.java
===================================================================
--- trunk/java/org/apache/catalina/Wrapper.java 2009-09-08 16:24:57 UTC (rev 1163)
+++ trunk/java/org/apache/catalina/Wrapper.java 2009-09-10 12:19:50 UTC (rev 1164)
@@ -23,8 +23,8 @@
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
import javax.servlet.UnavailableException;
-import javax.servlet.annotation.MultipartConfig;
+import org.apache.catalina.deploy.Multipart;
import org.apache.catalina.util.InstanceSupport;
@@ -172,13 +172,13 @@
/**
* Multipart configuration for this Servlet.
*/
- public MultipartConfig getMultipartConfig();
+ public Multipart getMultipartConfig();
/**
* Set the multipart configuration for this Servlet.
*/
- public void setMultipartConfig(MultipartConfig multipartConfig);
+ public void setMultipartConfig(Multipart multipartConfig);
/**
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-09-08 16:24:57 UTC (rev 1163)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-09-10 12:19:50 UTC (rev 1164)
@@ -77,7 +77,6 @@
import javax.servlet.ServletRequestAttributeEvent;
import javax.servlet.ServletRequestAttributeListener;
import javax.servlet.ServletResponse;
-import javax.servlet.annotation.MultipartConfig;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -96,6 +95,7 @@
import org.apache.catalina.core.ApplicationFilterConfig;
import org.apache.catalina.core.ApplicationFilterFactory;
import org.apache.catalina.deploy.FilterDef;
+import org.apache.catalina.deploy.Multipart;
import org.apache.catalina.realm.GenericPrincipal;
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.ParameterMap;
@@ -2758,7 +2758,7 @@
*/
protected void parseMultipart() {
- MultipartConfig config = wrapper.getMultipartConfig();
+ Multipart config = wrapper.getMultipartConfig();
if (config == null) {
return;
}
@@ -2782,14 +2782,17 @@
return;
DiskFileUpload fu = new DiskFileUpload();
- fu.setRepositoryPath(config.location());
- if (config.fileSizeThreshold() > 0) {
- fu.setSizeThreshold(config.fileSizeThreshold());
+ fu.setRepositoryPath(config.getLocation());
+ if (config.getFileSizeThreshold() > 0) {
+ fu.setSizeThreshold(config.getFileSizeThreshold());
}
- if (config.maxRequestSize() > 0) {
- fu.setSizeMax(config.maxRequestSize());
+ if (config.getMaxRequestSize() > 0) {
+ fu.setSizeMax(config.getMaxRequestSize());
}
- // FIXME: Unimplemented per file max size: fu.setSizeFileMax(config.maxFileSize());
+ if (config.getMaxFileSize() > 0) {
+ // FIXME: Unimplemented per file max size
+ //fu.setSizeFileMax(config.getMaxFileSize());
+ }
parts = new HashMap<String, Part>();
try {
Modified: trunk/java/org/apache/catalina/core/StandardWrapper.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapper.java 2009-09-08 16:24:57 UTC (rev 1163)
+++ trunk/java/org/apache/catalina/core/StandardWrapper.java 2009-09-10 12:19:50 UTC (rev 1164)
@@ -43,7 +43,6 @@
import javax.servlet.ServletResponse;
import javax.servlet.SingleThreadModel;
import javax.servlet.UnavailableException;
-import javax.servlet.annotation.MultipartConfig;
import org.apache.catalina.Container;
import org.apache.catalina.ContainerServlet;
@@ -53,6 +52,7 @@
import org.apache.catalina.InstanceListener;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Wrapper;
+import org.apache.catalina.deploy.Multipart;
import org.apache.catalina.security.SecurityUtil;
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.InstanceSupport;
@@ -190,7 +190,7 @@
/**
* The multipart config annotation configured on this servlet.
*/
- protected MultipartConfig multipartConfig = null;
+ protected Multipart multipartConfig = null;
/**
@@ -544,7 +544,7 @@
/**
* Multipart configuration for this Servlet.
*/
- public MultipartConfig getMultipartConfig() {
+ public Multipart getMultipartConfig() {
return multipartConfig;
}
@@ -552,7 +552,7 @@
/**
* Set the multipart configuration for this Servlet.
*/
- public void setMultipartConfig(MultipartConfig multipartConfig) {
+ public void setMultipartConfig(Multipart multipartConfig) {
this.multipartConfig = multipartConfig;
}
Modified: trunk/java/org/apache/catalina/deploy/Multipart.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/Multipart.java 2009-09-08 16:24:57 UTC (rev 1163)
+++ trunk/java/org/apache/catalina/deploy/Multipart.java 2009-09-10 12:19:50 UTC (rev 1164)
@@ -27,8 +27,8 @@
public class Multipart implements Serializable {
protected String location = null;
- protected long maxFileSize = 0;
- protected long maxRequestSize = 0;
+ protected long maxFileSize = -1;
+ protected long maxRequestSize = -1;
protected int fileSizeThreshold = 0;
public String getLocation() {
Modified: trunk/java/org/apache/catalina/startup/ContextConfig.java
===================================================================
--- trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-09-08 16:24:57 UTC (rev 1163)
+++ trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-09-10 12:19:50 UTC (rev 1164)
@@ -430,15 +430,6 @@
*/
protected void processConfigAnnotations(Class<?> clazz) {
- if (clazz.isAnnotationPresent(WebInitParam.class)) {
- WebInitParam annotation = clazz.getAnnotation(WebInitParam.class);
- // Add init param
- context.addParameter(annotation.name(), annotation.value());
- }
- if (clazz.isAnnotationPresent(MultipartConfig.class)) {
- MultipartConfig annotation = clazz.getAnnotation(MultipartConfig.class);
- // FIXME: Do something ....
- }
if (clazz.isAnnotationPresent(WebFilter.class)) {
WebFilter annotation = clazz.getAnnotation(WebFilter.class);
// Add servlet filter
@@ -493,7 +484,6 @@
}
}
if (clazz.isAnnotationPresent(WebListener.class)) {
- WebListener annotation = clazz.getAnnotation(WebListener.class);
// Add listener
context.addApplicationListener(clazz.getName());
}
Modified: trunk/java/org/apache/catalina/startup/WebAnnotationSet.java
===================================================================
--- trunk/java/org/apache/catalina/startup/WebAnnotationSet.java 2009-09-08 16:24:57 UTC (rev 1163)
+++ trunk/java/org/apache/catalina/startup/WebAnnotationSet.java 2009-09-10 12:19:50 UTC (rev 1164)
@@ -32,6 +32,8 @@
import javax.annotation.security.RolesAllowed;
import javax.annotation.security.RunAs;
import javax.annotation.security.TransportProtected;
+import javax.servlet.annotation.MultipartConfig;
+import javax.servlet.annotation.WebInitParam;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -46,6 +48,7 @@
import org.apache.catalina.deploy.ContextService;
import org.apache.catalina.deploy.FilterDef;
import org.apache.catalina.deploy.MessageDestinationRef;
+import org.apache.catalina.deploy.Multipart;
import org.apache.catalina.deploy.SecurityCollection;
import org.apache.catalina.deploy.SecurityConstraint;
@@ -95,7 +98,7 @@
protected static void loadApplicationFilterAnnotations(Context context) {
FilterDef[] filterDefs = context.findFilterDefs();
for (int i = 0; i < filterDefs.length; i++) {
- loadClassAnnotation(context, (filterDefs[i]).getFilterClass());
+ loadClassAnnotation(context, filterDefs[i].getFilterClass());
}
}
@@ -107,7 +110,7 @@
ClassLoader classLoader = context.getLoader().getClassLoader();
StandardWrapper wrapper = null;
- Class classClass = null;
+ Class<?> classClass = null;
Container[] children = context.findChildren();
for (int i = 0; i < children.length; i++) {
@@ -131,7 +134,19 @@
}
loadClassAnnotation(context, wrapper.getServletClass());
-
+
+ // Multipart configuration annotation
+ if (classClass.isAnnotationPresent(MultipartConfig.class)) {
+ MultipartConfig annotation =
+ (MultipartConfig) classClass.getAnnotation(MultipartConfig.class);
+ Multipart multipartConfig = new Multipart();
+ multipartConfig.setLocation(annotation.location());
+ multipartConfig.setMaxRequestSize(annotation.maxFileSize());
+ multipartConfig.setMaxFileSize(annotation.maxFileSize());
+ multipartConfig.setFileSizeThreshold(annotation.fileSizeThreshold());
+ wrapper.setMultipartConfig(multipartConfig);
+ }
+
// Process JSR 250 access control annotations
// Process PermitAll, TransportProtected and RolesAllowed on the class
boolean classPA = false, classTP = false;
@@ -278,7 +293,7 @@
protected static void loadClassAnnotation(Context context, String fileString) {
ClassLoader classLoader = context.getLoader().getClassLoader();
- Class classClass = null;
+ Class<?> classClass = null;
try {
classClass = classLoader.loadClass(fileString);
14 years, 9 months
JBossWeb SVN: r1163 - branches/2.1.x/java/org/jboss/web/cluster.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-09-08 12:24:57 -0400 (Tue, 08 Sep 2009)
New Revision: 1163
Modified:
branches/2.1.x/java/org/jboss/web/cluster/ClusterListener.java
Log:
A the PING/PING_RSP logic.
Modified: branches/2.1.x/java/org/jboss/web/cluster/ClusterListener.java
===================================================================
--- branches/2.1.x/java/org/jboss/web/cluster/ClusterListener.java 2009-09-04 10:37:30 UTC (rev 1162)
+++ branches/2.1.x/java/org/jboss/web/cluster/ClusterListener.java 2009-09-08 16:24:57 UTC (rev 1163)
@@ -687,8 +687,29 @@
}
return result.toString();
}
+
+ /**
+ * Check the node connectivity with the proxies.
+ *
+ *
+ * @return the status of the node or the proxy.
+ */
+ public String doProxyPing(String JvmRoute) {
+ HashMap<String, String> parameters = new HashMap<String, String>();
+ if (JvmRoute != null)
+ parameters.put("JVMRoute", JvmRoute);
+ // Send PING * request
+ Proxy[] local = proxies;
+ StringBuffer result = new StringBuffer();
+ for (int i = 0; i < local.length; i++) {
+ result.append("Proxy[").append(i).append("]: [").append(local[i].address)
+ .append(':').append(local[i].port).append("]: \r\n");
+ result.append(sendRequest("PING", true, parameters, i));
+ result.append("\r\n");
+ }
+ return result.toString();
+ }
-
/**
* Reset a DOWN connection to the proxy up to ERROR, where the configuration will
* be refreshed. To be used through JMX or similar.
14 years, 9 months
JBossWeb SVN: r1162 - in trunk/java/javax/servlet: annotation and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-09-04 06:37:30 -0400 (Fri, 04 Sep 2009)
New Revision: 1162
Modified:
trunk/java/javax/servlet/Registration.java
trunk/java/javax/servlet/ServletContainerInitializer.java
trunk/java/javax/servlet/ServletContext.java
trunk/java/javax/servlet/ServletRequest.java
trunk/java/javax/servlet/annotation/HandlesTypes.java
Log:
- Javadoc update.
Modified: trunk/java/javax/servlet/Registration.java
===================================================================
--- trunk/java/javax/servlet/Registration.java 2009-09-02 12:50:53 UTC (rev 1161)
+++ trunk/java/javax/servlet/Registration.java 2009-09-04 10:37:30 UTC (rev 1162)
@@ -43,6 +43,19 @@
* Interface through which a {@link Servlet} or {@link Filter} may be
* further configured.
*
+ * <p>A Registration object whose {@link #getClassName} method returns null
+ * is considered <i>preliminary</i>. Servlets and Filters whose implementation
+ * class is container implementation specific may be declared without
+ * any <tt>servlet-class</tt> or <tt>filter-class</tt> elements, respectively,
+ * and will be represented as preliminary Registration objects.
+ * Preliminary registrations must be completed by calling one of the
+ * <tt>addServlet</tt> or <tt>addFilter</tt> methods on
+ * {@link ServletContext}, and passing in the Servlet or Filter name
+ * (obtained via {@link #getName}) along with the supporting Servlet or Filter
+ * implementation class name, Class object, or instance, respectively.
+ * In most cases, preliminary registrations will be completed by an
+ * appropriate, container-provided {@link ServletContainerInitializer}.
+ *
* @since Servlet 3.0
*/
public interface Registration {
@@ -61,7 +74,8 @@
* is represented by this Registration.
*
* @return the fully qualified class name of the Servlet or Filter
- * that is represented by this Registration
+ * that is represented by this Registration, or null if this
+ * Registration is preliminary
*/
public String getClassName();
Modified: trunk/java/javax/servlet/ServletContainerInitializer.java
===================================================================
--- trunk/java/javax/servlet/ServletContainerInitializer.java 2009-09-02 12:50:53 UTC (rev 1161)
+++ trunk/java/javax/servlet/ServletContainerInitializer.java 2009-09-04 10:37:30 UTC (rev 1162)
@@ -39,14 +39,20 @@
import java.util.Set;
/**
- * Interface which may be implemented by a library/runtime in order
- * to be notified by the container of any of the classes/interfaces
- * in which it has expressed interest via the
- * {@link javax.servlet.annotation.HandlesTypes HandlesTypes} annotation.
+ * Interface which allows a library/runtime to be notified of a web
+ * application's startup phase and perform any required programmatic
+ * registration of servlets, filters, and listeners in response to it.
*
- * <p>If an implementation of this interface does not have any such
- * annotation, the container must pass a <tt>null</tt> set of classes to
- * its {@link #onStartup} method.
+ * <p>Implementations of this interface may be annotated with
+ * {@link javax.servlet.annotation.HandlesTypes HandlesTypes}, in order to
+ * receive (at their {@link #onStartup} method) the Set of application
+ * classes that implement, extend, or have been annotated with the class
+ * types specified by the annotation.
+ *
+ * <p>If an implementation of this interface does not use this annotation,
+ * or none of the application classes match the ones specified
+ * by the annotation, the container must pass a <tt>null</tt> Set of classes
+ * to {@link #onStartup}.
*
* <p>Implementations of this interface may be declared by a JAR file
* resource located inside the <tt>META-INF/services</tt> directory and
@@ -73,14 +79,16 @@
* its <tt>onStartup</tt> method will be invoked every time an
* application is started.
*
- * @param c The set of classes in which this
- * <tt>ServletContainerInitializer</tt> has expressed interest via
- * the <tt>HandlesTypes</tt> annotation, or <tt>null</tt> if this
- * <tt>ServletContainerInitializer</tt> does not have any such
- * annotation
+ * @param c the Set of application classes that extend, implement, or
+ * have been annotated with the class types specified by the
+ * {@link javax.servlet.annotation.HandlesTypes HandlesTypes} annotation,
+ * or <tt>null</tt> if there are no matches, or this
+ * <tt>ServletContainerInitializer</tt> has not been annotated with
+ * <tt>HandlesTypes</tt>
*
- * @param ctx The <tt>ServletContext</tt> instance in which the types
- * defined via the <tt>HandlesTypes</tt> annotation were found.
+ * @param ctx the <tt>ServletContext</tt> of the web application that
+ * is being started and in which the classes contained in <tt>c</tt>
+ * were found
*
* @throws ServletException if an error has occurred
*/
Modified: trunk/java/javax/servlet/ServletContext.java
===================================================================
--- trunk/java/javax/servlet/ServletContext.java 2009-09-02 12:50:53 UTC (rev 1161)
+++ trunk/java/javax/servlet/ServletContext.java 2009-09-04 10:37:30 UTC (rev 1162)
@@ -743,12 +743,18 @@
* classloader associated with the application represented by this
* ServletContext.
*
+ * <p>If this ServletContext already contains a preliminary
+ * ServletRegistration for a servlet with the given <tt>servletName</tt>,
+ * it will be completed (by assigning the given <tt>className</tt> to it)
+ * and returned.
+ *
* @param servletName the name of the servlet
* @param className the fully qualified class name of the servlet
*
* @return a ServletRegistration object that may be used to further
* configure the registered servlet, or <tt>null</tt> if this
- * ServletContext already contains a servlet with a matching name
+ * ServletContext already contains a complete ServletRegistration for
+ * a servlet with the given <tt>servletName</tt>
*
* @throws IllegalStateException if this ServletContext has already
* been initialized
@@ -772,15 +778,20 @@
* <p>The registered servlet may be further configured via the returned
* {@link ServletRegistration} object.
*
+ * <p>If this ServletContext already contains a preliminary
+ * ServletRegistration for a servlet with the given <tt>servletName</tt>,
+ * it will be completed (by assigning the class name of the given servlet
+ * instance to it) and returned.
+ *
* @param servletName the name of the servlet
* @param servlet the servlet instance to register
*
* @return a ServletRegistration object that may be used to further
* configure the given servlet, or <tt>null</tt> if this
- * ServletContext already contains a servlet with a matching name,
- * or if the same servlet instance has already been registered with
- * this or another ServletContext that is part of the same servlet
- * container
+ * ServletContext already contains a complete ServletRegistration for a
+ * servlet with the given <tt>servletName</tt> or if the same servlet
+ * instance has already been registered with this or another
+ * ServletContext in the same container
*
* @throws IllegalStateException if this ServletContext has already
* been initialized
@@ -807,13 +818,19 @@
* <p>The registered servlet may be further configured via the returned
* {@link ServletRegistration} object.
*
+ * <p>If this ServletContext already contains a preliminary
+ * ServletRegistration for a servlet with the given <tt>servletName</tt>,
+ * it will be completed (by assigning the name of the given
+ * <tt>servletClass</tt> to it) and returned.
+ *
* @param servletName the name of the servlet
* @param servletClass the class object from which the servlet will be
* instantiated
*
* @return a ServletRegistration object that may be used to further
* configure the registered servlet, or <tt>null</tt> if this
- * ServletContext already contains a servlet with a matching name
+ * ServletContext already contains a complete ServletRegistration for
+ * the given <tt>servletName</tt>
*
* @throws IllegalStateException if this ServletContext has already
* been initialized
@@ -831,14 +848,18 @@
/**
- * Instantiates the given Servlet class and performs any required
- * resource injection into the new Servlet instance before returning
- * it.
+ * Instantiates the given Servlet class.
*
+ * <p>This method must support all annotations applicable to Servlets
+ * as defined by the Servlet specification.
+ *
* <p>The returned Servlet instance may be further customized before it
* is registered with this ServletContext via a call to
* {@link #addServlet(String,Servlet)}.
*
+ * <p>The given Servlet class must define a zero argument constructor,
+ * which is used to instantiate it.
+ *
* @param clazz the Servlet class to instantiate
*
* @return the new Servlet instance
@@ -861,9 +882,9 @@
* Gets the ServletRegistration corresponding to the servlet with the
* given <tt>servletName</tt>.
*
- * @return the ServletRegistration corresponding to the servlet with the
- * given <tt>servletName</tt>, or null if no ServletRegistration exists
- * under that name in this ServletContext
+ * @return the (complete or preliminary) ServletRegistration for the
+ * servlet with the given <tt>servletName</tt>, or null if no
+ * ServletRegistration exists under that name
*
* @throws UnsupportedOperationException if this ServletContext was
* passed to the {@link ServletContextListener#contextInitialized} method
@@ -889,8 +910,9 @@
* <p>Any changes to the returned Map must not affect this
* ServletContext.
*
- * @return Map of the ServletRegistration objects corresponding
- * to all servlets currently registered with this ServletContext
+ * @return Map of the (complete and preliminary) ServletRegistration
+ * objects corresponding to all servlets currently registered with this
+ * ServletContext
*
* @throws UnsupportedOperationException if this ServletContext was
* passed to the {@link ServletContextListener#contextInitialized} method
@@ -914,12 +936,18 @@
* classloader associated with the application represented by this
* ServletContext.
*
+ * <p>If this ServletContext already contains a preliminary
+ * FilterRegistration for a filter with the given <tt>filterName</tt>,
+ * it will be completed (by assigning the given <tt>className</tt> to it)
+ * and returned.
+ *
* @param filterName the name of the filter
* @param className the fully qualified class name of the filter
*
* @return a FilterRegistration object that may be used to further
* configure the registered filter, or <tt>null</tt> if this
- * ServletContext already contains a filter with a matching name
+ * ServletContext already contains a complete FilterRegistration for
+ * a filter with the given <tt>filterName</tt>
*
* @throws IllegalStateException if this ServletContext has already
* been initialized
@@ -943,15 +971,20 @@
* <p>The registered filter may be further configured via the returned
* {@link FilterRegistration} object.
*
+ * <p>If this ServletContext already contains a preliminary
+ * FilterRegistration for a filter with the given <tt>filterName</tt>,
+ * it will be completed (by assigning the class name of the given filter
+ * instance to it) and returned.
+ *
* @param filterName the name of the filter
* @param filter the filter instance to register
*
* @return a FilterRegistration object that may be used to further
* configure the given filter, or <tt>null</tt> if this
- * ServletContext already contains a filter with a matching name,
- * or if the same filter instance has already been registered with
- * this or another ServletContext that is part of the same servlet
- * container
+ * ServletContext already contains a complete FilterRegistration for a
+ * filter with the given <tt>filterName</tt> or if the same filter
+ * instance has already been registered with this or another
+ * ServletContext in the same container
*
* @throws IllegalStateException if this ServletContext has already
* been initialized
@@ -975,13 +1008,19 @@
* <p>The registered filter may be further configured via the returned
* {@link FilterRegistration} object.
*
+ * <p>If this ServletContext already contains a preliminary
+ * FilterRegistration for a filter with the given <tt>filterName</tt>,
+ * it will be completed (by assigning the name of the given
+ * <tt>filterClass</tt> to it) and returned.
+ *
* @param filterName the name of the filter
* @param filterClass the class object from which the filter will be
* instantiated
*
* @return a FilterRegistration object that may be used to further
* configure the registered filter, or <tt>null</tt> if this
- * ServletContext already contains a filter with a matching name
+ * ServletContext already contains a complete FilterRegistration for a
+ * filter with the given <tt>filterName</tt>
*
* @throws IllegalStateException if this ServletContext has already
* been initialized
@@ -999,14 +1038,18 @@
/**
- * Instantiates the given Filter class and performs any required
- * resource injection into the new Filter instance before returning
- * it.
+ * Instantiates the given Filter class.
*
+ * <p>This method must support all annotations applicable to Filters
+ * as defined by the Servlet specification.
+ *
* <p>The returned Filter instance may be further customized before it
* is registered with this ServletContext via a call to
* {@link #addFilter(String,Filter)}.
*
+ * <p>The given Filter class must define a zero argument constructor,
+ * which is used to instantiate it.
+ *
* @param clazz the Filter class to instantiate
*
* @return the new Filter instance
@@ -1030,9 +1073,9 @@
* Gets the FilterRegistration corresponding to the filter with the
* given <tt>filterName</tt>.
*
- * @return the FilterRegistration corresponding to the filter with the
- * given <tt>filterName</tt>, or null if no FilterRegistration exists
- * under that name in this ServletContext
+ * @return the (complete or preliminary) FilterRegistration for the
+ * filter with the given <tt>filterName</tt>, or null if no
+ * FilterRegistration exists under that name
*
* @throws UnsupportedOperationException if this ServletContext was
* passed to the {@link ServletContextListener#contextInitialized} method
@@ -1058,8 +1101,9 @@
* <p>Any changes to the returned Map must not affect this
* ServletContext.
*
- * @return Map of the FilterRegistration objects corresponding
- * to all filters currently registered with this ServletContext
+ * @return Map of the (complete and preliminary) FilterRegistration
+ * objects corresponding to all filters currently registered with this
+ * ServletContext
*
* @throws UnsupportedOperationException if this ServletContext was
* passed to the {@link ServletContextListener#contextInitialized} method
@@ -1318,9 +1362,7 @@
/**
- * Instantiates the given EventListener class and performs any
- * required resource injection into the new EventListener instance
- * before returning it.
+ * Instantiates the given EventListener class.
*
* <p>The specified EventListener class must implement at least one of
* the <code>{@link ServletContextListener}</code>,
@@ -1331,10 +1373,16 @@
* <code>{@link javax.servlet.http.HttpSessionAttributeListener}</code>
* interfaces.
*
+ * <p>This method must support all annotations applicable to the above
+ * listener interfaces as defined by the Servlet specification.
+ *
* <p>The returned EventListener instance may be further customized
* before it is registered with this ServletContext via a call to
* {@link #addListener(EventListener)}.
*
+ * <p>The given EventListener class must define a zero argument
+ * constructor, which is used to instantiate it.
+ *
* @param clazz the EventListener class to instantiate
*
* @return the new EventListener instance
Modified: trunk/java/javax/servlet/ServletRequest.java
===================================================================
--- trunk/java/javax/servlet/ServletRequest.java 2009-09-02 12:50:53 UTC (rev 1161)
+++ trunk/java/javax/servlet/ServletRequest.java 2009-09-04 10:37:30 UTC (rev 1162)
@@ -56,14 +56,9 @@
package javax.servlet;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Locale;
-import java.util.Map;
+import java.io.*;
+import java.util.*;
-
-
/**
* Defines an object to provide client request information to a servlet. The
* servlet container creates a <code>ServletRequest</code> object and passes
@@ -83,9 +78,6 @@
public interface ServletRequest {
-
-
-
/**
*
* Returns the value of the named attribute as an <code>Object</code>,
@@ -157,12 +149,12 @@
*
* @param env <code>String</code> containing the name of
* the character encoding.
- * @throws java.io.UnsupportedEncodingException if this
+ * @throws UnsupportedEncodingException if this
* ServletRequest is still in a state where a
* character encoding may be set, but the specified
* encoding is invalid
*/
- public void setCharacterEncoding(String env) throws java.io.UnsupportedEncodingException;
+ public void setCharacterEncoding(String env) throws UnsupportedEncodingException;
Modified: trunk/java/javax/servlet/annotation/HandlesTypes.java
===================================================================
--- trunk/java/javax/servlet/annotation/HandlesTypes.java 2009-09-02 12:50:53 UTC (rev 1161)
+++ trunk/java/javax/servlet/annotation/HandlesTypes.java 2009-09-04 10:37:30 UTC (rev 1162)
@@ -44,8 +44,9 @@
import java.lang.annotation.RetentionPolicy;
/**
- * This annotation is used to declare the types an instance of the
- * ServletContainerInitializer can handle.
+ * This annotation is used to declare the class types that a
+ * {@link javax.servlet.ServletContainerInitializer
+ * ServletContainerInitializer} can handle.
*
* @see javax.servlet.ServletContainerInitializer
*
@@ -54,11 +55,18 @@
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface HandlesTypes {
+
/**
- * The types that a <tt>ServletContainerInitializer</tt> expresses interesst in. When this annotation
- * is applied on an implementation of <tt>ServletContainerInitializer</tt> the <tt>onStartup</tt> method
- * of the ServletContainerInitializer instance will get a <tt>Set</tt> of classes that were either annotated
- * with, or extends / implements the types listed via this annotation.
+ * The classes in which a {@link javax.servlet.ServletContainerInitializer
+ * ServletContainerInitializer} has expressed interest.
+ *
+ * <p>If an implementation of <tt>ServletContainerInitializer</tt>
+ * specifies this annotation, the Servlet container must pass the
+ * <tt>Set</tt> of application classes that extend, implement, or have
+ * been annotated with the class types listed by this annotation to
+ * the {@link javax.servlet.ServletContainerInitializer#onStartup}
+ * method of the ServletContainerInitializer (if no matching classes
+ * are found, <tt>null</tt> must be passed instead)
*/
Class[] value();
}
14 years, 9 months