Return-Path: Delivered-To: apmail-struts-commits-archive@locus.apache.org Received: (qmail 10079 invoked from network); 10 Aug 2007 14:05:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Aug 2007 14:05:45 -0000 Received: (qmail 10012 invoked by uid 500); 10 Aug 2007 14:05:43 -0000 Delivered-To: apmail-struts-commits-archive@struts.apache.org Received: (qmail 9701 invoked by uid 500); 10 Aug 2007 14:05:42 -0000 Mailing-List: contact commits-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list commits@struts.apache.org Received: (qmail 9692 invoked by uid 99); 10 Aug 2007 14:05:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Aug 2007 07:05:42 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Aug 2007 14:05:44 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 36CA51A981A; Fri, 10 Aug 2007 07:05:20 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r564599 - in /struts/struts2/trunk: apps/portlet/src/main/webapp/WEB-INF/ plugins/portlet/src/main/java/org/apache/struts2/portlet/context/ plugins/portlet/src/main/java/org/apache/struts2/portlet/result/ plugins/portlet/src/main/java/org/a... Date: Fri, 10 Aug 2007 14:05:19 -0000 To: commits@struts.apache.org From: nilsga@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070810140520.36CA51A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nilsga Date: Fri Aug 10 07:05:17 2007 New Revision: 564599 URL: http://svn.apache.org/viewvc?view=rev&rev=564599 Log: WW-2101 Removed PreparatorServlet - Replaced by mock servlet implementation classes in org.apache.struts2.portlet.servlet Removed: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/context/PreparatorServletTest.java Modified: struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/web.xml struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletResult.java struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/result/PortletResultTest.java Modified: struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/web.xml?view=diff&rev=564599&r1=564598&r2=564599 ============================================================================== --- struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/web.xml (original) +++ struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/web.xml Fri Aug 10 07:05:17 2007 @@ -1,16 +1,13 @@ - - - + - - - - contextConfigLocation - /WEB-INF/applicationContext*.xml - + + + contextConfigLocation + + /WEB-INF/applicationContext*.xml + + Struts2 @@ -21,28 +18,11 @@ Struts2 /* + + + org.springframework.web.context.ContextLoaderListener + + - - org.springframework.web.context.ContextLoaderListener - - - - org.apache.struts2.portlet.context.ServletContextHolderListener - - - - preparator - org.apache.struts2.portlet.context.PreparatorServlet - - - - dwr - uk.ltd.getahead.dwr.DWRServlet - - - - dwr - /dwr/* - Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletResult.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletResult.java?view=diff&rev=564599&r1=564598&r2=564599 ============================================================================== --- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletResult.java (original) +++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletResult.java Fri Aug 10 07:05:17 2007 @@ -180,20 +180,6 @@ res.setTitle(title); } LOG.debug("Location: " + finalLocation); - PortletRequestDispatcher preparator = cfg.getPortletContext() - .getNamedDispatcher("preparator"); - if(preparator == null) { - throw new PortletException("Cannot look up 'preparator' servlet. Make sure that you" + - "have configured it correctly in the web.xml file."); - } - new IncludeTemplate() { - protected void when(PortletException e) { - LOG.error("PortletException while dispatching to 'preparator' servlet", e); - } - protected void when(IOException e) { - LOG.error("IOException while dispatching to 'preparator' servlet", e); - } - }.include(preparator, req, res); PortletRequestDispatcher dispatcher = cfg.getPortletContext().getRequestDispatcher(finalLocation); if(dispatcher == null) { throw new PortletException("Could not locate dispatcher for '" + finalLocation + "'"); Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java?view=diff&rev=564599&r1=564598&r2=564599 ============================================================================== --- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java (original) +++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java Fri Aug 10 07:05:17 2007 @@ -99,7 +99,6 @@ private String defaultEncoding; private VelocityManager velocityManager; - public PortletVelocityResult() { super(); } @@ -160,7 +159,6 @@ */ public void executeRenderResult(String finalLocation, ActionInvocation invocation) throws Exception { - prepareServletActionContext(); ValueStack stack = ActionContext.getContext().getValueStack(); HttpServletRequest request = ServletActionContext.getRequest(); @@ -192,7 +190,7 @@ if (encoding != null) { contentType = contentType + ";charset=" + encoding; } - + response.setContentType(contentType); Template t = getTemplate(stack, velocityManager.getVelocityEngine(), invocation, finalLocation, encoding); @@ -202,8 +200,6 @@ Writer writer = new OutputStreamWriter(response.getOutputStream(), encoding); - response.setContentType(contentType); - t.merge(context, writer); // always flush the writer (we used to only flush it if this was a @@ -292,16 +288,5 @@ ValueStack stack, HttpServletRequest request, HttpServletResponse response, String location) { return velocityManager.createContext(stack, request, response); - } - - /** - * Prepares the servlet action context for this request - */ - private void prepareServletActionContext() throws PortletException, - IOException { - PortletRequestDispatcher disp = PortletActionContext.getPortletConfig() - .getPortletContext().getNamedDispatcher("preparator"); - disp.include(PortletActionContext.getRenderRequest(), - PortletActionContext.getRenderResponse()); } } Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java?view=diff&rev=564599&r1=564598&r2=564599 ============================================================================== --- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java (original) +++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java Fri Aug 10 07:05:17 2007 @@ -136,7 +136,6 @@ private void executeRenderResult(String location, ActionInvocation invocation) throws TemplateException, IOException, TemplateModelException, PortletException { - prepareServletActionContext(); this.location = location; this.invocation = invocation; this.configuration = getConfiguration(); @@ -162,17 +161,6 @@ postTemplateProcess(template, model); } } - } - - /** - * - */ - private void prepareServletActionContext() throws PortletException, - IOException { - PortletRequestDispatcher disp = PortletActionContext.getPortletConfig() - .getPortletContext().getNamedDispatcher("preparator"); - disp.include(PortletActionContext.getRenderRequest(), - PortletActionContext.getRenderResponse()); } /** Modified: struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/result/PortletResultTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/result/PortletResultTest.java?view=diff&rev=564599&r1=564598&r2=564599 ============================================================================== --- struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/result/PortletResultTest.java (original) +++ struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/result/PortletResultTest.java Fri Aug 10 07:05:17 2007 @@ -80,7 +80,6 @@ Mock mockRequest = mock(RenderRequest.class); Mock mockResponse = mock(RenderResponse.class); Mock mockRd = mock(PortletRequestDispatcher.class); - Mock mockPrep = mock(PortletRequestDispatcher.class); RenderRequest req = (RenderRequest)mockRequest.proxy(); RenderResponse res = (RenderResponse)mockResponse.proxy(); @@ -91,9 +90,7 @@ Constraint[] params = new Constraint[]{same(req), same(res)}; mockRd.expects(once()).method("include").with(params); - mockPrep.expects(once()).method("include").with(params); mockCtx.expects(once()).method("getRequestDispatcher").with(eq("/WEB-INF/pages/testPage.jsp")).will(returnValue(rd)); - mockCtx.expects(once()).method("getNamedDispatcher").with(eq("preparator")).will(returnValue(mockPrep.proxy())); mockResponse.expects(once()).method("setContentType").with(eq("text/html")); mockConfig.expects(once()).method("getPortletContext").will(returnValue(ctx)); @@ -207,7 +204,6 @@ Mock mockRequest = mock(RenderRequest.class); Mock mockResponse = mock(RenderResponse.class); Mock mockRd = mock(PortletRequestDispatcher.class); - Mock mockPrep = mock(PortletRequestDispatcher.class); RenderRequest req = (RenderRequest)mockRequest.proxy(); RenderResponse res = (RenderResponse)mockResponse.proxy(); @@ -217,9 +213,7 @@ Constraint[] params = new Constraint[]{same(req), same(res)}; mockRd.expects(once()).method("include").with(params); - mockPrep.expects(once()).method("include").with(params); mockCtx.expects(once()).method("getRequestDispatcher").with(eq("/WEB-INF/pages/testPage.jsp")).will(returnValue(rd)); - mockCtx.expects(once()).method("getNamedDispatcher").with(eq("preparator")).will(returnValue(mockPrep.proxy())); mockConfig.expects(once()).method("getPortletContext").will(returnValue(ctx)); mockRequest.stubs().method("getPortletMode").will(returnValue(PortletMode.VIEW));