JBossWeb SVN: r1310 - sandbox/clients.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-11-30 11:43:48 -0500 (Mon, 30 Nov 2009)
New Revision: 1310
Added:
sandbox/clients/CometTestSSL.java
Modified:
sandbox/clients/CometTest.java
Log:
Add test for SSL.
Modified: sandbox/clients/CometTest.java
===================================================================
--- sandbox/clients/CometTest.java 2009-11-30 13:57:53 UTC (rev 1309)
+++ sandbox/clients/CometTest.java 2009-11-30 16:43:48 UTC (rev 1310)
@@ -79,16 +79,16 @@
public void run()
{
try {
- runit();
+ URL u = new URL(strURL);
+ Socket s = new Socket(u.getHost(), u.getPort());
+ runit(s, u);
} catch (Exception ex) {
this.ex = ex;
}
}
- public void runit()throws Exception
+ public void runit(Socket s, URL u)throws Exception
{
- URL u = new URL(strURL);
- Socket s = new Socket(u.getHost(), u.getPort());
OutputStream os = s.getOutputStream();
os.write(("POST " + u.getPath() + " HTTP/1.1\n").getBytes());
os.write(("User-Agent: " + CometTest.class.getClass().getName() + " (chunked-test)\n").getBytes());
Added: sandbox/clients/CometTestSSL.java
===================================================================
--- sandbox/clients/CometTestSSL.java (rev 0)
+++ sandbox/clients/CometTestSSL.java 2009-11-30 16:43:48 UTC (rev 1310)
@@ -0,0 +1,97 @@
+/*
+ Copyright 2009 Red Hat Middleware, LLC.
+ Licensed 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 ati
+
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software distributedi
+ under the License is distributed on an "AS IS" BASIS,i
+ 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.
+ */
+
+/*
+ * Client test for comet webapp
+ *
+ * @author jfclere
+ */
+
+import java.net.Socket;
+import java.net.URL;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
+public class CometTestSSL extends CometTest
+{
+ public CometTestSSL(String strURL, int max) {
+ super(strURL, max);
+ }
+ static TrustManager[] trustAllCerts = new TrustManager[] {
+ new X509TrustManager() {
+ public java.security.cert.X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+ public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
+ }
+ public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
+ }
+ }
+ };
+
+ /**
+ *
+ * Usage:
+ * java KeepAliveTest http://mywebserver:80/
+ *
+ * @param args command line arguments
+ * Argument 0 is a URL to a web server
+ *
+ */
+ public static void main(String[] args) throws Exception
+ {
+ if (args.length != 1)
+ {
+ System.err.println("missing command line arguments");
+ System.exit(1);
+ }
+
+ String strURL = args[0];
+ CometTestSSL comet[] = new CometTestSSL[1];
+ for (int i=0; i<comet.length; i++) {
+ comet[i] = new CometTestSSL(strURL, 1000);
+ }
+ for (int i=0; i<comet.length; i++) {
+ comet[i].start();
+ }
+ for (int i=0; i<comet.length; i++) {
+ comet[i].join();
+ if (comet[i].failed) {
+ System.err.println("Test failed! " + comet[i].ex);
+ System.exit(1);
+ }
+ }
+ }
+ /**
+ * Run the test
+ */
+
+ public void run()
+ {
+ try {
+ SSLContext sslCtx = SSLContext.getInstance("TLS");
+ sslCtx.init(null, trustAllCerts, new java.security.SecureRandom());
+ SSLSocketFactory socketFactory = sslCtx.getSocketFactory();
+ URL u = new URL(strURL);
+ Socket s = (Socket) socketFactory.createSocket(u.getHost(), u.getPort());
+
+ runit(s, u);
+ } catch (Exception ex) {
+ this.ex = ex;
+ }
+ }
+}
15 years, 1 month
JBossWeb SVN: r1309 - in branches/2.1.x: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-11-30 08:57:53 -0500 (Mon, 30 Nov 2009)
New Revision: 1309
Modified:
branches/2.1.x/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
branches/2.1.x/webapps/docs/changelog.xml
Log:
Port from trunk.
Modified: branches/2.1.x/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
===================================================================
--- branches/2.1.x/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 2009-11-30 13:21:02 UTC (rev 1308)
+++ branches/2.1.x/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 2009-11-30 13:57:53 UTC (rev 1309)
@@ -718,7 +718,7 @@
int end = bbuf.position();
int res = 0;
while (pos < end) {
- res = Socket.sendibb(socket, pos, bbuf.position());
+ res = Socket.sendibb(socket, pos, end - pos);
if (res > 0) {
pos += res;
} else {
@@ -750,7 +750,7 @@
int end = bbuf.position();
int res = 0;
while (pos < end) {
- res = Socket.sendibb(socket, pos, bbuf.position());
+ res = Socket.sendibb(socket, pos, end - pos);
if (res > 0) {
pos += res;
} else {
@@ -812,7 +812,7 @@
int pos = 0;
int end = bbuf.position();
while (pos < end) {
- res = Socket.sendibb(socket, pos, end);
+ res = Socket.sendibb(socket, pos, end - pos);
if (res > 0) {
pos += res;
} else {
Modified: branches/2.1.x/webapps/docs/changelog.xml
===================================================================
--- branches/2.1.x/webapps/docs/changelog.xml 2009-11-30 13:21:02 UTC (rev 1308)
+++ branches/2.1.x/webapps/docs/changelog.xml 2009-11-30 13:57:53 UTC (rev 1309)
@@ -16,6 +16,16 @@
<body>
+<section name="JBoss Web 2.1.7.GA (remm)">
+ <subsection name="Coyote">
+ <changelog>
+ <fix>
+ Fix incomplete write logic in APR. (jfclere)
+ </fix>
+ </changelog>
+ </subsection>
+</section>
+
<section name="JBoss Web 2.1.6.GA (remm)">
<subsection name="Coyote">
<changelog>
15 years, 1 month
JBossWeb SVN: r1308 - trunk/webapps/docs.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-11-30 08:21:02 -0500 (Mon, 30 Nov 2009)
New Revision: 1308
Modified:
trunk/webapps/docs/changelog.xml
Log:
Add something in the changelog...
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-11-30 13:05:00 UTC (rev 1307)
+++ trunk/webapps/docs/changelog.xml 2009-11-30 13:21:02 UTC (rev 1308)
@@ -156,6 +156,9 @@
<subsection name="Coyote">
<changelog>
<fix>
+ Fix incomplete write logic in APR. (jfclere)
+ </fix>
+ <fix>
Remove useless instanceof in the HTTP protocol. (markt)
</fix>
<update>
15 years, 1 month
JBossWeb SVN: r1307 - trunk/java/org/apache/coyote/http11.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-11-30 08:05:00 -0500 (Mon, 30 Nov 2009)
New Revision: 1307
Modified:
trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
Log:
sendibb returns the number of bytes it was able to write.
so adjust the remaining length.
Modified: trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
===================================================================
--- trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 2009-11-29 13:36:05 UTC (rev 1306)
+++ trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 2009-11-30 13:05:00 UTC (rev 1307)
@@ -718,7 +718,7 @@
int end = bbuf.position();
int res = 0;
while (pos < end) {
- res = Socket.sendibb(socket, pos, bbuf.position());
+ res = Socket.sendibb(socket, pos, end - pos);
if (res > 0) {
pos += res;
} else {
@@ -750,7 +750,7 @@
int end = bbuf.position();
int res = 0;
while (pos < end) {
- res = Socket.sendibb(socket, pos, bbuf.position());
+ res = Socket.sendibb(socket, pos, end - pos);
if (res > 0) {
pos += res;
} else {
@@ -812,7 +812,7 @@
int pos = 0;
int end = bbuf.position();
while (pos < end) {
- res = Socket.sendibb(socket, pos, end);
+ res = Socket.sendibb(socket, pos, end - pos);
if (res > 0) {
pos += res;
} else {
15 years, 1 month
JBossWeb SVN: r1306 - tags.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-11-29 08:36:05 -0500 (Sun, 29 Nov 2009)
New Revision: 1306
Added:
tags/JBOSSWEB_3_0_0_ALPHA21/
Log:
- Fix filter regression.
Copied: tags/JBOSSWEB_3_0_0_ALPHA21 (from rev 1305, trunk)
15 years, 1 month
JBossWeb SVN: r1305 - in trunk/java/org/apache/catalina: core and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-11-28 11:11:12 -0500 (Sat, 28 Nov 2009)
New Revision: 1305
Modified:
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/connector/RequestFacade.java
trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
Log:
- get/setFilterChain should not have side effects. This fixes NPE regressions displaying the call stack or using isAsyncSupported.
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-11-28 00:17:25 UTC (rev 1304)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-11-28 16:11:12 UTC (rev 1305)
@@ -653,7 +653,7 @@
* Get filter chain associated with the request.
*/
public ApplicationFilterChain getFilterChain() {
- if (currentFilterChain >= 0) {
+ if (currentFilterChain >= 0 && currentFilterChain < filterChains.size()) {
return filterChains.get(currentFilterChain);
} else {
return null;
@@ -667,11 +667,10 @@
* @param filterChain new filter chain
*/
public void setFilterChain(ApplicationFilterChain filterChain) {
- if (currentFilterChain + 1 < filterChains.size()) {
- filterChains.set(++currentFilterChain, filterChain);
+ if (currentFilterChain >= 0 && currentFilterChain < filterChains.size()) {
+ filterChains.set(currentFilterChain, filterChain);
} else {
filterChains.add(filterChain);
- currentFilterChain++;
}
}
@@ -681,6 +680,16 @@
*
* @param filterChain new filter chain
*/
+ public void nextFilterChain() {
+ currentFilterChain++;
+ }
+
+
+ /**
+ * Set filter chain associated with the request.
+ *
+ * @param filterChain new filter chain
+ */
public void releaseFilterChain() {
currentFilterChain--;
}
Modified: trunk/java/org/apache/catalina/connector/RequestFacade.java
===================================================================
--- trunk/java/org/apache/catalina/connector/RequestFacade.java 2009-11-28 00:17:25 UTC (rev 1304)
+++ trunk/java/org/apache/catalina/connector/RequestFacade.java 2009-11-28 16:11:12 UTC (rev 1305)
@@ -1039,6 +1039,18 @@
/**
+ * Next filter chain.
+ */
+ public void nextFilterChain() {
+ if (request == null) {
+ throw new IllegalStateException(
+ sm.getString("requestFacade.nullRequest"));
+ }
+ request.nextFilterChain();
+ }
+
+
+ /**
* Release the current filter chain.
*/
public void releaseFilterChain() {
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 2009-11-28 00:17:25 UTC (rev 1304)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 2009-11-28 16:11:12 UTC (rev 1305)
@@ -171,6 +171,7 @@
filterChain = new ApplicationFilterChain();
} else {
// Add this filter chain to the request facade
+ requestFacade.nextFilterChain();
if (Globals.IS_SECURITY_ENABLED) {
filterChain = new ApplicationFilterChain();
requestFacade.setFilterChain(filterChain);
15 years, 1 month
JBossWeb SVN: r1304 - tags.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-11-27 19:17:25 -0500 (Fri, 27 Nov 2009)
New Revision: 1304
Added:
tags/JBOSSWEB_3_0_0_ALPHA20/
Log:
- JB Web alpha 20, with minor improvements and fixes.
Copied: tags/JBOSSWEB_3_0_0_ALPHA20 (from rev 1303, trunk)
15 years, 1 month
JBossWeb SVN: r1303 - in trunk/java/org/apache/catalina: deploy and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-11-27 19:10:08 -0500 (Fri, 27 Nov 2009)
New Revision: 1303
Modified:
trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
trunk/java/org/apache/catalina/deploy/FilterMap.java
Log:
- No idea why I did not notice these could be used as flags (as I do all the time for APR).
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 2009-11-27 17:11:52 UTC (rev 1302)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 2009-11-28 00:10:08 UTC (rev 1303)
@@ -47,10 +47,8 @@
package org.apache.catalina.core;
-import javax.servlet.Servlet;
import javax.servlet.ServletRequest;
import javax.servlet.ServletRequestWrapper;
-import javax.servlet.http.HttpServletRequest;
import org.apache.catalina.Globals;
import org.apache.catalina.Wrapper;
@@ -141,9 +139,6 @@
requestPath = attribute.toString();
}
- HttpServletRequest hreq = null;
- if (request instanceof HttpServletRequest)
- hreq = (HttpServletRequest)request;
// If there is no servlet to execute, return null
if (wrapper.getServlet() == null)
return (null);
@@ -391,107 +386,32 @@
private boolean matchDispatcher(FilterMap filterMap, int dispatcher) {
switch (dispatcher) {
case FORWARD : {
- if (filterMap.getDispatcherMapping() == FilterMap.FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.FORWARD_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.INCLUDE_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.INCLUDE_ERROR_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_FORWARD_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_ERROR_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_FORWARD_INCLUDE) {
+ if ((filterMap.getDispatcherMapping() & FilterMap.FORWARD) == FilterMap.FORWARD) {
return true;
}
break;
}
case INCLUDE : {
- if (filterMap.getDispatcherMapping() == FilterMap.INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.INCLUDE_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.INCLUDE_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.INCLUDE_ERROR_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_ERROR_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_FORWARD_INCLUDE) {
- return true;
+ if ((filterMap.getDispatcherMapping() & FilterMap.INCLUDE) == FilterMap.INCLUDE) {
+ return true;
}
break;
}
case REQUEST : {
- if (filterMap.getDispatcherMapping() == FilterMap.REQUEST ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD_INCLUDE) {
- return true;
+ if ((filterMap.getDispatcherMapping() & FilterMap.REQUEST) == FilterMap.REQUEST) {
+ return true;
}
break;
}
case ERROR : {
- if (filterMap.getDispatcherMapping() == FilterMap.ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.FORWARD_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.INCLUDE_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.INCLUDE_ERROR_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_FORWARD_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_ERROR_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_INCLUDE) {
- return true;
+ if ((filterMap.getDispatcherMapping() & FilterMap.ERROR) == FilterMap.ERROR) {
+ return true;
}
break;
}
case ASYNC : {
- if (filterMap.getDispatcherMapping() == FilterMap.ASYNC ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_FORWARD_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_ERROR_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_FORWARD_INCLUDE) {
- return true;
+ if ((filterMap.getDispatcherMapping() & FilterMap.ASYNC) == FilterMap.ASYNC) {
+ return true;
}
break;
}
Modified: trunk/java/org/apache/catalina/deploy/FilterMap.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/FilterMap.java 2009-11-27 17:11:52 UTC (rev 1302)
+++ trunk/java/org/apache/catalina/deploy/FilterMap.java 2009-11-28 00:10:08 UTC (rev 1303)
@@ -49,42 +49,15 @@
public static final int ERROR = 1;
public static final int FORWARD = 2;
- 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_FORWARD = 7;
public static final int REQUEST = 8;
- public static final int REQUEST_ERROR = 9;
- public static final int REQUEST_ERROR_FORWARD = 10;
- public static final int REQUEST_ERROR_FORWARD_INCLUDE = 11;
- public static final int REQUEST_ERROR_INCLUDE = 12;
- 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 static final int NOT_SET = 0;
- private int dispatcherMapping=NOT_SET;
+ private int dispatcherMapping = NOT_SET;
private String filterName = null;
@@ -159,133 +132,37 @@
}
/**
- *
* This method will be used to set the current state of the FilterMap
- * representing the state of when filters should be applied:
- *
- * ERROR
- * FORWARD
- * FORWARD_ERROR
- * INCLUDE
- * INCLUDE_ERROR
- * INCLUDE_ERROR_FORWARD
- * REQUEST
- * REQUEST_ERROR
- * REQUEST_ERROR_INCLUDE
- * REQUEST_ERROR_FORWARD_INCLUDE
- * REQUEST_INCLUDE
- * REQUEST_FORWARD,
- * REQUEST_FORWARD_INCLUDE
- *
+ * representing the state of when filters should be applied.
*/
public void setDispatcher(String dispatcherString) {
String dispatcher = dispatcherString.toUpperCase();
if (dispatcher.equals(DispatcherType.FORWARD.name())) {
-
// apply FORWARD to the global dispatcherMapping.
- switch (dispatcherMapping) {
- case NOT_SET : dispatcherMapping = FORWARD; break;
- case ERROR : dispatcherMapping = FORWARD_ERROR; break;
- case INCLUDE : dispatcherMapping = INCLUDE_FORWARD; break;
- case INCLUDE_ERROR : dispatcherMapping = INCLUDE_ERROR_FORWARD; break;
- case REQUEST : dispatcherMapping = REQUEST_FORWARD; break;
- 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;
- }
+ dispatcherMapping |= FORWARD;
} else if (dispatcher.equals(DispatcherType.INCLUDE.name())) {
// apply INCLUDE to the global dispatcherMapping.
- switch (dispatcherMapping) {
- case NOT_SET : dispatcherMapping = INCLUDE; break;
- case ERROR : dispatcherMapping = INCLUDE_ERROR; break;
- case FORWARD : dispatcherMapping = INCLUDE_FORWARD; break;
- case FORWARD_ERROR : dispatcherMapping = INCLUDE_ERROR_FORWARD; break;
- case REQUEST : dispatcherMapping = REQUEST_INCLUDE; break;
- 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;
- }
+ dispatcherMapping |= INCLUDE;
} else if (dispatcher.equals(DispatcherType.REQUEST.name())) {
// apply REQUEST to the global dispatcherMapping.
- switch (dispatcherMapping) {
- case NOT_SET : dispatcherMapping = REQUEST; break;
- case ERROR : dispatcherMapping = REQUEST_ERROR; break;
- case FORWARD : dispatcherMapping = REQUEST_FORWARD; break;
- case FORWARD_ERROR : dispatcherMapping = REQUEST_ERROR_FORWARD; break;
- case INCLUDE : dispatcherMapping = REQUEST_INCLUDE; break;
- 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;
- }
+ dispatcherMapping |= REQUEST;
} else if (dispatcher.equals(DispatcherType.ERROR.name())) {
// apply ERROR to the global dispatcherMapping.
- switch (dispatcherMapping) {
- case NOT_SET : dispatcherMapping = ERROR; break;
- case FORWARD : dispatcherMapping = FORWARD_ERROR; break;
- case INCLUDE : dispatcherMapping = INCLUDE_ERROR; break;
- case INCLUDE_FORWARD : dispatcherMapping = INCLUDE_ERROR_FORWARD; break;
- case REQUEST : dispatcherMapping = REQUEST_ERROR; break;
- 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;
- }
+ dispatcherMapping |= ERROR;
} 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;
- }
+ dispatcherMapping |= ASYNC;
}
}
public int getDispatcherMapping() {
// per the SRV.6.2.5 absence of any dispatcher elements is
// equivelant to a REQUEST value
- if (dispatcherMapping == NOT_SET) return REQUEST;
- else return dispatcherMapping;
+ if (dispatcherMapping == NOT_SET)
+ return REQUEST;
+ else
+ return dispatcherMapping;
}
15 years, 1 month
JBossWeb SVN: r1302 - sandbox/clients.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-11-27 12:11:52 -0500 (Fri, 27 Nov 2009)
New Revision: 1302
Modified:
sandbox/clients/CometTest.java
Log:
Run the loop for a random number of time and start 150 clients...
Modified: sandbox/clients/CometTest.java
===================================================================
--- sandbox/clients/CometTest.java 2009-11-27 16:01:00 UTC (rev 1301)
+++ sandbox/clients/CometTest.java 2009-11-27 17:11:52 UTC (rev 1302)
@@ -24,10 +24,15 @@
import java.io.OutputStream;
import java.net.Socket;
import java.net.URL;
+import java.util.Random;
-public class CometTest
+public class CometTest extends Thread
{
+ String strURL = "http://localhost:8080/comet/CometServletTest1";
+ Exception ex = null;
+ int max = 0;
+ boolean failed = true;
/**
*
* Usage:
@@ -37,15 +42,50 @@
* Argument 0 is a URL to a web server
*
*/
- public static void main(String[] args) throws Exception
+ public static void main(String[] args) throws Exception
+ {
+ if (args.length != 1)
{
- if (args.length != 1)
- {
- System.err.println("missing command line arguments");
- System.exit(1);
- }
+ System.err.println("missing command line arguments");
+ System.exit(1);
+ }
- String strURL = args[0];
+ String strURL = args[0];
+ CometTest comet[] = new CometTest[150];
+ for (int i=0; i<comet.length; i++) {
+ comet[i] = new CometTest(strURL, 1000);
+ }
+ for (int i=0; i<comet.length; i++) {
+ comet[i].start();
+ }
+ for (int i=0; i<comet.length; i++) {
+ comet[i].join();
+ if (comet[i].failed) {
+ System.err.println("Test failed! " + comet[i].ex);
+ System.exit(1);
+ }
+ }
+ }
+ public CometTest(String strURL, int max)
+ {
+ this.strURL = strURL;
+ Random generator = new Random();
+ this.max = generator.nextInt( max );
+ }
+ /**
+ * Run the test
+ */
+
+ public void run()
+ {
+ try {
+ runit();
+ } catch (Exception ex) {
+ this.ex = ex;
+ }
+ }
+ public void runit()throws Exception
+ {
URL u = new URL(strURL);
Socket s = new Socket(u.getHost(), u.getPort());
@@ -60,7 +100,7 @@
InputStream is = s.getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(is));
String sess = null;
- while (true) {
+ while (max>0) {
writechunk(os, "Testing...");
String res = readchunk(in);
String cursess = readsess(res);
@@ -74,7 +114,10 @@
System.out.println("Can't find Session");
break;
}
+ max--;
}
+ if (max == 0)
+ failed = false;
}
/* Write chunk a "" is the last chunk */
@@ -91,7 +134,7 @@
try {
data = in.readLine();
len = Integer.valueOf(data, 16);
- System.out.println("Got: " + len);
+ // System.out.println("Got: " + len);
} catch (Exception ex) {
System.out.println("Ex: " + ex);
}
@@ -130,7 +173,7 @@
}
}
}
- System.out.println("SESSION: " + data);
+ // System.out.println("SESSION: " + data);
return data;
}
}
15 years, 1 month
JBossWeb SVN: r1301 - in sandbox: webapps/src and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-11-27 11:01:00 -0500 (Fri, 27 Nov 2009)
New Revision: 1301
Modified:
sandbox/clients/CometTest.java
sandbox/webapps/src/CometServletTest1.java
Log:
Send and test the sessionid...
Modified: sandbox/clients/CometTest.java
===================================================================
--- sandbox/clients/CometTest.java 2009-11-27 14:36:01 UTC (rev 1300)
+++ sandbox/clients/CometTest.java 2009-11-27 16:01:00 UTC (rev 1301)
@@ -59,9 +59,21 @@
InputStream is = s.getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(is));
+ String sess = null;
while (true) {
writechunk(os, "Testing...");
String res = readchunk(in);
+ String cursess = readsess(res);
+ if (sess != null && cursess.compareTo(sess) != 0) {
+ System.out.println("Session changed: " + cursess + " " + sess);
+ break;
+ }
+ if (sess == null)
+ sess = cursess;
+ if (sess == null) {
+ System.out.println("Can't find Session");
+ break;
+ }
}
}
@@ -95,7 +107,30 @@
offset = recv;
}
data = new String(buf);
- System.out.println("DATA: " + recv + " : " + data);
+ // System.out.println("DATA: " + recv + " : " + data);
return data;
}
+ static String readsess(String in)
+ {
+ String data = null;
+ int start = in.indexOf('[');
+ if (start != -1) {
+ int end = in.indexOf(']');
+ if (end != -1) {
+ if (end > start) {
+ data = in.substring(start+1, end);
+ } else {
+ start = in.indexOf('[', end);
+ if (start != -1) {
+ end = in.indexOf(']', start);
+ if (end != -1) {
+ data = in.substring(start+1, end);
+ }
+ }
+ }
+ }
+ }
+ System.out.println("SESSION: " + data);
+ return data;
+ }
}
Modified: sandbox/webapps/src/CometServletTest1.java
===================================================================
--- sandbox/webapps/src/CometServletTest1.java 2009-11-27 14:36:01 UTC (rev 1300)
+++ sandbox/webapps/src/CometServletTest1.java 2009-11-27 16:01:00 UTC (rev 1301)
@@ -61,17 +61,14 @@
// Using while (true): Not checking if the connection is available to writing immediately
// will cause the write to be performed in blocking mode.
// boolean b = true;
- // while (b) {
+ String sessid = sess.getId();
while (event.isWriteReady()) {
if (count % 100 == 0) {
- os.println((count++) + " ");
+ os.println("[" + sessid + "] " + (count++) + " ");
} else {
- os.print((count++) + " ");
+ os.print("[" + sessid + "] " + (count++) + " ");
}
}
- // }
- //if (event.ready())
- // os.flush();
break;
case READ:
ServletInputStream is = event.getHttpServletRequest().getInputStream();
15 years, 1 month