1 /*
2 * $Id$
3 *
4 * Copyright 2007 The Apache Software Foundation.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package org.apache.struts.chain.commands.servlet;
19
20 import jakarta.servlet.http.HttpServletRequest;
21
22 import org.apache.struts.Globals;
23 import org.apache.struts.chain.commands.ActionCommandBase;
24 import org.apache.struts.chain.contexts.ActionContext;
25 import org.apache.struts.chain.contexts.ServletActionContext;
26
27 /**
28 * <p>Performs post-processing functions in command chain</p>
29 *
30 * @version $Rev$ $Date$
31 * @since Struts 1.4
32 */
33 public class ActionPostProcess extends ActionCommandBase {
34
35 /**
36 * <p>Performs additional functions after an Action or Command
37 * has been called.</p>
38 *
39 * @param context The <code>Context</code> for the current request
40 * @return <code>false</code> so that processing continues
41 * @throws Exception on any error
42 */
43 @Override
44 protected boolean execute_(ActionContext context) throws Exception {
45
46 ServletActionContext saContext = (ServletActionContext) context;
47 HttpServletRequest request = saContext.getRequest();
48
49 // Set flag in request object, notifying chained actions that
50 // this request was already processed.
51 request.setAttribute(Globals.CHAIN_KEY, Boolean.TRUE);
52
53 // Continue chain processing
54 return CONTINUE_PROCESSING;
55 }
56 }