001// Copyright 2010 The Apache Software Foundation 002// 003// Licensed under the Apache License, Version 2.0 (the "License"); 004// you may not use this file except in compliance with the License. 005// You may obtain a copy of the License at 006// 007// http://www.apache.org/licenses/LICENSE-2.0 008// 009// Unless required by applicable law or agreed to in writing, software 010// distributed under the License is distributed on an "AS IS" BASIS, 011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012// See the License for the specific language governing permissions and 013// limitations under the License. 014 015package org.apache.tapestry5.services; 016 017/** 018 * An event handler method may return an instance of this class to trigger the rendering 019 * of a particular page without causing a redirect to that page. 020 * 021 * @since 5.2.0 022 * 023 */ 024public final class StreamPageContent 025{ 026 private final Class<?> pageClass; 027 private final Object[] pageActivationContext; 028 029 /** 030 * 031 * @param pageClass class of the page to render 032 */ 033 public StreamPageContent(final Class<?> pageClass) 034 { 035 this(pageClass, (Object[]) null); 036 } 037 038 /** 039 * 040 * @param pageClass class of the page to render 041 * @param pageActivationContext activation context of the page 042 */ 043 public StreamPageContent(final Class<?> pageClass, final Object... pageActivationContext) 044 { 045 super(); 046 this.pageClass = pageClass; 047 this.pageActivationContext = pageActivationContext; 048 } 049 050 /** 051 * Returns the class of the page to render. 052 */ 053 public Class<?> getPageClass() 054 { 055 return this.pageClass; 056 } 057 058 /** 059 * Returns the activation context of the page. 060 */ 061 public Object[] getPageActivationContext() 062 { 063 return this.pageActivationContext; 064 } 065}