Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ShowEngine |
|
| 1.25;1.25 |
1 | // Copyright 2004, 2005 The Apache Software Foundation | |
2 | // | |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | // you may not use this file except in compliance with the License. | |
5 | // You may obtain a copy of the License at | |
6 | // | |
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
8 | // | |
9 | // Unless required by applicable law or agreed to in writing, software | |
10 | // distributed under the License is distributed on an "AS IS" BASIS, | |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | // See the License for the specific language governing permissions and | |
13 | // limitations under the License. | |
14 | ||
15 | package org.apache.tapestry.contrib.inspector; | |
16 | ||
17 | import java.util.Collections; | |
18 | import java.util.List; | |
19 | ||
20 | import org.apache.commons.fileupload.RequestContext; | |
21 | import org.apache.tapestry.BaseComponent; | |
22 | import org.apache.tapestry.event.PageBeginRenderListener; | |
23 | import org.apache.tapestry.event.PageEvent; | |
24 | import org.apache.tapestry.web.WebRequest; | |
25 | import org.apache.tapestry.web.WebSession; | |
26 | ||
27 | /** | |
28 | * Component of the {@link Inspector} page used to display the properties of the | |
29 | * {@link org.apache.tapestry.IEngine} as well as a serialized view of it. Also, the | |
30 | * {@link RequestContext} is dumped out. | |
31 | * | |
32 | * @author Howard Lewis Ship | |
33 | */ | |
34 | ||
35 | 0 | public abstract class ShowEngine extends BaseComponent implements PageBeginRenderListener |
36 | { | |
37 | // Injected | |
38 | public abstract WebRequest getRequest(); | |
39 | ||
40 | // Transient | |
41 | public abstract void setSessionAttributeNames(List names); | |
42 | ||
43 | // Transient | |
44 | public abstract void setSession(WebSession session); | |
45 | ||
46 | public void pageBeginRender(PageEvent event) | |
47 | { | |
48 | 0 | WebSession session = getRequest().getSession(false); |
49 | ||
50 | 0 | setSession(session); |
51 | ||
52 | 0 | setSessionAttributeNames(session == null ? Collections.EMPTY_LIST : session |
53 | .getAttributeNames()); | |
54 | 0 | } |
55 | ||
56 | } |