001/* 002 * Copyright 2002-2012 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.mock.web.portlet; 018 019import javax.portlet.PortalContext; 020import javax.portlet.PortletContext; 021import javax.portlet.PortletMode; 022import javax.portlet.RenderRequest; 023import javax.portlet.WindowState; 024 025/** 026 * Mock implementation of the {@link javax.portlet.RenderRequest} interface. 027 * 028 * @author John A. Lewis 029 * @author Juergen Hoeller 030 * @since 2.0 031 */ 032public class MockRenderRequest extends MockPortletRequest implements RenderRequest { 033 034 /** 035 * Create a new MockRenderRequest with a default {@link MockPortalContext} 036 * and a default {@link MockPortletContext}. 037 * @see MockPortalContext 038 * @see MockPortletContext 039 */ 040 public MockRenderRequest() { 041 super(); 042 } 043 044 /** 045 * Create a new MockRenderRequest with a default {@link MockPortalContext} 046 * and a default {@link MockPortletContext}. 047 * @param portletMode the mode that the portlet runs in 048 */ 049 public MockRenderRequest(PortletMode portletMode) { 050 super(); 051 setPortletMode(portletMode); 052 } 053 054 /** 055 * Create a new MockRenderRequest with a default {@link MockPortalContext} 056 * and a default {@link MockPortletContext}. 057 * @param portletMode the mode that the portlet runs in 058 * @param windowState the window state to run the portlet in 059 */ 060 public MockRenderRequest(PortletMode portletMode, WindowState windowState) { 061 super(); 062 setPortletMode(portletMode); 063 setWindowState(windowState); 064 } 065 066 /** 067 * Create a new MockRenderRequest with a default {@link MockPortalContext}. 068 * @param portletContext the PortletContext that the request runs in 069 */ 070 public MockRenderRequest(PortletContext portletContext) { 071 super(portletContext); 072 } 073 074 /** 075 * Create a new MockRenderRequest. 076 * @param portalContext the PortletContext that the request runs in 077 * @param portletContext the PortletContext that the request runs in 078 */ 079 public MockRenderRequest(PortalContext portalContext, PortletContext portletContext) { 080 super(portalContext, portletContext); 081 } 082 083 084 @Override 085 protected String getLifecyclePhase() { 086 return RENDER_PHASE; 087 } 088 089 @Override 090 public String getETag() { 091 return getProperty(RenderRequest.ETAG); 092 } 093 094}