01: /*
02: * $Id: SelectInclude.java 471754 2006-11-06 14:55:09Z husted $
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.struts.chain.commands;
22:
23: import org.apache.commons.logging.Log;
24: import org.apache.commons.logging.LogFactory;
25: import org.apache.struts.chain.contexts.ActionContext;
26: import org.apache.struts.config.ActionConfig;
27:
28: /**
29: * <p>Select and cache the include for this <code>ActionConfig</code> if
30: * specified.</p>
31: *
32: * @version $Rev: 471754 $ $Date: 2005-06-04 10:58:46 -0400 (Sat, 04 Jun 2005)
33: * $
34: */
35: public class SelectInclude extends ActionCommandBase {
36: // ------------------------------------------------------ Instance Variables
37:
38: /**
39: * <p> Provide Commons Logging instance for this class. </p>
40: */
41: private static final Log LOG = LogFactory
42: .getLog(SelectInclude.class);
43:
44: // ---------------------------------------------------------- Public Methods
45:
46: /**
47: * <p>Select and cache the include uri for this <code>ActionConfig</code>
48: * if specified.</p>
49: *
50: * @param actionCtx The <code>Context</code> for the current request
51: * @return <code>false</code> so that processing continues
52: * @throws Exception on any error
53: */
54: public boolean execute(ActionContext actionCtx) throws Exception {
55: // Acquire configuration objects that we need
56: ActionConfig actionConfig = actionCtx.getActionConfig();
57:
58: // Cache an include uri if found
59: String include = actionConfig.getInclude();
60:
61: if (include != null) {
62: if (LOG.isDebugEnabled()) {
63: LOG.debug("Including " + include);
64: }
65:
66: actionCtx.setInclude(include);
67: }
68:
69: return (false);
70: }
71: }
|