本文整理汇总了Java中com.opensymphony.xwork2.config.entities.PackageConfig类的典型用法代码示例。如果您正苦于以下问题:Java PackageConfig类的具体用法?Java PackageConfig怎么用?Java PackageConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PackageConfig类属于com.opensymphony.xwork2.config.entities包,在下文中一共展示了PackageConfig类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: loadInterceptors
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
protected void loadInterceptors(PackageConfig.Builder context, Element element) throws ConfigurationException {
NodeList interceptorList = element.getElementsByTagName("interceptor");
for (int i = 0; i < interceptorList.getLength(); i++) {
Element interceptorElement = (Element) interceptorList.item(i);
String name = interceptorElement.getAttribute("name");
String className = interceptorElement.getAttribute("class");
Map<String, String> params = XmlHelper.getParams(interceptorElement);
InterceptorConfig config = new InterceptorConfig.Builder(name, className)
.addParams(params)
.location(DomHelper.getLocationObject(interceptorElement))
.build();
context.addInterceptorConfig(config);
}
loadInterceptorStacks(element, context);
}
开发者ID:txazo,项目名称:struts2,代码行数:20,代码来源:XmlConfigurationProvider.java
示例2: getSystemAuthorities
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
@Override
public Collection<String> getSystemAuthorities()
{
HashSet<String> authorities = new HashSet<>();
Configuration configuration = Dispatcher.getInstance().getConfigurationManager().getConfiguration();
for ( PackageConfig packageConfig : configuration.getPackageConfigs().values() )
{
for ( ActionConfig actionConfig : packageConfig.getActionConfigs().values() )
{
authorities.addAll( requiredAuthoritiesProvider.getAllAuthorities( actionConfig ) );
}
}
return authorities;
}
开发者ID:dhis2,项目名称:dhis2-core,代码行数:18,代码来源:DetectingSystemAuthoritiesProvider.java
示例3: loadPackages
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
/**
* load packages from given bundle.
*
* @param bundle the OSGi bundle to load from
* @param objectFactory ObjectFactory to use for creating instances
* @param pkgConfigs existing package configurations
* @return list of new package configurations loaded
*
* @throws ConfigurationException on error
*/
public List<PackageConfig> loadPackages(Bundle bundle, ObjectFactory objectFactory,
Map<String, PackageConfig> pkgConfigs) throws ConfigurationException {
final Configuration config = new DefaultConfiguration("struts.xml");
final BundleConfigurationProvider prov = new BundleConfigurationProvider("struts.xml", bundle);
for (final PackageConfig pkg : pkgConfigs.values()) {
config.addPackageConfig(pkg.getName(), pkg);
}
prov.setObjectFactory(objectFactory);
prov.init(config);
prov.loadPackages();
final List<PackageConfig> list = new ArrayList<PackageConfig>(config.getPackageConfigs().values());
list.removeAll(pkgConfigs.values());
return list;
}
开发者ID:NCIP,项目名称:caarray,代码行数:27,代码来源:BundlePackageLoader.java
示例4: buildParentsFromString
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
/**
* Get the {@link PackageConfig} elements with the specified names.
* @param configuration Configuration from which to find the package elements
* @param parent Comma separated list of parent package names
* @return The package elements that correspond to the names in the {@code parent} parameter.
*/
public static List<PackageConfig> buildParentsFromString(Configuration configuration, String parent) {
List<String> parentPackageNames = buildParentListFromString(parent);
List<PackageConfig> parentPackageConfigs = new ArrayList<>();
for (String parentPackageName : parentPackageNames) {
PackageConfig parentPackageContext = configuration.getPackageConfig(parentPackageName);
if (parentPackageContext != null) {
parentPackageConfigs.add(parentPackageContext);
}
}
return parentPackageConfigs;
}
开发者ID:txazo,项目名称:struts2,代码行数:20,代码来源:ConfigurationUtil.java
示例5: reloadRequiredPackages
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
private void reloadRequiredPackages(List<Element> reloads) {
if (reloads.size() > 0) {
List<Element> result = new ArrayList<>();
for (Element pkg : reloads) {
PackageConfig cfg = addPackage(pkg);
if (cfg.isNeedsRefresh()) {
result.add(pkg);
}
}
if ((result.size() > 0) && (result.size() != reloads.size())) {
reloadRequiredPackages(result);
return;
}
// Print out error messages for all misconfigured inheritance packages
if (result.size() > 0) {
for (Element rp : result) {
String parent = rp.getAttribute("extends");
if (parent != null) {
List<PackageConfig> parents = ConfigurationUtil.buildParentsFromString(configuration, parent);
if (parents != null && parents.size() <= 0) {
LOG.error("Unable to find parent packages {}", parent);
}
}
}
}
}
}
开发者ID:txazo,项目名称:struts2,代码行数:29,代码来源:XmlConfigurationProvider.java
示例6: addResultTypes
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
protected void addResultTypes(PackageConfig.Builder packageContext, Element element) {
NodeList resultTypeList = element.getElementsByTagName("result-type");
for (int i = 0; i < resultTypeList.getLength(); i++) {
Element resultTypeElement = (Element) resultTypeList.item(i);
String name = resultTypeElement.getAttribute("name");
String className = resultTypeElement.getAttribute("class");
String def = resultTypeElement.getAttribute("default");
Location loc = DomHelper.getLocationObject(resultTypeElement);
Class clazz = verifyResultType(className, loc);
if (clazz != null) {
String paramName = null;
try {
paramName = (String) clazz.getField("DEFAULT_PARAM").get(null);
} catch (Throwable t) {
LOG.debug("The result type [{}] doesn't have a default param [DEFAULT_PARAM] defined!", className, t);
}
ResultTypeConfig.Builder resultType = new ResultTypeConfig.Builder(name, className).defaultResultParam(paramName)
.location(DomHelper.getLocationObject(resultTypeElement));
Map<String, String> params = XmlHelper.getParams(resultTypeElement);
if (!params.isEmpty()) {
resultType.addParams(params);
}
packageContext.addResultTypeConfig(resultType.build());
// set the default result type
if (BooleanUtils.toBoolean(def)) {
packageContext.defaultResultType(name);
}
}
}
}
开发者ID:txazo,项目名称:struts2,代码行数:37,代码来源:XmlConfigurationProvider.java
示例7: buildInterceptorList
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
protected List<InterceptorMapping> buildInterceptorList(Element element, PackageConfig.Builder context) throws ConfigurationException {
List<InterceptorMapping> interceptorList = new ArrayList<>();
NodeList interceptorRefList = element.getElementsByTagName("interceptor-ref");
for (int i = 0; i < interceptorRefList.getLength(); i++) {
Element interceptorRefElement = (Element) interceptorRefList.item(i);
if (interceptorRefElement.getParentNode().equals(element) || interceptorRefElement.getParentNode().getNodeName().equals(element.getNodeName())) {
List<InterceptorMapping> interceptors = lookupInterceptorReference(context, interceptorRefElement);
interceptorList.addAll(interceptors);
}
}
return interceptorList;
}
开发者ID:txazo,项目名称:struts2,代码行数:16,代码来源:XmlConfigurationProvider.java
示例8: buildExceptionMappings
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
/**
* Build a list of exception mapping objects from below a given XML element.
*
* @param element the given XML element
* @param packageContext the package context
*
* @return list of exception mapping config objects
*/
protected List<ExceptionMappingConfig> buildExceptionMappings(Element element, PackageConfig.Builder packageContext) {
NodeList exceptionMappingEls = element.getElementsByTagName("exception-mapping");
List<ExceptionMappingConfig> exceptionMappings = new ArrayList<>();
for (int i = 0; i < exceptionMappingEls.getLength(); i++) {
Element ehElement = (Element) exceptionMappingEls.item(i);
if (ehElement.getParentNode().equals(element) || ehElement.getParentNode().getNodeName().equals(element.getNodeName())) {
String emName = ehElement.getAttribute("name");
String exceptionClassName = ehElement.getAttribute("exception");
String exceptionResult = ehElement.getAttribute("result");
Map<String, String> params = XmlHelper.getParams(ehElement);
if (StringUtils.isEmpty(emName)) {
emName = exceptionResult;
}
ExceptionMappingConfig ehConfig = new ExceptionMappingConfig.Builder(emName, exceptionClassName, exceptionResult)
.addParams(params)
.location(DomHelper.getLocationObject(ehElement))
.build();
exceptionMappings.add(ehConfig);
}
}
return exceptionMappings;
}
开发者ID:txazo,项目名称:struts2,代码行数:38,代码来源:XmlConfigurationProvider.java
示例9: buildAllowedMethods
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
protected Set<String> buildAllowedMethods(Element element, PackageConfig.Builder packageContext) {
NodeList allowedMethodsEls = element.getElementsByTagName("allowed-methods");
Set<String> allowedMethods;
if (allowedMethodsEls.getLength() > 0) {
// user defined 'allowed-methods' so used them whatever Strict DMI was enabled or not
allowedMethods = new HashSet<>(packageContext.getGlobalAllowedMethods());
if (allowedMethodsEls.getLength() > 0) {
Node n = allowedMethodsEls.item(0).getFirstChild();
if (n != null) {
String s = n.getNodeValue().trim();
if (s.length() > 0) {
allowedMethods.addAll(TextParseUtil.commaDelimitedStringToSet(s));
}
}
}
} else if (packageContext.isStrictMethodInvocation()) {
// user enabled Strict DMI but didn't defined action specific 'allowed-methods' so we use 'global-allowed-methods' only
allowedMethods = new HashSet<>(packageContext.getGlobalAllowedMethods());
} else {
// Strict DMI is disabled so any method can be called
allowedMethods = new HashSet<>();
allowedMethods.add(ActionConfig.WILDCARD);
}
LOG.debug("Collected allowed methods: {}", allowedMethods);
return Collections.unmodifiableSet(allowedMethods);
}
开发者ID:txazo,项目名称:struts2,代码行数:31,代码来源:XmlConfigurationProvider.java
示例10: loadDefaultInterceptorRef
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
protected void loadDefaultInterceptorRef(PackageConfig.Builder packageContext, Element element) {
NodeList resultTypeList = element.getElementsByTagName("default-interceptor-ref");
if (resultTypeList.getLength() > 0) {
Element defaultRefElement = (Element) resultTypeList.item(0);
packageContext.defaultInterceptorRef(defaultRefElement.getAttribute("name"));
}
}
开发者ID:txazo,项目名称:struts2,代码行数:9,代码来源:XmlConfigurationProvider.java
示例11: loadDefaultActionRef
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
protected void loadDefaultActionRef(PackageConfig.Builder packageContext, Element element) {
NodeList resultTypeList = element.getElementsByTagName("default-action-ref");
if (resultTypeList.getLength() > 0) {
Element defaultRefElement = (Element) resultTypeList.item(0);
packageContext.defaultActionRef(defaultRefElement.getAttribute("name"));
}
}
开发者ID:txazo,项目名称:struts2,代码行数:9,代码来源:XmlConfigurationProvider.java
示例12: loadGlobalResults
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
/**
* Load all of the global results for this package from the XML element.
*
* @param packageContext the package context
* @param packageElement the given XML element
*/
protected void loadGlobalResults(PackageConfig.Builder packageContext, Element packageElement) {
NodeList globalResultList = packageElement.getElementsByTagName("global-results");
if (globalResultList.getLength() > 0) {
Element globalResultElement = (Element) globalResultList.item(0);
Map<String, ResultConfig> results = buildResults(globalResultElement, packageContext);
packageContext.addGlobalResultConfigs(results);
}
}
开发者ID:txazo,项目名称:struts2,代码行数:16,代码来源:XmlConfigurationProvider.java
示例13: loadGlobalAllowedMethods
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
protected void loadGlobalAllowedMethods(PackageConfig.Builder packageContext, Element packageElement) {
NodeList globalAllowedMethodsElms = packageElement.getElementsByTagName("global-allowed-methods");
if (globalAllowedMethodsElms.getLength() > 0) {
Set<String> globalAllowedMethods = new HashSet<>();
Node n = globalAllowedMethodsElms.item(0).getFirstChild();
if (n != null) {
String s = n.getNodeValue().trim();
if (s.length() > 0) {
globalAllowedMethods = TextParseUtil.commaDelimitedStringToSet(s);
}
}
packageContext.addGlobalAllowedMethods(globalAllowedMethods);
}
}
开发者ID:txazo,项目名称:struts2,代码行数:16,代码来源:XmlConfigurationProvider.java
示例14: loadDefaultClassRef
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
protected void loadDefaultClassRef(PackageConfig.Builder packageContext, Element element) {
NodeList defaultClassRefList = element.getElementsByTagName("default-class-ref");
if (defaultClassRefList.getLength() > 0) {
Element defaultClassRefElement = (Element) defaultClassRefList.item(0);
packageContext.defaultClassRef(defaultClassRefElement.getAttribute("class"));
}
}
开发者ID:txazo,项目名称:struts2,代码行数:8,代码来源:XmlConfigurationProvider.java
示例15: loadGlobalExceptionMappings
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
/**
* Load all of the global results for this package from the XML element.
*
* @param packageContext the package context
* @param packageElement the given XML element
*/
protected void loadGlobalExceptionMappings(PackageConfig.Builder packageContext, Element packageElement) {
NodeList globalExceptionMappingList = packageElement.getElementsByTagName("global-exception-mappings");
if (globalExceptionMappingList.getLength() > 0) {
Element globalExceptionMappingElement = (Element) globalExceptionMappingList.item(0);
List<ExceptionMappingConfig> exceptionMappings = buildExceptionMappings(globalExceptionMappingElement, packageContext);
packageContext.addGlobalExceptionMappingConfigs(exceptionMappings);
}
}
开发者ID:txazo,项目名称:struts2,代码行数:16,代码来源:XmlConfigurationProvider.java
示例16: loadInterceptorStack
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
protected InterceptorStackConfig loadInterceptorStack(Element element, PackageConfig.Builder context) throws ConfigurationException {
String name = element.getAttribute("name");
InterceptorStackConfig.Builder config = new InterceptorStackConfig.Builder(name)
.location(DomHelper.getLocationObject(element));
NodeList interceptorRefList = element.getElementsByTagName("interceptor-ref");
for (int j = 0; j < interceptorRefList.getLength(); j++) {
Element interceptorRefElement = (Element) interceptorRefList.item(j);
List<InterceptorMapping> interceptors = lookupInterceptorReference(context, interceptorRefElement);
config.addInterceptors(interceptors);
}
return config.build();
}
开发者ID:txazo,项目名称:struts2,代码行数:16,代码来源:XmlConfigurationProvider.java
示例17: loadInterceptorStacks
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
protected void loadInterceptorStacks(Element element, PackageConfig.Builder context) throws ConfigurationException {
NodeList interceptorStackList = element.getElementsByTagName("interceptor-stack");
for (int i = 0; i < interceptorStackList.getLength(); i++) {
Element interceptorStackElement = (Element) interceptorStackList.item(i);
InterceptorStackConfig config = loadInterceptorStack(interceptorStackElement, context);
context.addInterceptorStackConfig(config);
}
}
开发者ID:txazo,项目名称:struts2,代码行数:12,代码来源:XmlConfigurationProvider.java
示例18: getPackageConfigs
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
private Collection<PackageConfig> getPackageConfigs()
{
Configuration configuration = Dispatcher.getInstance().getConfigurationManager().getConfiguration();
Map<String, PackageConfig> packageConfigs = configuration.getPackageConfigs();
return packageConfigs.values();
}
开发者ID:dhis2,项目名称:dhis2-core,代码行数:9,代码来源:DefaultModuleManager.java
示例19: build
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
@Override
public List<InterceptorMapping> build(Class<?> actionClass, PackageConfig.Builder builder, String actionName,
Action annotation) {
List<InterceptorMapping> interceptorList = new ArrayList<>(10);
// from @InterceptorRefs annotation
InterceptorRefs interceptorRefs = AnnotationUtils.findAnnotation(actionClass, InterceptorRefs.class);
if (interceptorRefs != null) {
interceptorList.addAll(build(actionClass, interceptorRefs.value(), actionName, builder));
}
// from @InterceptorRef annotation
InterceptorRef interceptorRef = AnnotationUtils.findAnnotation(actionClass, InterceptorRef.class);
if (interceptorRef != null) {
interceptorList.addAll(build(actionClass, new InterceptorRef[] { interceptorRef }, actionName, builder));
}
// from @Action annotation
if (annotation != null) {
InterceptorRef[] interceptors = annotation.interceptorRefs();
if (interceptors != null) {
interceptorList.addAll(build(actionClass, interceptors, actionName, builder));
}
}
return interceptorList;
}
开发者ID:SmarterApp,项目名称:TechnologyReadinessTool,代码行数:28,代码来源:ScopeInterceptorMapBuilder.java
示例20: cleanup
import com.opensymphony.xwork2.config.entities.PackageConfig; //导入依赖的package包/类
/**
* Releases all instances bound to this dispatcher instance.
*/
public void cleanup() {
// clean up ObjectFactory
ObjectFactory objectFactory = getContainer().getInstance(ObjectFactory.class);
if (objectFactory == null) {
LOG.warn("Object Factory is null, something is seriously wrong, no clean up will be performed");
}
if (objectFactory instanceof ObjectFactoryDestroyable) {
try {
((ObjectFactoryDestroyable)objectFactory).destroy();
}
catch(Exception e) {
// catch any exception that may occurred during destroy() and log it
LOG.error("Exception occurred while destroying ObjectFactory [{}]", objectFactory.toString(), e);
}
}
// clean up Dispatcher itself for this thread
instance.set(null);
// clean up DispatcherListeners
if (!dispatcherListeners.isEmpty()) {
for (DispatcherListener l : dispatcherListeners) {
l.dispatcherDestroyed(this);
}
}
// clean up all interceptors by calling their destroy() method
Set<Interceptor> interceptors = new HashSet<>();
Collection<PackageConfig> packageConfigs = configurationManager.getConfiguration().getPackageConfigs().values();
for (PackageConfig packageConfig : packageConfigs) {
for (Object config : packageConfig.getAllInterceptorConfigs().values()) {
if (config instanceof InterceptorStackConfig) {
for (InterceptorMapping interceptorMapping : ((InterceptorStackConfig) config).getInterceptors()) {
interceptors.add(interceptorMapping.getInterceptor());
}
}
}
}
for (Interceptor interceptor : interceptors) {
interceptor.destroy();
}
// Clear container holder when application is unloaded / server shutdown
ContainerHolder.clear();
//cleanup action context
ActionContext.setContext(null);
// clean up configuration
configurationManager.destroyConfiguration();
configurationManager = null;
}
开发者ID:txazo,项目名称:struts2,代码行数:57,代码来源:Dispatcher.java
注:本文中的com.opensymphony.xwork2.config.entities.PackageConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论