本文整理汇总了Java中net.sourceforge.stripes.config.BootstrapPropertyResolver类的典型用法代码示例。如果您正苦于以下问题:Java BootstrapPropertyResolver类的具体用法?Java BootstrapPropertyResolver怎么用?Java BootstrapPropertyResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BootstrapPropertyResolver类属于net.sourceforge.stripes.config包,在下文中一共展示了BootstrapPropertyResolver类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: findClasses
点赞 3
import net.sourceforge.stripes.config.BootstrapPropertyResolver; //导入依赖的package包/类
/**
* Helper method to find implementations of ActionBean in the packages specified in
* Configuration using the {@link ResolverUtil} class.
*
* @return a set of Class objects that represent subclasses of ActionBean
*/
protected Set<Class<? extends ActionBean>> findClasses() {
BootstrapPropertyResolver bootstrap = getConfiguration().getBootstrapPropertyResolver();
String packages = bootstrap.getProperty(PACKAGES);
if (packages == null) {
throw new StripesRuntimeException(
"You must supply a value for the configuration parameter '" + PACKAGES + "'. The " +
"value should be a list of one or more package roots (comma separated) that are " +
"to be scanned for ActionBean implementations. The packages specified and all " +
"subpackages are examined for implementations of ActionBean."
);
}
String[] pkgs = StringUtil.standardSplit(packages);
ResolverUtil<ActionBean> resolver = new ResolverUtil<ActionBean>();
resolver.findImplementations(ActionBean.class, pkgs);
return resolver.getClasses();
}
开发者ID:nkasvosve,
项目名称:beyondj,
代码行数:25,
代码来源:AnnotatedClassActionResolver.java
示例2: findClasses
点赞 3
import net.sourceforge.stripes.config.BootstrapPropertyResolver; //导入依赖的package包/类
/**
* Helper method to find implementations of ActionBean in the packages
* specified in Configuration using the {@link ResolverUtil} class.
*
* @return a set of Class objects that represent subclasses of ActionBean
*/
protected Set<Class<? extends ActionBean>> findClasses() {
BootstrapPropertyResolver bootstrap = getConfiguration().getBootstrapPropertyResolver();
String packages = bootstrap.getProperty(PACKAGES);
if (packages == null) {
throw new StripesRuntimeException("You must supply a value for the configuration parameter '" + PACKAGES
+ "'. The " + "value should be a list of one or more package roots (comma separated) that are "
+ "to be scanned for ActionBean implementations. The packages specified and all "
+ "subpackages are examined for implementations of ActionBean.");
}
String[] pkgs = StringUtil.standardSplit(packages);
ResolverUtil<ActionBean> resolver = new ResolverUtil<ActionBean>();
resolver.findImplementations(ActionBean.class, pkgs);
return resolver.getClasses();
}
开发者ID:geetools,
项目名称:geeCommerce-Java-Shop-Software-and-PIM,
代码行数:23,
代码来源:AnnotatedClassActionResolver.java
示例3: createConfiguration
点赞 2
import net.sourceforge.stripes.config.BootstrapPropertyResolver; //导入依赖的package包/类
/**
* Create and configure a new {@link Configuration} instance using the suppied
* {@link FilterConfig}.
*
* @param filterConfig The filter configuration supplied by the container.
* @return The new configuration instance.
* @throws ServletException If the configuration cannot be created.
*/
protected static Configuration createConfiguration(FilterConfig filterConfig)
throws ServletException {
BootstrapPropertyResolver bootstrap = new BootstrapPropertyResolver(filterConfig);
// Set up the Configuration - if one isn't found by the bootstrapper then
// we'll just use the default: RuntimeConfiguration
Class<? extends Configuration> clazz = bootstrap.getClassProperty(CONFIG_CLASS,
Configuration.class);
if (clazz == null)
clazz = RuntimeConfiguration.class;
try {
Configuration configuration = clazz.newInstance();
configuration.setBootstrapPropertyResolver(bootstrap);
configuration.init();
return configuration;
}
catch (Exception e) {
log.fatal(e,
"Could not instantiate specified Configuration. Class name specified was ",
"[", clazz.getName(), "].");
throw new StripesServletException("Could not instantiate specified Configuration. "
+ "Class name specified was [" + clazz.getName() + "].", e);
}
}
开发者ID:nkasvosve,
项目名称:beyondj,
代码行数:35,
代码来源:StripesFilter.java
示例4: findClasses
点赞 2
import net.sourceforge.stripes.config.BootstrapPropertyResolver; //导入依赖的package包/类
/**
* Helper method to find implementations of AutoExceptionHandler in the packages specified in
* Configuration using the {@link ResolverUtil} class.
*
* @return a set of Class objects that represent subclasses of AutoExceptionHandler
*/
protected Set<Class<? extends AutoExceptionHandler>> findClasses() {
BootstrapPropertyResolver bootstrap = getConfiguration().getBootstrapPropertyResolver();
// Try the config param that is specific to this class
String[] packages = StringUtil.standardSplit(bootstrap.getProperty(PACKAGES));
if (packages == null || packages.length == 0) {
// Config param not found so try autodiscovery
log.info("No config parameter '", PACKAGES, "' found. Trying autodiscovery instead.");
List<Class<? extends AutoExceptionHandler>> classes = bootstrap
.getClassPropertyList(AutoExceptionHandler.class);
if (!classes.isEmpty()) {
return new HashSet<Class<? extends AutoExceptionHandler>>(classes);
}
else {
// Autodiscovery found nothing so resort to looking at the ActionBean packages
log.info("Autodiscovery found no implementations of AutoExceptionHandler. Using ",
"the value of '", AnnotatedClassActionResolver.PACKAGES, "' instead.");
packages = StringUtil.standardSplit(bootstrap
.getProperty(AnnotatedClassActionResolver.PACKAGES));
}
}
if (packages != null && packages.length > 0) {
ResolverUtil<AutoExceptionHandler> resolver = new ResolverUtil<AutoExceptionHandler>();
resolver.findImplementations(AutoExceptionHandler.class, packages);
return resolver.getClasses();
}
else {
return Collections.emptySet();
}
}
开发者ID:nkasvosve,
项目名称:beyondj,
代码行数:38,
代码来源:DelegatingExceptionHandler.java
示例5: init
点赞 2
import net.sourceforge.stripes.config.BootstrapPropertyResolver; //导入依赖的package包/类
/**
* Initialize the interceptor.
*
* @param configuration the configuration being used by Stripes
* @throws StripesRuntimeException if the security manager cannot be created
*/
public void init(Configuration configuration)
throws StripesRuntimeException
{
BootstrapPropertyResolver resolver = configuration.getBootstrapPropertyResolver();
// Instantiate the security manager.
try
{
// Ask the BootstrapPropertyResolver for a subclass of SecurityManager.
// BootstrapPropertyResolver will look in web.xml first then scan the
// classpath if the class wasn't specified in web.xml
Class<? extends SecurityManager> clazz = resolver.getClassProperty(SECURITY_MANAGER_CLASS,
SecurityManager.class);
if (clazz != null)
{
securityManager = clazz.newInstance();
}
}
catch (Exception e)
{
String msg = "Failed to configure the SecurityManager: instantiation failed.";
throw new StripesRuntimeException(msg, e);
}
if (securityManager != null)
{
LOG.info("Initialized the SecurityInterceptor with the SecurityManager: " + securityManager.toString());
}
else
{
LOG.info("Initialized the SecurityInterceptor without a SecurityManager (all access will be allowed).");
}
}
开发者ID:StripesFramework,
项目名称:stripes-stuff,
代码行数:43,
代码来源:SecurityInterceptor.java
示例6: findResourceBundleFactory
点赞 2
import net.sourceforge.stripes.config.BootstrapPropertyResolver; //导入依赖的package包/类
/**
* Determines the {@link ResourceBundleFactory} implementation to use, and if one is found, calls
* its {@code init(Configuration)} method if it implements {@link ConfigurableComponent}.
*
* @param configuration the configuration to use if the ResourceBundleFactory is a ConfigurableComponent
* @throws Exception when initializing the ResourceBundleFactory fails
*/
protected void findResourceBundleFactory(Configuration configuration)
throws Exception
{
BootstrapPropertyResolver propertyResolver = configuration.getBootstrapPropertyResolver();
Class<? extends ResourceBundleFactory> resourceBundleFactoryClass = propertyResolver.getClassProperty(
DEFAULT_BUNDLE_FACTORY, ResourceBundleFactory.class);
boolean newInstance = false;
if (resourceBundleFactoryClass == null)
{
if (localizationBundleFactory instanceof ResourceBundleFactory)
{
resourceBundleFactory = (ResourceBundleFactory)localizationBundleFactory;
}
else
{
resourceBundleFactory = new DefaultResourceBundleFactory();
newInstance = true;
}
}
else
{
try
{
resourceBundleFactory = resourceBundleFactoryClass.newInstance();
newInstance = true;
}
catch (Exception e)
{
throw new StripesRuntimeException("You specified a class name for a ResourceBundleFactory, " +
"but I cannot instantiate it. Is the class name correct? " +
"Does it have a no-arg constructor? For configuration you " +
"can implement ConfigurableComponent.", e);
}
}
if (newInstance && resourceBundleFactory instanceof ConfigurableComponent)
{
((ConfigurableComponent)resourceBundleFactory).init(configuration);
}
LOGGER.debug("Using resource bundle factory: ", resourceBundleFactory);
}
开发者ID:StripesFramework,
项目名称:stripes-stuff,
代码行数:50,
代码来源:AbstractBundleInterceptor.java