01: /*
02: * $Id: JVMAction.java 484628 2006-12-08 15:03:59Z ddewolf $
03: *
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "License"); you may not use this file except in compliance
10: * with the License. You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing,
15: * software distributed under the License is distributed on an
16: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17: * KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations
19: * under the License.
20: */
21: package org.apache.struts2.showcase.xslt;
22:
23: import java.util.Map;
24: import java.util.Properties;
25:
26: import com.opensymphony.xwork2.ActionSupport;
27:
28: import org.apache.struts2.interceptor.ServletRequestAware;
29:
30: import javax.servlet.http.HttpServletRequest;
31:
32: public class JVMAction implements ServletRequestAware {
33:
34: private ImportantInfo info;
35: private Map<String, String> environment;
36:
37: /** Captured only to show that undesired data can creep into the result. */
38: private HttpServletRequest servletRequest;
39:
40: public String execute() {
41: environment = System.getenv();
42: Properties props = System.getProperties();
43:
44: String classpath = environment.get("CLASSPATH");
45: info = new ImportantInfo(classpath, props);
46:
47: return ActionSupport.SUCCESS;
48: }
49:
50: public HttpServletRequest getServletRequest() {
51: return servletRequest;
52: }
53:
54: public void setServletRequest(HttpServletRequest servletRequest) {
55: this .servletRequest = servletRequest;
56: }
57:
58: public Map<String, String> getEnvironment() {
59: return environment;
60: }
61:
62: public void setEnvironment(Map<String, String> environment) {
63: this .environment = environment;
64: }
65:
66: public ImportantInfo getInfo() {
67: return info;
68: }
69:
70: public void setInfo(ImportantInfo info) {
71: this .info = info;
72: }
73:
74: public class ImportantInfo {
75: private String classpath;
76: private Properties systemProperties;
77:
78: public ImportantInfo(String classpath, Properties properties) {
79: this .classpath = classpath;
80: this .systemProperties = properties;
81: }
82:
83: public String getClasspath() {
84: return classpath;
85: }
86:
87: public void setClasspath(String classpath) {
88: this .classpath = classpath;
89: }
90:
91: public Properties getSystemProperties() {
92: return systemProperties;
93: }
94:
95: public void setSystemProperties(Properties systemProperties) {
96: this.systemProperties = systemProperties;
97: }
98: }
99: }
|