本文整理汇总了Java中org.apache.struts.util.RequestUtils.applicationInstance方法的典型用法代码示例。如果您正苦于以下问题:Java RequestUtils.applicationInstance方法的具体用法?Java RequestUtils.applicationInstance怎么用?Java RequestUtils.applicationInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.struts.util.RequestUtils
的用法示例。
在下文中一共展示了RequestUtils.applicationInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createObject
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
public Object createObject(Attributes attributes) {
// Identify the name of the class to instantiate
String className = attributes.getValue("className");
if (className == null) {
ModuleConfig mc = (ModuleConfig) digester.peek();
className = mc.getActionFormBeanClass();
}
// Instantiate the new object and return it
Object actionFormBean = null;
try {
actionFormBean =
RequestUtils.applicationInstance(className);
} catch (Exception e) {
digester.getLogger().error(
"ActionFormBeanFactory.createObject: ", e);
}
return actionFormBean;
}
示例2: getTramite
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
public TramiteEspecificado getTramite()
{
if ( tramite == null )
{
try
{
tramite = ( TramiteEspecificado ) RequestUtils.applicationInstance(tramiteClassName);
}
catch ( Throwable t )
{
log.error("No se ha podido crear el tramite ", t);
return null;
}
}
return tramite;
}
示例3: getValues
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
public Traducible getValues()
{
Traducible values = getTramite().getEspecificaciones();
if (values == null)
{
try
{
values = (Traducible) RequestUtils.applicationInstance(valuesClassName);
this.setValues( values );
} catch (Throwable t)
{
log.error("No se ha podido crear el value ", t);
return null;
}
}
return values;
}
示例4: getRequestProcessor
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* <p>Look up and return the {@link RequestProcessor} responsible for the
* specified module, creating a new one if necessary.</p>
*
* @param config The module configuration for which to acquire and return
* a RequestProcessor.
* @return The {@link RequestProcessor} responsible for the specified
* module,
* @throws ServletException If we cannot instantiate a RequestProcessor
* instance a {@link UnavailableException} is
* thrown, meaning your application is not loaded
* and will not be available.
* @since Struts 1.1
*/
protected synchronized RequestProcessor getRequestProcessor(
ModuleConfig config) throws ServletException {
RequestProcessor processor = this.getProcessorForModule(config);
if (processor == null) {
try {
processor =
(RequestProcessor) RequestUtils.applicationInstance(config.getControllerConfig()
.getProcessorClass());
} catch (Exception e) {
throw new UnavailableException(
"Cannot initialize RequestProcessor of class "
+ config.getControllerConfig().getProcessorClass() + ": "
+ e);
}
processor.init(this, config);
String key = Globals.REQUEST_PROCESSOR_KEY + config.getPrefix();
getServletContext().setAttribute(key, processor);
}
return (processor);
}
示例5: createObject
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
public Object createObject(Attributes attributes) {
// Identify the name of the class to instantiate
String className = attributes.getValue("className");
if (className == null) {
ModuleConfig mc = (ModuleConfig) digester.peek();
className = mc.getActionFormBeanClass();
}
// Instantiate the new object and return it
Object actionFormBean = null;
try {
actionFormBean = RequestUtils.applicationInstance(className, cl);
} catch (Exception e) {
digester.getLogger().error("ActionFormBeanFactory.createObject: ", e);
}
return actionFormBean;
}
示例6: getRequestProcessor
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* <p>Look up and return the {@link RequestProcessor} responsible for the
* specified module, creating a new one if necessary.</p>
*
* @param config The module configuration for which to
* acquire and return a RequestProcessor.
*
* @exception ServletException if we cannot instantiate a RequestProcessor
* instance
* @since Struts 1.1
*/
protected synchronized RequestProcessor getRequestProcessor(ModuleConfig config)
throws ServletException {
// :FIXME: Document UnavailableException?
RequestProcessor processor = this.getProcessorForModule(config);
if (processor == null) {
try {
processor =
(RequestProcessor) RequestUtils.applicationInstance(
config.getControllerConfig().getProcessorClass());
} catch (Exception e) {
throw new UnavailableException(
"Cannot initialize RequestProcessor of class "
+ config.getControllerConfig().getProcessorClass()
+ ": "
+ e);
}
processor.init(this, config);
String key = Globals.REQUEST_PROCESSOR_KEY + config.getPrefix();
getServletContext().setAttribute(key, processor);
}
return (processor);
}
示例7: addRuleSets
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* <p>Add any custom RuleSet instances to configDigester that have
* been specified in the <code>rulesets</code> init parameter.</p>
*
* @throws ServletException
*/
private void addRuleSets() throws ServletException {
String rulesets = getServletConfig().getInitParameter("rulesets");
if (rulesets == null) {
rulesets = "";
}
rulesets = rulesets.trim();
String ruleset = null;
while (rulesets.length() > 0) {
int comma = rulesets.indexOf(",");
if (comma < 0) {
ruleset = rulesets.trim();
rulesets = "";
} else {
ruleset = rulesets.substring(0, comma).trim();
rulesets = rulesets.substring(comma + 1).trim();
}
if (log.isDebugEnabled()) {
log.debug("Configuring custom Digester Ruleset of type " + ruleset);
}
try {
RuleSet instance = (RuleSet) RequestUtils.applicationInstance(ruleset);
this.configDigester.addRuleSet(instance);
} catch (Exception e) {
log.error("Exception configuring custom Digester RuleSet", e);
throw new ServletException(e);
}
}
}
示例8: processException
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* <p>Ask our exception handler to handle the exception. Return the
* <code>ActionForward</code> instance (if any) returned by the
* called <code>ExceptionHandler</code>.</p>
*
* @param request The servlet request we are processing
* @param response The servlet response we are processing
* @param exception The exception being handled
* @param form The ActionForm we are processing
* @param mapping The ActionMapping we are using
*
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet exception occurs
*/
protected ActionForward processException(HttpServletRequest request,
HttpServletResponse response,
Exception exception,
ActionForm form,
ActionMapping mapping)
throws IOException, ServletException {
// Is there a defined handler for this exception?
ExceptionConfig config = mapping.findException(exception.getClass());
if (config == null) {
log.warn(getInternal().getMessage("unhandledException",
exception.getClass()));
if (exception instanceof IOException) {
throw (IOException) exception;
} else if (exception instanceof ServletException) {
throw (ServletException) exception;
} else {
throw new ServletException(exception);
}
}
// Use the configured exception handling
try {
ExceptionHandler handler = (ExceptionHandler)
RequestUtils.applicationInstance(config.getHandler());
return (handler.execute(exception, config, mapping, form,
request, response));
} catch (Exception e) {
throw new ServletException(e);
}
}
示例9: applyRuleSets
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* Instantiate any <code>RuleSet</code> classes defined in the
* <code>rulesets</code> property and use them to add rules to our
* <code>Digester</code>.
* @param digester the Digester instance to add RuleSet objects to.
* @throws ServletException
*/
protected void applyRuleSets(Digester digester) throws ServletException {
if (this.rulesets == null || this.rulesets.trim().length() == 0) {
return;
}
rulesets = rulesets.trim();
String ruleSet = null;
while (rulesets.length() > 0) {
int comma = rulesets.indexOf(",");
if (comma < 0) {
ruleSet = rulesets.trim();
rulesets = "";
} else {
ruleSet = rulesets.substring(0, comma).trim();
rulesets = rulesets.substring(comma + 1).trim();
}
if (log.isDebugEnabled()) {
// TODO Internationalize msg
log.debug("Configuring custom Digester Ruleset of type " + ruleSet);
}
try {
RuleSet instance =
(RuleSet) RequestUtils.applicationInstance(ruleSet);
digester.addRuleSet(instance);
} catch (Exception e) {
// TODO Internationalize msg
log.error("Exception configuring custom Digester RuleSet", e);
throw new ServletException(e);
}
}
}
示例10: getValues
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
public Serializable getValues()
{
if (values == null)
{
try
{
values = (Serializable) RequestUtils.applicationInstance(valuesClassName);
} catch (Throwable t)
{
log.error("No se ha podido crear el value ", t);
return null;
}
}
return values;
}
示例11: getValues
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
public Traducible getValues() {
if (values == null) {
try {
values = (Traducible) RequestUtils.applicationInstance(valuesClassName);
} catch (Throwable t) {
log.error("No se ha podido crear el value ", t);
return null;
}
}
return values;
}
示例12: getTraduccion
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* Acceso directo a los datos traducidos.
*/
public Traduccion getTraduccion() {
Traduccion traduccion = values.getTraduccion(lang);
if (traduccion == null)
try {
traduccion = (Traduccion) RequestUtils.applicationInstance(traduccionClassName);
getValues().setTraduccion(lang, traduccion);
} catch (Throwable t) {
log.error("No se ha podidio crear la traducci�n", t);
return null;
}
return traduccion;
}
示例13: getTraduccion
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* Acceso directo a los datos traducidos.
*/
public Traduccion getTraduccion() {
Traduccion traduccion = getValues().getTraduccion(lang);
if (traduccion == null)
try {
traduccion = (Traduccion) RequestUtils.applicationInstance(traduccionClassName);
getValues().setTraduccion(lang, traduccion);
} catch (Throwable t) {
log.error("No se ha podidio crear la traducci�n", t);
return null;
}
return traduccion;
}
示例14: processException
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* <p>Ask our exception handler to handle the exception. Return the
* <code>ActionForward</code> instance (if any) returned by the called
* <code>ExceptionHandler</code>.</p>
*
* @param request The servlet request we are processing
* @param response The servlet response we are processing
* @param exception The exception being handled
* @param form The ActionForm we are processing
* @param mapping The ActionMapping we are using
* @return The <code>ActionForward</code> instance (if any) returned by
* the called <code>ExceptionHandler</code>.
* @throws IOException if an input/output error occurs
* @throws ServletException if a servlet exception occurs
*/
protected ActionForward processException(HttpServletRequest request,
HttpServletResponse response, Exception exception, ActionForm form,
ActionMapping mapping)
throws IOException, ServletException {
// Is there a defined handler for this exception?
ExceptionConfig config = mapping.findException(exception.getClass());
if (config == null) {
log.warn(getInternal().getMessage("unhandledException",
exception.getClass()));
if (exception instanceof IOException) {
throw (IOException) exception;
} else if (exception instanceof ServletException) {
throw (ServletException) exception;
} else {
throw new ServletException(exception);
}
}
// Use the configured exception handling
try {
ExceptionHandler handler =
(ExceptionHandler) RequestUtils.applicationInstance(config
.getHandler());
return (handler.execute(exception, config, mapping, form, request,
response));
} catch (Exception e) {
throw new ServletException(e);
}
}
示例15: inheritFormProperties
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* <p>Compare the form properties of this bean with that of the given and
* copy those that are not present.</p>
*
* @param config The form bean config to copy properties from.
* @see #inheritFrom(FormBeanConfig)
*/
protected void inheritFormProperties(FormBeanConfig config)
throws ClassNotFoundException, IllegalAccessException,
InstantiationException, InvocationTargetException {
throwIfConfigured();
// Inherit form property configs
FormPropertyConfig[] baseFpcs = config.findFormPropertyConfigs();
for (int i = 0; i < baseFpcs.length; i++) {
FormPropertyConfig baseFpc = baseFpcs[i];
// Do we have this prop?
FormPropertyConfig prop =
this.findFormPropertyConfig(baseFpc.getName());
if (prop == null) {
// We don't have this, so let's copy it
prop =
(FormPropertyConfig) RequestUtils.applicationInstance(baseFpc.getClass()
.getName());
BeanUtils.copyProperties(prop, baseFpc);
this.addFormPropertyConfig(prop);
prop.setProperties(baseFpc.copyProperties());
}
}
}