Author: thomas.heute(a)jboss.com
Date: 2007-10-12 09:23:21 -0400 (Fri, 12 Oct 2007)
New Revision: 8614
Removed:
modules/portlet/trunk/bridge/src/main/org/jboss/portal/portlet/bridge/BridgeRequest.java
Modified:
modules/portlet/trunk/bridge/src/main/org/jboss/portal/portlet/bridge/BridgeResponse.java
modules/portlet/trunk/bridge/src/main/org/jboss/portal/portlet/bridge/JBossServletContextProvider.java
Log:
Fix the bridge (Would need more testing)
Deleted:
modules/portlet/trunk/bridge/src/main/org/jboss/portal/portlet/bridge/BridgeRequest.java
===================================================================
---
modules/portlet/trunk/bridge/src/main/org/jboss/portal/portlet/bridge/BridgeRequest.java 2007-10-12
13:04:19 UTC (rev 8613)
+++
modules/portlet/trunk/bridge/src/main/org/jboss/portal/portlet/bridge/BridgeRequest.java 2007-10-12
13:23:21 UTC (rev 8614)
@@ -1,329 +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.jboss.portal.portlet.bridge;
-
-import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-
-import javax.portlet.PortletRequest;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletInputStream;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.security.Principal;
-import java.util.Enumeration;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 6862 $
- */
-public class BridgeRequest implements HttpServletRequest
-{
-
- protected final PortletRequest preq;
- protected final HttpServletRequest hreq;
-
- public BridgeRequest(JBossServletContextProvider.BridgeInfo info)
- {
- PortletInvocation invocation = info.getInvocation();
- this.hreq = invocation.getDispatchedRequest();
- this.preq = (PortletRequest)hreq.getAttribute("javax.portlet.request");
- }
-
- public String getProtocol()
- {
- return null;
- }
-
- public String getRemoteAddr()
- {
- return null;
- }
-
- public String getRemoteHost()
- {
- return null;
- }
-
- public String getRealPath(String s)
- {
- return null;
- }
-
- public StringBuffer getRequestURL()
- {
- return null;
- }
-
- public String getPathInfo()
- {
- return hreq.getPathInfo();
- }
-
- public String getQueryString()
- {
- return hreq.getQueryString();
- }
-
- public String getServletPath()
- {
- return hreq.getServletPath();
- }
-
- public String getRequestURI()
- {
- return hreq.getRequestURI();
- }
-
- public String getPathTranslated()
- {
- return hreq.getPathTranslated();
- }
-
- public String getScheme()
- {
- return preq.getScheme();
- }
-
- public String getServerName()
- {
- return preq.getServerName();
- }
-
- public int getServerPort()
- {
- return preq.getServerPort();
- }
-
- public Object getAttribute(String name)
- {
- return preq.getAttribute(name);
- }
-
- public Enumeration getAttributeNames()
- {
- return preq.getAttributeNames();
- }
-
- public void setAttribute(String name, Object value)
- {
- preq.setAttribute(name, value);
- }
-
- public void removeAttribute(String name)
- {
- preq.removeAttribute(name);
- }
-
- public Locale getLocale()
- {
- return preq.getLocale();
- }
-
- public Enumeration getLocales()
- {
- return preq.getLocales();
- }
-
- public boolean isSecure()
- {
- return preq.isSecure();
- }
-
- public String getAuthType()
- {
- return preq.getAuthType();
- }
-
- public String getContextPath()
- {
- return preq.getContextPath();
- }
-
- public String getRemoteUser()
- {
- return preq.getRemoteUser();
- }
-
- public Principal getUserPrincipal()
- {
- return preq.getUserPrincipal();
- }
-
- public String getRequestedSessionId()
- {
- return preq.getRequestedSessionId();
- }
-
- public boolean isRequestedSessionIdValid()
- {
- return preq.isRequestedSessionIdValid();
- }
-
- public String getParameter(String s)
- {
- return preq.getParameter(s);
- }
-
- public Enumeration getParameterNames()
- {
- return preq.getParameterNames();
- }
-
- public String[] getParameterValues(String s)
- {
- return preq.getParameterValues(s);
- }
-
- public Map getParameterMap()
- {
- return preq.getParameterMap();
- }
-
- public String getCharacterEncoding()
- {
- return null;
- }
-
- public void setCharacterEncoding(String s) throws UnsupportedEncodingException
- {
- }
-
- public int getContentLength()
- {
- return 0;
- }
-
- public String getContentType()
- {
- return null;
- }
-
- public ServletInputStream getInputStream() throws IOException
- {
- return null;
- }
-
- public BufferedReader getReader() throws IOException
- {
- return null;
- }
-
- // Must be based on properties provided by the getProperties method of the
PortletRequest interface
-
- public String getHeader(String name)
- {
- return null;
- }
-
- public Enumeration getHeaders(String names)
- {
- return null;
- }
-
- public Enumeration getHeaderNames()
- {
- return null;
- }
-
- public Cookie[] getCookies()
- {
- return new Cookie[0];
- }
-
- public long getDateHeader(String s)
- {
- return 0;
- }
-
- public int getIntHeader(String s)
- {
- return 0;
- }
-
- public String getMethod()
- {
- return "GET";
- }
-
- public RequestDispatcher getRequestDispatcher(String s)
- {
- return hreq.getRequestDispatcher(s);
- }
-
- public boolean isUserInRole(String roleName)
- {
- return preq.isUserInRole(roleName);
- }
-
- public HttpSession getSession(boolean create)
- {
- return hreq.getSession(create);
- }
-
- public HttpSession getSession()
- {
- return hreq.getSession();
- }
-
- public boolean isRequestedSessionIdFromCookie()
- {
- return false;
- }
-
- public boolean isRequestedSessionIdFromURL()
- {
- return false;
- }
-
- public boolean isRequestedSessionIdFromUrl()
- {
- return false;
- }
-
- public int getRemotePort()
- {
- throw new UnsupportedOperationException("NYI");
- }
-
- public String getLocalName()
- {
- throw new UnsupportedOperationException("NYI");
- }
-
- public String getLocalAddr()
- {
- throw new UnsupportedOperationException("NYI");
- }
-
- public int getLocalPort()
- {
- throw new UnsupportedOperationException("NYI");
- }
-}
Modified:
modules/portlet/trunk/bridge/src/main/org/jboss/portal/portlet/bridge/BridgeResponse.java
===================================================================
---
modules/portlet/trunk/bridge/src/main/org/jboss/portal/portlet/bridge/BridgeResponse.java 2007-10-12
13:04:19 UTC (rev 8613)
+++
modules/portlet/trunk/bridge/src/main/org/jboss/portal/portlet/bridge/BridgeResponse.java 2007-10-12
13:23:21 UTC (rev 8614)
@@ -22,24 +22,25 @@
******************************************************************************/
package org.jboss.portal.portlet.bridge;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Locale;
import javax.portlet.PortletResponse;
import javax.portlet.RenderResponse;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.Locale;
+import javax.servlet.http.HttpServletResponseWrapper;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 6862 $
*/
-public class BridgeResponse implements HttpServletResponse
+public class BridgeResponse extends HttpServletResponseWrapper
{
/** . */
@@ -53,6 +54,7 @@
public BridgeResponse(JBossServletContextProvider.BridgeInfo info)
{
+ super(info.getInvocation().getDispatchedResponse());
invocation = info.getInvocation();
HttpServletRequest hreq = invocation.getDispatchedRequest();
this.presp =
(PortletResponse)hreq.getAttribute("javax.portlet.response");
Modified:
modules/portlet/trunk/bridge/src/main/org/jboss/portal/portlet/bridge/JBossServletContextProvider.java
===================================================================
---
modules/portlet/trunk/bridge/src/main/org/jboss/portal/portlet/bridge/JBossServletContextProvider.java 2007-10-12
13:04:19 UTC (rev 8613)
+++
modules/portlet/trunk/bridge/src/main/org/jboss/portal/portlet/bridge/JBossServletContextProvider.java 2007-10-12
13:23:21 UTC (rev 8614)
@@ -22,11 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.bridge;
-import org.apache.portals.bridges.common.ServletContextProvider;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.container.PortletContainerInvoker;
-import org.jboss.portal.portlet.container.PortletContainer;
-
import javax.portlet.GenericPortlet;
import javax.portlet.PortletRequest;
import javax.portlet.PortletResponse;
@@ -34,6 +29,11 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.portals.bridges.common.ServletContextProvider;
+import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.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.
@@ -102,7 +102,7 @@
/** Lazy initialisation of the bridge info. */
private void init(BridgeInfo bridgeInfo)
{
- bridgeInfo.breq = new BridgeRequest(bridgeInfo);
+ bridgeInfo.breq = bridgeInfo.getInvocation().getDispatchedRequest();
bridgeInfo.bresp = new BridgeResponse(bridgeInfo);
}
@@ -115,10 +115,10 @@
private final ServletContext ctx;
/** The bridge response. */
- private BridgeRequest breq;
+ private HttpServletRequest breq;
/** The bridge response. */
- private BridgeResponse bresp;
+ private HttpServletResponse bresp;
public BridgeInfo(PortletInvocation invocation)
{