geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pra...@apache.org
Subject svn commit: r599504 - in /geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo: AsyncServlet.java BlockingServlet.java Callback.java NIOServlet.java Utils.java
Date Thu, 29 Nov 2007 16:34:55 GMT
Author: prasad
Date: Thu Nov 29 08:34:51 2007
New Revision: 599504

URL: http://svn.apache.org/viewvc?rev=599504&view=rev
Log:
* added Apache headers
* added Utils.java

Added:
    geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Utils.java
  (with props)
Modified:
    geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java
    geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/BlockingServlet.java
    geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Callback.java
    geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/NIOServlet.java

Modified: geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java?rev=599504&r1=599503&r2=599504&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java
(original)
+++ geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java
Thu Nov 29 08:34:51 2007
@@ -1,9 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.geronimo;
 
 import java.io.IOException;
 import java.net.URL;
 import java.util.Date;
-import java.util.Random;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -83,7 +98,7 @@
 			// subsequent calls are made to the remote app to retrieve those.
 			// We don't want to set new delay times and status codes then.
 			if (remoteUri.endsWith("page")) {
-				Integer[] params = generateRandomParams();
+				Integer[] params = Utils.generateRandomParams();
 				msgRequest.setParameter("sessionId", cometId);
 				msgRequest.setParameter("delay", params[0].toString());
 				msgRequest.setParameter("code", params[1].toString());
@@ -112,26 +127,6 @@
     else if (event.getEventType() == CometEvent.EventType.END) {
 			event.close();
 		}
-	}
-
-	/**
-	 * @return
-	 */
-	protected Integer[] generateRandomParams() {
-		Integer[] params = new Integer[2];
-		final int[] codes = new int[] { 200, 302, 403, 404, 500 };
-
-		Random generator = new Random();
-
-		// generate a random delay between 10ms and 250 ms
-		int delay = generator.nextInt(2000) + 10;
-		params[0] = new Integer(delay);
-
-		// generate randomly one of http status codes.
-		int index = generator.nextInt(codes.length);
-		params[1] = new Integer(codes[index]);
-
-		return params;
 	}
 
 }

Modified: geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/BlockingServlet.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/BlockingServlet.java?rev=599504&r1=599503&r2=599504&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/BlockingServlet.java
(original)
+++ geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/BlockingServlet.java
Thu Nov 29 08:34:51 2007
@@ -1,3 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.geronimo;
 
 import java.io.BufferedReader;
@@ -5,7 +21,6 @@
 import java.io.InputStreamReader;
 import java.io.PrintWriter;
 import java.net.URL;
-import java.util.Random;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
@@ -56,7 +71,7 @@
 			remoteUri = "/remoteApp/page";
 		}		
 
-		Integer[] params = generateRandomParams();
+		Integer[] params = Utils.generateRandomParams();
 		System.out.println("sessionId:" + sessionId + "; delay:" + params[0]
 				+ "; code:" + params[1]);
 
@@ -83,21 +98,5 @@
 		System.out.println("doGet processed");
 	}
 
-	protected Integer[] generateRandomParams() {
-		Integer[] params = new Integer[2];
-		final int[] codes = new int[] { 200, 302, 403, 404, 500 };
-
-		Random generator = new Random();
-
-		// generate a random delay between 10ms and 250 ms
-		int delay = generator.nextInt(2000) + 10;
-		params[0] = new Integer(delay);
-
-		// generate randomly one of http status codes.
-		int index = generator.nextInt(codes.length);
-		params[1] = new Integer(codes[index]);
-
-		return params;
-	}
-
+	
 }

Modified: geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Callback.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Callback.java?rev=599504&r1=599503&r2=599504&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Callback.java
(original)
+++ geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Callback.java
Thu Nov 29 08:34:51 2007
@@ -1,5 +1,18 @@
 /**
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 package org.apache.geronimo;
 

Modified: geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/NIOServlet.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/NIOServlet.java?rev=599504&r1=599503&r2=599504&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/NIOServlet.java
(original)
+++ geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/NIOServlet.java
Thu Nov 29 08:34:51 2007
@@ -1,9 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.geronimo;
 
 import java.io.InterruptedIOException;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.util.Random;
 import java.util.Date;
 
 import javax.servlet.ServletException;
@@ -158,7 +173,7 @@
                 remoteUri = "/remoteApp/page";
             }
 
-            Integer[] params = generateRandomParams();
+            Integer[] params = Utils.generateRandomParams();
             System.out.println("sessionId:" + sessionId + "; delay:" + params[0]
                                + "; code:" + params[1]);
 
@@ -177,22 +192,7 @@
 
     }
 
-    protected Integer[] generateRandomParams() {
-        Integer[] params = new Integer[2];
-        final int[] codes = new int[] { 200, 302, 403, 404, 500};
-
-        Random generator = new Random();
-
-        // generate a random delay between 10ms and 250 ms
-        int delay = generator.nextInt(250) + 10;
-        params[0] = new Integer(delay);
-
-        // generate randomly one of http status codes.
-        int index = generator.nextInt(codes.length);
-        params[1] = new Integer(codes[index]);
-
-        return params;
-    }
+    
 
     static class MyHttpRequestExecutionHandler implements HttpRequestExecutionHandler {
 

Added: geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Utils.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Utils.java?rev=599504&view=auto
==============================================================================
--- geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Utils.java
(added)
+++ geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Utils.java
Thu Nov 29 08:34:51 2007
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo;
+
+import java.util.Random;
+
+public class Utils {
+
+    public static Integer[] generateRandomParams() {
+        Integer[] params = new Integer[2];
+        final int[] codes = new int[] { 200, 302, 403, 404, 500};
+
+        Random generator = new Random();
+
+        // generate a random delay between 10ms and 250 ms
+        int delay = generator.nextInt(2000) + 10;
+        params[0] = new Integer(delay);
+
+        // generate randomly one of http status codes.
+        int index = generator.nextInt(codes.length);
+        params[1] = new Integer(codes[index]);
+
+        return params;
+    }
+
+}

Propchange: geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Utils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Utils.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Utils.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message