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