本文整理汇总了Java中org.apache.struts.util.RequestUtils.applicationClass方法的典型用法代码示例。如果您正苦于以下问题:Java RequestUtils.applicationClass方法的具体用法?Java RequestUtils.applicationClass怎么用?Java RequestUtils.applicationClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.struts.util.RequestUtils
的用法示例。
在下文中一共展示了RequestUtils.applicationClass方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyActionMappingClass
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* <p>Return <code>true</code> if information returned by
* <code>config.getActionMappingClass</code> is all valid;
* otherwise, log error messages and return <code>false</code>.</p>
*/
protected boolean verifyActionMappingClass() {
String amcName = config.getActionMappingClass();
if (amcName == null) {
log(servlet.getInternal().getMessage
("verifyActionMappingClass.missing"));
return (false);
}
try {
Class amcClass = RequestUtils.applicationClass(amcName);
} catch (ClassNotFoundException e) {
log(servlet.getInternal().getMessage
("verifyActionMappingClass.invalid", amcName));
return (false);
}
return (true);
}
示例2: verifyPlugInConfigs
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* <p>Return <code>true</code> if information returned by
* <code>config.findPluginConfigs</code> is all valid;
* otherwise, log error messages and return <code>false</code>.</p>
*/
protected boolean verifyPlugInConfigs() {
boolean ok = true;
PlugInConfig pics[] = config.findPlugInConfigs();
for (int i = 0; i < pics.length; i++) {
String className = pics[i].getClassName();
if (className == null) {
log(servlet.getInternal().getMessage
("verifyPlugInConfigs.missing"));
ok = false;
} else {
try {
Class clazz = RequestUtils.applicationClass(className);
} catch (ClassNotFoundException e) {
log(servlet.getInternal().getMessage
("verifyPlugInConfigs.invalid", className));
ok = false;
}
}
}
return (ok);
}
示例3: introspect
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* <p>Introspect our form bean configuration to identify the supported
* properties.</p>
*
* @param config The FormBeanConfig instance describing the properties
* of the bean to be created
*
* @exception IllegalArgumentException if the bean implementation class
* specified in the configuration is not DynaActionForm (or a subclass
* of DynaActionForm)
*/
protected void introspect(FormBeanConfig config) {
this.config = config;
// Validate the ActionFormBean implementation class
try {
beanClass = RequestUtils.applicationClass(config.getType());
} catch (Throwable t) {
throw new IllegalArgumentException
("Cannot instantiate ActionFormBean class '" +
config.getType() + "': " + t);
}
if (!DynaActionForm.class.isAssignableFrom(beanClass)) {
throw new IllegalArgumentException
("Class '" + config.getType() + "' is not a subclass of " +
"'org.apache.struts.action.DynaActionForm'");
}
// Set the name we will know ourselves by from the form bean name
this.name = config.getName();
// Look up the property descriptors for this bean class
FormPropertyConfig descriptors[] = config.findFormPropertyConfigs();
if (descriptors == null) {
descriptors = new FormPropertyConfig[0];
}
// Create corresponding dynamic property definitions
properties = new DynaProperty[descriptors.length];
for (int i = 0; i < descriptors.length; i++) {
properties[i] =
new DynaProperty(descriptors[i].getName(),
descriptors[i].getTypeClass());
propertiesMap.put(properties[i].getName(),
properties[i]);
}
}
示例4: verifyMessageResourcesConfigs
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* <p>Return <code>true</code> if information returned by
* <code>config.findMessageResourcesConfigs</code> is all valid;
* otherwise, log error messages and return <code>false</code>.</p>
*/
protected boolean verifyMessageResourcesConfigs() {
boolean ok = true;
MessageResourcesConfig mrcs[] = config.findMessageResourcesConfigs();
for (int i = 0; i < mrcs.length; i++) {
String factory = mrcs[i].getFactory();
if (factory == null) {
log(servlet.getInternal().getMessage
("verifyMessageResourcesConfigs.missing"));
ok = false;
} else {
try {
Class clazz = RequestUtils.applicationClass(factory);
} catch (ClassNotFoundException e) {
log(servlet.getInternal().getMessage
("verifyMessageResourcesConfigs.invalid",
factory));
ok = false;
}
}
String key = mrcs[i].getKey();
if (key == null) {
log(servlet.getInternal().getMessage
("verifyMessageResourcesConfigs.key"));
}
}
return (ok);
}
示例5: setActionContextClassName
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* <p>Make sure that the specified <code>className</code> identfies a
* class which can be found and which implements the
* <code>ActionContext</code> interface.</p>
*
* @param className Fully qualified name of
* @throws ServletException If an error occurs during initialization
* @throws UnavailableException if class does not implement ActionContext
* or is not found
*/
private void setActionContextClassName(String className)
throws ServletException {
if ((className != null) && (className.trim().length() > 0)) {
if (LOG.isDebugEnabled()) {
LOG.debug(
"setActionContextClassName: requested context class: "
+ className);
}
try {
Class actionContextClass =
RequestUtils.applicationClass(className);
if (!ActionContext.class.isAssignableFrom(actionContextClass)) {
throw new UnavailableException("ActionContextClass " + "["
+ className + "]"
+ " must implement ActionContext interface.");
}
this.setActionContextClass(actionContextClass);
} catch (ClassNotFoundException e) {
throw new UnavailableException("ActionContextClass "
+ className + " not found.");
}
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("setActionContextClassName: no className specified");
}
this.setActionContextClass(null);
}
}
示例6: introspect
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* <p>Introspect our form bean configuration to identify the supported
* properties.</p>
*
* @param config The FormBeanConfig instance describing the properties of
* the bean to be created
* @throws IllegalArgumentException if the bean implementation class
* specified in the configuration is not
* DynaActionForm (or a subclass of
* DynaActionForm)
*/
protected void introspect(FormBeanConfig config) {
this.config = config;
// Validate the ActionFormBean implementation class
try {
beanClass = RequestUtils.applicationClass(config.getType());
} catch (Throwable t) {
throw new IllegalArgumentException(
"Cannot instantiate ActionFormBean class '" + config.getType()
+ "': " + t);
}
if (!DynaActionForm.class.isAssignableFrom(beanClass)) {
throw new IllegalArgumentException("Class '" + config.getType()
+ "' is not a subclass of "
+ "'org.apache.struts.action.DynaActionForm'");
}
// Set the name we will know ourselves by from the form bean name
this.name = config.getName();
// Look up the property descriptors for this bean class
FormPropertyConfig[] descriptors = config.findFormPropertyConfigs();
if (descriptors == null) {
descriptors = new FormPropertyConfig[0];
}
// Create corresponding dynamic property definitions
properties = new DynaProperty[descriptors.length];
for (int i = 0; i < descriptors.length; i++) {
properties[i] =
new DynaProperty(descriptors[i].getName(),
descriptors[i].getTypeClass());
propertiesMap.put(properties[i].getName(), properties[i]);
}
}
示例7: initRequestProcessorClass
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* Set RequestProcessor to appropriate Tiles {@link RequestProcessor}.
* First, check if a RequestProcessor is specified. If yes, check if it extends
* the appropriate {@link TilesRequestProcessor} class. If not, set processor class to
* TilesRequestProcessor.
*
* @param config ModuleConfig for the module with which
* this plugin is associated.
* @throws ServletException On errors.
*/
protected void initRequestProcessorClass(ModuleConfig config)
throws ServletException {
String tilesProcessorClassname = TilesRequestProcessor.class.getName();
ControllerConfig ctrlConfig = config.getControllerConfig();
String configProcessorClassname = ctrlConfig.getProcessorClass();
// Check if specified classname exist
Class configProcessorClass;
try {
configProcessorClass =
RequestUtils.applicationClass(configProcessorClassname);
} catch (ClassNotFoundException ex) {
log.fatal(
"Can't set TilesRequestProcessor: bad class name '"
+ configProcessorClassname
+ "'.");
throw new ServletException(ex);
}
// Check if it is the default request processor or Tiles one.
// If true, replace by Tiles' one.
if (configProcessorClassname.equals(RequestProcessor.class.getName())
|| configProcessorClassname.endsWith(tilesProcessorClassname)) {
ctrlConfig.setProcessorClass(tilesProcessorClassname);
return;
}
// Check if specified request processor is compatible with Tiles.
Class tilesProcessorClass = TilesRequestProcessor.class;
if (!tilesProcessorClass.isAssignableFrom(configProcessorClass)) {
// Not compatible
String msg =
"TilesPlugin : Specified RequestProcessor not compatible with TilesRequestProcessor";
if (log.isFatalEnabled()) {
log.fatal(msg);
}
throw new ServletException(msg);
}
}
示例8: initRequestProcessorClass
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* Set RequestProcessor to appropriate Tiles {@link RequestProcessor}.
* First, check if a RequestProcessor is specified. If yes, check if it extends
* the appropriate {@link TilesRequestProcessor} class. If not, set processor class to
* TilesRequestProcessor.
*
* @param config ModuleConfig for the module with which
* this plugin is associated.
* @throws ServletException On errors.
*/
protected void initRequestProcessorClass(ModuleConfig config)
throws ServletException {
String tilesProcessorClassname = TilesRequestProcessor.class.getName();
ControllerConfig ctrlConfig = config.getControllerConfig();
String configProcessorClassname = ctrlConfig.getProcessorClass();
// Check if specified classname exist
Class configProcessorClass;
try {
configProcessorClass =
RequestUtils.applicationClass(configProcessorClassname);
} catch (ClassNotFoundException ex) {
log.fatal(
"Can't set TilesRequestProcessor: bad class name '"
+ configProcessorClassname
+ "'.");
throw new ServletException(ex);
}
// Check to see if request processor uses struts-chain. If so,
// no need to replace the request processor.
if (ComposableRequestProcessor.class.isAssignableFrom(configProcessorClass)) {
return;
}
// Check if it is the default request processor or Tiles one.
// If true, replace by Tiles' one.
if (configProcessorClassname.equals(RequestProcessor.class.getName())
|| configProcessorClassname.endsWith(tilesProcessorClassname)) {
ctrlConfig.setProcessorClass(tilesProcessorClassname);
return;
}
// Check if specified request processor is compatible with Tiles.
Class tilesProcessorClass = TilesRequestProcessor.class;
if (!tilesProcessorClass.isAssignableFrom(configProcessorClass)) {
// Not compatible
String msg =
"TilesPlugin : Specified RequestProcessor not compatible with TilesRequestProcessor";
if (log.isFatalEnabled()) {
log.fatal(msg);
}
throw new ServletException(msg);
}
}