Author: julien(a)jboss.com
Date: 2008-03-08 17:00:33 -0500 (Sat, 08 Mar 2008)
New Revision: 10241
Added:
modules/web/trunk/web/src/main/java/org/jboss/portal/web/WebExecutor.java
modules/web/trunk/web/src/main/java/org/jboss/portal/web/WebRunnable.java
Modified:
modules/web/trunk/web/src/main/java/org/jboss/portal/web/ServletContainer.java
modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/DefaultServletContainer.java
Log:
- some basics to define an executor service for web requests.
Modified: modules/web/trunk/web/src/main/java/org/jboss/portal/web/ServletContainer.java
===================================================================
---
modules/web/trunk/web/src/main/java/org/jboss/portal/web/ServletContainer.java 2008-03-08
19:18:46 UTC (rev 10240)
+++
modules/web/trunk/web/src/main/java/org/jboss/portal/web/ServletContainer.java 2008-03-08
22:00:33 UTC (rev 10241)
@@ -37,11 +37,32 @@
public interface ServletContainer
{
+ /**
+ * Add a web listener.
+ *
+ * @param listener the listener
+ * @return true if the listener has been added
+ */
boolean addWebAppListener(WebAppListener listener);
+ /**
+ * Removes a web listener.
+ *
+ * @param listener the listener
+ * @return true if the listener has been removed
+ */
boolean removeWebAppListener(WebAppListener listener);
/**
+ * Returns an executor that will use the provided request and response.
+ *
+ * @param request the request
+ * @param response the response
+ * @return an executor
+ */
+ WebExecutor getExecutor(HttpServletRequest request, HttpServletResponse response);
+
+ /**
* Generic detyped request dispatch to a servlet context using the include mechanism.
*
* @param targetServletContext the target servlet context to dispatch to
Added: modules/web/trunk/web/src/main/java/org/jboss/portal/web/WebExecutor.java
===================================================================
--- modules/web/trunk/web/src/main/java/org/jboss/portal/web/WebExecutor.java
(rev 0)
+++ modules/web/trunk/web/src/main/java/org/jboss/portal/web/WebExecutor.java 2008-03-08
22:00:33 UTC (rev 10241)
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.web;
+
+/**
+ * An executor for web runnable tasks.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface WebExecutor
+{
+
+ /**
+ * Execute a web runnable.
+ *
+ * @param runnable the web runnable
+ */
+ void execute(WebRunnable runnable);
+}
Added: modules/web/trunk/web/src/main/java/org/jboss/portal/web/WebRunnable.java
===================================================================
--- modules/web/trunk/web/src/main/java/org/jboss/portal/web/WebRunnable.java
(rev 0)
+++ modules/web/trunk/web/src/main/java/org/jboss/portal/web/WebRunnable.java 2008-03-08
22:00:33 UTC (rev 10241)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Defines a web runnable.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface WebRunnable
+{
+ /**
+ * Executes the runnable task with the provided request and reponse.
+ *
+ * @param request the request
+ * @param response the response
+ */
+ void run(HttpServletRequest request, HttpServletResponse response);
+}
Modified:
modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/DefaultServletContainer.java
===================================================================
---
modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/DefaultServletContainer.java 2008-03-08
19:18:46 UTC (rev 10240)
+++
modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/DefaultServletContainer.java 2008-03-08
22:00:33 UTC (rev 10241)
@@ -31,6 +31,8 @@
import org.jboss.portal.web.WebAppEvent;
import org.jboss.portal.web.RequestDispatchCallback;
import org.jboss.portal.web.ServletContainer;
+import org.jboss.portal.web.WebExecutor;
+import org.jboss.portal.common.NotYetImplemented;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@@ -92,6 +94,11 @@
}
}
+ public WebExecutor getExecutor(HttpServletRequest request, HttpServletResponse
response)
+ {
+ throw new NotYetImplemented();
+ }
+
public boolean addWebAppListener(WebAppListener listener)
{
synchronized (lock)