001// Copyright 2004, 2005 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.tapestry.contrib.inspector; 016 017import java.util.Collections; 018import java.util.List; 019 020import org.apache.tapestry.BaseComponent; 021import org.apache.tapestry.event.PageBeginRenderListener; 022import org.apache.tapestry.event.PageEvent; 023import org.apache.tapestry.web.WebRequest; 024import org.apache.tapestry.web.WebSession; 025 026/** 027 * Component of the {@link Inspector} page used to display the properties of the 028 * {@link org.apache.tapestry.IEngine} as well as a serialized view of it. Also, the 029 * {@link org.apache.tapestry.request.RequestContext} is dumped out. 030 * 031 * @author Howard Lewis Ship 032 */ 033 034public abstract class ShowEngine extends BaseComponent implements PageBeginRenderListener 035{ 036 // Injected 037 public abstract WebRequest getRequest(); 038 039 // Transient 040 public abstract void setSessionAttributeNames(List names); 041 042 // Transient 043 public abstract void setSession(WebSession session); 044 045 public void pageBeginRender(PageEvent event) 046 { 047 WebSession session = getRequest().getSession(false); 048 049 setSession(session); 050 051 setSessionAttributeNames(session == null ? Collections.EMPTY_LIST : session 052 .getAttributeNames()); 053 } 054 055}