当前位置: 首页>>代码示例>>Java>>正文


Java RequestUtils.applicationInstance方法代码示例

本文整理汇总了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;
    }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:ConfigRuleSet.java

示例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;
}
 
开发者ID:GovernIB,项目名称:sistra,代码行数:17,代码来源:TramiteValidatorForm.java

示例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;
   }
 
开发者ID:GovernIB,项目名称:sistra,代码行数:18,代码来源:TramiteValidatorForm.java

示例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);
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:40,代码来源:ActionServlet.java

示例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;
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:22,代码来源:ConfigRuleSet.java

示例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);

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:43,代码来源:ActionServlet.java

示例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);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:39,代码来源:ActionServlet.java

示例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);
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:47,代码来源:RequestProcessor.java

示例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);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:44,代码来源:DigestingPlugIn.java

示例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;
}
 
开发者ID:GovernIB,项目名称:sistra,代码行数:16,代码来源:MobtratelForm.java

示例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;
}
 
开发者ID:GovernIB,项目名称:sistra,代码行数:12,代码来源:TraduccionValidatorForm.java

示例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;
}
 
开发者ID:GovernIB,项目名称:sistra,代码行数:17,代码来源:TraduccionValidatorForm.java

示例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;
}
 
开发者ID:GovernIB,项目名称:sistra,代码行数:17,代码来源:TraduccionValidatorForm.java

示例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);
    }
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:48,代码来源:RequestProcessor.java

示例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());
        }
    }
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:35,代码来源:FormBeanConfig.java


注:本文中的org.apache.struts.util.RequestUtils.applicationInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。