|
Struts example source code file (ActionAutowiringInterceptor.java)
The Struts ActionAutowiringInterceptor.java source code/*
* Copyright 2002-2006,2009 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.opensymphony.xwork2.spring.interceptor;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.opensymphony.xwork2.spring.SpringObjectFactory;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.web.context.WebApplicationContext;
/**
* <!-- START SNIPPET: description -->
* TODO: Give a description of the Interceptor.
* <!-- END SNIPPET: description -->
*
* <!-- START SNIPPET: parameters -->
* TODO: Describe the paramters for this Interceptor.
* <!-- END SNIPPET: parameters -->
*
* <!-- START SNIPPET: extending -->
* TODO: Discuss some possible extension of the Interceptor.
* <!-- END SNIPPET: extending -->
*
* <pre>
* <!-- START SNIPPET: example -->
* <!-- TODO: Describe how the Interceptor reference will effect execution -->
* <action name="someAction" class="com.examples.SomeAction">
* TODO: fill in the interceptor reference.
* <interceptor-ref name=""/>
* <result name="success">good_result.ftl</result>
* </action>
* <!-- END SNIPPET: example -->
* </pre>
*
* Autowires action classes to Spring beans. The strategy for autowiring the beans can be configured
* by setting the parameter on the interceptor. Actions that need access to the <code>ActionContext
* can implements the <code>ApplicationContextAware interface. The context will also be placed on
* the action context under the APPLICATION_CONTEXT attribute.
*
* @author Simon Stewart
* @author Eric Hauser
*/
public class ActionAutowiringInterceptor extends AbstractInterceptor implements ApplicationContextAware {
private static final Logger LOG = LoggerFactory.getLogger(ActionAutowiringInterceptor.class);
public static final String APPLICATION_CONTEXT = "com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor.applicationContext";
private boolean initialized = false;
private ApplicationContext context;
private SpringObjectFactory factory;
private Integer autowireStrategy;
/**
* @param autowireStrategy
*/
public void setAutowireStrategy(Integer autowireStrategy) {
this.autowireStrategy = autowireStrategy;
}
/**
* Looks for the <code>ApplicationContext under the attribute that the Spring listener sets in
* the servlet context. The configuration is done the first time here instead of in init() since the
* <code>ActionContext is not available during
Other Struts examples (source code examples)Here is a short list of links related to this Struts ActionAutowiringInterceptor.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.