Author: thomas.heute(a)jboss.com
Date: 2009-11-24 03:31:03 -0500 (Tue, 24 Nov 2009)
New Revision: 776
Added:
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/GateInServletContextProvider.java
Removed:
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/JBossServletContextProvider.java
Modified:
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/BridgeInterceptor.java
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/BridgeResponse.java
Log:
Rename JBossServletContextProvider -> GateInServletContextProvider
Modified:
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/BridgeInterceptor.java
===================================================================
---
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/BridgeInterceptor.java 2009-11-24
00:35:57 UTC (rev 775)
+++
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/BridgeInterceptor.java 2009-11-24
08:31:03 UTC (rev 776)
@@ -38,12 +38,12 @@
public PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException
{
- JBossServletContextProvider.BridgeInfo previousInfo =
JBossServletContextProvider.get();
+ GateInServletContextProvider.BridgeInfo previousInfo =
GateInServletContextProvider.get();
try
{
// Set bridge
- JBossServletContextProvider.BridgeInfo bridgeInfo = new
JBossServletContextProvider.BridgeInfo(invocation);
- JBossServletContextProvider.set(bridgeInfo);
+ GateInServletContextProvider.BridgeInfo bridgeInfo = new
GateInServletContextProvider.BridgeInfo(invocation);
+ GateInServletContextProvider.set(bridgeInfo);
// Proceed to invocation
return super.invoke(invocation);
@@ -51,7 +51,7 @@
finally
{
// Remove bridge
- JBossServletContextProvider.set(previousInfo);
+ GateInServletContextProvider.set(previousInfo);
}
}
}
Modified:
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/BridgeResponse.java
===================================================================
---
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/BridgeResponse.java 2009-11-24
00:35:57 UTC (rev 775)
+++
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/BridgeResponse.java 2009-11-24
08:31:03 UTC (rev 776)
@@ -52,7 +52,7 @@
/** . */
protected ServletOutputStream sos;
- public BridgeResponse(JBossServletContextProvider.BridgeInfo info)
+ public BridgeResponse(GateInServletContextProvider.BridgeInfo info)
{
super(info.getInvocation().getDispatchedResponse());
invocation = info.getInvocation();
Copied:
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/GateInServletContextProvider.java
(from rev 775,
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/JBossServletContextProvider.java)
===================================================================
---
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/GateInServletContextProvider.java
(rev 0)
+++
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/GateInServletContextProvider.java 2009-11-24
08:31:03 UTC (rev 776)
@@ -0,0 +1,139 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.gatein.pc.bridge;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.portals.bridges.common.ServletContextProvider;
+import org.gatein.pc.portlet.container.PortletContainer;
+import org.gatein.pc.portlet.container.ContainerPortletInvoker;
+import org.gatein.pc.api.invocation.PortletInvocation;
+
+/**
+ * The JBoss implementation of
<code>org.apache.portals.bridges.common.ServletContextProvider</code> use
thread local
+ * variables to keep the request associated with the current thread of execution.
+ *
+ * @author <a href="mailto:dr@vizuri.com">Swarn Dhaliwal</a>
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7226 $
+ */
+public class GateInServletContextProvider implements ServletContextProvider
+{
+
+ /** . */
+ private static final ThreadLocal local = new ThreadLocal();
+
+ static void set(BridgeInfo info)
+ {
+ local.set(info);
+ }
+
+ public static BridgeInfo get()
+ {
+ return (BridgeInfo)local.get();
+ }
+
+ /** @throws IllegalStateException if no bridge info is found */
+ public ServletContext getServletContext(GenericPortlet genericPortlet) throws
IllegalStateException
+ {
+ BridgeInfo info = ((BridgeInfo)local.get());
+ if (info == null)
+ {
+ throw new IllegalStateException("No bridge set");
+ }
+ return info.ctx;
+ }
+
+ /** @throws IllegalStateException if no bridge info is found */
+ public HttpServletRequest getHttpServletRequest(GenericPortlet genericPortlet,
PortletRequest portletRequest) throws IllegalStateException
+ {
+ BridgeInfo info = (BridgeInfo)GateInServletContextProvider.local.get();
+ if (info == null)
+ {
+ throw new IllegalStateException("No bridge set");
+ }
+ if (info.breq == null)
+ {
+ init(info);
+ }
+ return info.breq;
+ }
+
+ /** @throws IllegalStateException if no bridge info is found */
+ public HttpServletResponse getHttpServletResponse(GenericPortlet genericPortlet,
PortletResponse portletResponse) throws IllegalStateException
+ {
+ BridgeInfo info = (BridgeInfo)GateInServletContextProvider.local.get();
+ if (info == null)
+ {
+ throw new IllegalStateException("No bridge set");
+ }
+ if (info.breq == null)
+ {
+ init(info);
+ }
+ return info.bresp;
+ }
+
+ /** Lazy initialisation of the bridge info. */
+ private void init(BridgeInfo bridgeInfo)
+ {
+ bridgeInfo.breq = bridgeInfo.getInvocation().getDispatchedRequest();
+ bridgeInfo.bresp = new BridgeResponse(bridgeInfo);
+ }
+
+ public static class BridgeInfo
+ {
+ /** Servlet context of the dispatched application. */
+ private final PortletInvocation invocation;
+
+ /** Servlet context of the dispatched application. */
+ private final ServletContext ctx;
+
+ /** The bridge response. */
+ private HttpServletRequest breq;
+
+ /** The bridge response. */
+ private HttpServletResponse bresp;
+
+ public BridgeInfo(PortletInvocation invocation)
+ {
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
+
+ //
+ this.invocation = invocation;
+ this.ctx = container.getPortletApplication().getContext().getServletContext();
+ this.breq = null;
+ this.bresp = null;
+ }
+
+ public PortletInvocation getInvocation()
+ {
+ return invocation;
+ }
+ }
+}
Deleted:
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/JBossServletContextProvider.java
===================================================================
---
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/JBossServletContextProvider.java 2009-11-24
00:35:57 UTC (rev 775)
+++
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/JBossServletContextProvider.java 2009-11-24
08:31:03 UTC (rev 776)
@@ -1,139 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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.gatein.pc.bridge;
-
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletResponse;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.portals.bridges.common.ServletContextProvider;
-import org.gatein.pc.portlet.container.PortletContainer;
-import org.gatein.pc.portlet.container.ContainerPortletInvoker;
-import org.gatein.pc.api.invocation.PortletInvocation;
-
-/**
- * The JBoss implementation of
<code>org.apache.portals.bridges.common.ServletContextProvider</code> use
thread local
- * variables to keep the request associated with the current thread of execution.
- *
- * @author <a href="mailto:dr@vizuri.com">Swarn Dhaliwal</a>
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 7226 $
- */
-public class JBossServletContextProvider implements ServletContextProvider
-{
-
- /** . */
- private static final ThreadLocal local = new ThreadLocal();
-
- static void set(BridgeInfo info)
- {
- local.set(info);
- }
-
- public static BridgeInfo get()
- {
- return (BridgeInfo)local.get();
- }
-
- /** @throws IllegalStateException if no bridge info is found */
- public ServletContext getServletContext(GenericPortlet genericPortlet) throws
IllegalStateException
- {
- BridgeInfo info = ((BridgeInfo)local.get());
- if (info == null)
- {
- throw new IllegalStateException("No bridge set");
- }
- return info.ctx;
- }
-
- /** @throws IllegalStateException if no bridge info is found */
- public HttpServletRequest getHttpServletRequest(GenericPortlet genericPortlet,
PortletRequest portletRequest) throws IllegalStateException
- {
- BridgeInfo info = (BridgeInfo)JBossServletContextProvider.local.get();
- if (info == null)
- {
- throw new IllegalStateException("No bridge set");
- }
- if (info.breq == null)
- {
- init(info);
- }
- return info.breq;
- }
-
- /** @throws IllegalStateException if no bridge info is found */
- public HttpServletResponse getHttpServletResponse(GenericPortlet genericPortlet,
PortletResponse portletResponse) throws IllegalStateException
- {
- BridgeInfo info = (BridgeInfo)JBossServletContextProvider.local.get();
- if (info == null)
- {
- throw new IllegalStateException("No bridge set");
- }
- if (info.breq == null)
- {
- init(info);
- }
- return info.bresp;
- }
-
- /** Lazy initialisation of the bridge info. */
- private void init(BridgeInfo bridgeInfo)
- {
- bridgeInfo.breq = bridgeInfo.getInvocation().getDispatchedRequest();
- bridgeInfo.bresp = new BridgeResponse(bridgeInfo);
- }
-
- public static class BridgeInfo
- {
- /** Servlet context of the dispatched application. */
- private final PortletInvocation invocation;
-
- /** Servlet context of the dispatched application. */
- private final ServletContext ctx;
-
- /** The bridge response. */
- private HttpServletRequest breq;
-
- /** The bridge response. */
- private HttpServletResponse bresp;
-
- public BridgeInfo(PortletInvocation invocation)
- {
- PortletContainer container =
(PortletContainer)invocation.getAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
-
- //
- this.invocation = invocation;
- this.ctx = container.getPortletApplication().getContext().getServletContext();
- this.breq = null;
- this.bresp = null;
- }
-
- public PortletInvocation getInvocation()
- {
- return invocation;
- }
- }
-}