Author: remy.maucherat(a)jboss.com
Date: 2009-04-07 19:09:34 -0400 (Tue, 07 Apr 2009)
New Revision: 992
Modified:
trunk/java/org/apache/catalina/connector/LocalStrings.properties
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
Log:
- Do some message string FIXMEs.
- Add a toString which displays the stack (will likely be moved).
Modified: trunk/java/org/apache/catalina/connector/LocalStrings.properties
===================================================================
--- trunk/java/org/apache/catalina/connector/LocalStrings.properties 2009-04-07 21:39:25
UTC (rev 991)
+++ trunk/java/org/apache/catalina/connector/LocalStrings.properties 2009-04-07 23:09:34
UTC (rev 992)
@@ -49,6 +49,10 @@
coyoteRequest.attributeEvent=Exception thrown by attributes event listener
coyoteRequest.parseParameters=Exception thrown whilst processing POSTed parameters
coyoteRequest.postTooLarge=Parameters were not parsed because the size of the posted data
was too big. Use the maxPostSize attribute of the connector to resolve this if the
application should accept large POSTs.
+coyoteRequest.noAuthenticator=No authenticator available for programmatic login
+coyoteRequest.authFailed=Failed to authenticate a principal
+coyoteRequest.noAsync=The servlet or filters that are being used by this request do not
support async operation
+coyoteRequest.servletStack=Current Servlet stack for thread {0}
#
# MapperListener
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-04-07 21:39:25 UTC (rev
991)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-04-07 23:09:34 UTC (rev
992)
@@ -90,7 +90,9 @@
import org.apache.catalina.Session;
import org.apache.catalina.Wrapper;
import org.apache.catalina.core.ApplicationFilterChain;
+import org.apache.catalina.core.ApplicationFilterConfig;
import org.apache.catalina.core.ApplicationFilterFactory;
+import org.apache.catalina.deploy.FilterDef;
import org.apache.catalina.realm.GenericPrincipal;
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.ParameterMap;
@@ -251,7 +253,7 @@
/**
* Async timeout.
*/
- protected long asyncTimeout = 300000L;
+ protected long asyncTimeout = 600000L;
/**
@@ -2878,6 +2880,11 @@
if (timeout <= 0) {
timeout = Integer.MAX_VALUE;
}
+ if (!isAsyncSupported()) {
+ throw new
IllegalStateException(sm.getString("coyoteRequest.noAsync"));
+ }
+ // FIXME: if (asyncContext != null && !processing) { throw ISE }
+ // FIXME: if (response.isClosed()) { throw ISE }
setTimeout(timeout);
asyncContext = new AsyncContextImpl(servletRequest, servletResponse);
eventMode = true;
@@ -2893,8 +2900,7 @@
return context.getAuthenticator().login(this, response);
}
} else {
- // FIXME: error message for no available authenticator
- throw new ServletException();
+ throw new
ServletException(sm.getString("coyoteRequest.noAuthenticator"));
}
}
@@ -2902,9 +2908,9 @@
Realm realm = context.getRealm();
userPrincipal = realm.authenticate(username, password);
if (userPrincipal == null) {
- throw new ServletException();
+ throw new
ServletException(sm.getString("coyoteRequest.authFailed"));
}
- authType = context.getLoginConfig().getAuthMethod();
+ authType = "LOGIN";
}
public void logout() throws ServletException {
@@ -2936,6 +2942,47 @@
}
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append(sm.getString("coyoteRequest.servletStack",
Thread.currentThread().getName()));
+ if (eventMode) {
+ buf.append(" [event]");
+ }
+ if (asyncContext != null) {
+ buf.append(" [async]");
+ }
+ buf.append("\r\n");
+ int filterChainCount = currentFilterChain;
+ for (int i = 0; i < filterChainCount; i++) {
+ ApplicationFilterChain filterChain = filterChains.get(i);
+ ApplicationFilterConfig[] filterConfigs = filterChain.getFilters();
+ int n = filterChain.getFilterCount();
+ int pos = filterChain.getPointer();
+ for (int j = 0; j < n; j++) {
+ FilterDef filterDef = filterConfigs[j].getFilterDef();
+ if (pos == j) {
+ buf.append("-> ");
+ } else {
+ buf.append(" ");
+ }
+ buf.append("[F]
").append(filterDef.getFilterName()).append(" [")
+ .append(filterDef.getFilterClass()).append("]
").append(filterDef.getAsyncSupported() ? "[A]" : "")
+ .append("\r\n");
+ }
+ if (pos == n) {
+ buf.append("-> ");
+ } else {
+ buf.append(" ");
+ }
+ Wrapper wrapper = filterChain.getWrapper();
+ buf.append("[S] ").append(wrapper.getName()).append("
[")
+ .append(wrapper.getServletClass()).append("]
").append(wrapper.getAsyncSupported() ? "[A]" : "")
+ .append("\r\n");
+ }
+ return buf.toString();
+ }
+
+
// ------------------------------------------ AsyncContextImpl Inner Class
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java 2009-04-07 21:39:25
UTC (rev 991)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java 2009-04-07 23:09:34
UTC (rev 992)
@@ -51,7 +51,7 @@
* @version $Revision$ $Date$
*/
-final class ApplicationFilterConfig implements FilterConfig, Serializable {
+public final class ApplicationFilterConfig implements FilterConfig, Serializable {
protected static StringManager sm =
@@ -242,7 +242,7 @@
/**
* Return the filter definition we are configured for.
*/
- FilterDef getFilterDef() {
+ public FilterDef getFilterDef() {
return (this.filterDef);
Show replies by date