001 package org.codehaus.grails.portlets.container.pluto; 002 003 import org.codehaus.grails.portlets.container.PortletContainerAdapter; 004 import org.codehaus.grails.portlets.container.AbstractPortletContainerAdapter; 005 import org.apache.pluto.internal.impl.PortletContextImpl; 006 import org.apache.pluto.internal.impl.PortletConfigImpl; 007 import org.apache.pluto.internal.impl.PortletRequestImpl; 008 009 import javax.portlet.PortletContext; 010 import javax.portlet.PortletConfig; 011 import javax.portlet.PortletRequest; 012 import javax.portlet.PortletResponse; 013 import javax.servlet.ServletContext; 014 import javax.servlet.ServletConfig; 015 import javax.servlet.http.HttpServletRequest; 016 import javax.servlet.http.HttpSession; 017 import javax.servlet.http.HttpServletResponse; 018 019 /** 020 * @author Kenji Nakamura 021 */ 022 public class PlutoPortletContainerAdapter extends AbstractPortletContainerAdapter { 023 024 public ServletContext getServletContext(PortletContext context) throws UnsupportedOperationException { 025 return ((PortletContextImpl) context).getServletContext(); 026 } 027 028 public ServletConfig getServletConfig(PortletConfig config) throws UnsupportedOperationException { 029 return ((PortletConfigImpl) config).getServletConfig(); 030 } 031 032 public HttpServletRequest getHttpServletRequest(PortletRequest portletRequest) throws UnsupportedOperationException { 033 HttpServletRequest request = ((PortletRequestImpl)portletRequest).getHttpServletRequest(); 034 //Make sure we have an underlying http session and that it won't time out - PLUTO BUG 035 HttpSession session = request.getSession(true); 036 session.setMaxInactiveInterval(-1); 037 return request; 038 } 039 040 /** 041 * Returns the underlying HttpServletResponse. 042 * 043 * @param portletResponse portlet response 044 * @return http servlet request 045 * @throws UnsupportedOperationException thrown when the operation is not possible with the underlying portlet container 046 */ 047 public HttpServletResponse getHttpServletResponse(PortletResponse portletResponse) throws UnsupportedOperationException { 048 return (HttpServletResponse) portletResponse; 049 } 050 051 052 }