1 16 19 20 package org.apache.pluto.core.impl; 21 22 import java.util.Map ; 23 24 import javax.portlet.PortletException; 25 import javax.portlet.PortletRequestDispatcher; 26 import javax.portlet.RenderRequest; 27 import javax.portlet.RenderResponse; 28 import javax.servlet.RequestDispatcher ; 29 30 import org.apache.pluto.core.CoreUtils; 31 import org.apache.pluto.core.InternalPortletRequest; 32 import org.apache.pluto.core.InternalPortletResponse; 33 34 public class PortletRequestDispatcherImpl implements PortletRequestDispatcher 35 { 36 37 private RequestDispatcher requestDispatcher; 38 private Map queryParams; 39 40 public PortletRequestDispatcherImpl(RequestDispatcher requestDispatcher) 41 { 42 this.requestDispatcher = requestDispatcher; 43 } 44 45 public PortletRequestDispatcherImpl(RequestDispatcher disp, Map queryParams) { 46 this(disp); 47 this.queryParams = queryParams; 48 49 } 50 51 public void include(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException 53 { 54 InternalPortletRequest internalRequest = CoreUtils.getInternalRequest(request); 55 InternalPortletResponse internalResponse = CoreUtils.getInternalResponse(response); 56 57 if(queryParams!=null) { 58 internalRequest = new IncludedRenderRequestImpl(internalRequest, queryParams); 59 } 60 try 61 { 62 internalRequest.setIncluded(true); 63 internalResponse.setIncluded(true); 64 65 this.requestDispatcher.include((javax.servlet.http.HttpServletRequest )request, 66 (javax.servlet.http.HttpServletResponse )response); 67 } 68 catch (java.io.IOException e) 69 { 70 throw e; 71 } 72 catch (javax.servlet.ServletException e) 73 { 74 if (e.getRootCause()!=null) 75 { 76 throw new PortletException(e.getRootCause()); 77 } 78 else 79 { 80 throw new PortletException(e); 81 } 82 } 83 finally 84 { 85 internalRequest.setIncluded(false); 86 internalResponse.setIncluded(false); 87 } 88 } 89 91 103 } 104 | Popular Tags |