• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ModuleUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.struts.util.ModuleUtils的典型用法代码示例。如果您正苦于以下问题:Java ModuleUtils类的具体用法?Java ModuleUtils怎么用?Java ModuleUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ModuleUtils类属于org.apache.struts.util包,在下文中一共展示了ModuleUtils类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getModuleConfig

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
/**
 * Get the current ModuleConfig.
 * <br>
 * Lookup in the request and do selectModule if not found. The side effect
 * is, that the ModuleConfig object is set in the request if it was not present.
 * @param request Current request.
 * @param servletContext Current servlet context*.
 * @return The ModuleConfig for current request.
 */
protected ModuleConfig getModuleConfig(
    HttpServletRequest request,
    ServletContext servletContext) {

    ModuleConfig moduleConfig =
        ModuleUtils.getInstance().getModuleConfig(request);

    if (moduleConfig == null) {
        // ModuleConfig not found in current request. Select it.
        ModuleUtils.getInstance().selectModule(request, servletContext);
        moduleConfig = ModuleUtils.getInstance().getModuleConfig(request);
    }

    return moduleConfig;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:TilesUtilStrutsModulesImpl.java


示例2: process

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
/**
 * <p>Perform the standard request processing for this request, and create
 * the corresponding response.</p>
 *
 * @param request  The servlet request we are processing
 * @param response The servlet response we are creating
 * @throws IOException      if an input/output error occurs
 * @throws ServletException if a servlet exception is thrown
 */
protected void process(HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException {
    ModuleUtils.getInstance().selectModule(request, getServletContext());

    ModuleConfig config = getModuleConfig(request);

    RequestProcessor processor = getProcessorForModule(config);

    if (processor == null) {
        processor = getRequestProcessor(config);
    }

    processor.process(request, response);
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:25,代码来源:ActionServlet.java


示例3: getValidatorResources

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
/**
 * Retrieve <code>ValidatorResources</code> for the current module.
 * @param application Application Context
 * @param request The ServletRequest
 */
public static ValidatorResources getValidatorResources(
    ServletContext application,
    HttpServletRequest request) {

    String prefix =
        ModuleUtils
            .getInstance()
            .getModuleConfig(request, application)
            .getPrefix();

    return (ValidatorResources) application.getAttribute(
        ValidatorPlugIn.VALIDATOR_KEY + prefix);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:Resources.java


示例4: handleRequest

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
/**
 * This method populates the internal hashtables with multipart request data.
 * If the request argument is an instance of MultipartRequestWrapper,
 * the request wrapper will be populated as well.
 */
public void handleRequest(HttpServletRequest request) throws ServletException {
    ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request);
    this.retrieveTempDir(moduleConfig);
    
    try {
        MultipartIterator iterator =
            new MultipartIterator(
                request,
                moduleConfig.getControllerConfig().getBufferSize(),
                getMaxSize(moduleConfig.getControllerConfig().getMaxFileSize()),
                tempDir);
                
        MultipartElement element;

        textElements = new Hashtable();
        fileElements = new Hashtable();
        allElements = new Hashtable();

        while ((element = iterator.getNextElement()) != null) {
            if (!element.isFile()) {
                createTextElement(request, element);
            } else {
                createDiskFile(element);
            }
        }
        
        //take care of maximum length being exceeded
        if (iterator.isMaxLengthExceeded()) {
            request.setAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED, Boolean.TRUE);
        }
        
    } catch(IOException ioe) {
        throw new ServletException(ioe);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:41,代码来源:DiskMultipartRequestHandler.java


示例5: getModuleConfig

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
/**
 * Return the ModuleConfig object for the given prefix if it exists, null if otherwise.
 * @param module The module prefix
 * @param pageContext The page context.
 * @return the ModuleConfig object
 */
public ModuleConfig getModuleConfig(String module, PageContext pageContext) {
	return ModuleUtils.getInstance().getModuleConfig(
			module,
			(HttpServletRequest) pageContext.getRequest(),
			pageContext.getServletContext());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:TagUtils.java


示例6: getDataSource

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
/**
 * <p>Return the specified data source for the current module.</p>
 *
 * @param request The servlet request we are processing
 * @param key     The key specified in the <code>&lt;data-sources&gt;</code>
 *                element.
 *
 * @since Struts 1.1
 */
protected DataSource getDataSource(HttpServletRequest request, String key) {

    // Identify the current module
    ServletContext context = getServlet().getServletContext();
    ModuleConfig moduleConfig =
        ModuleUtils.getInstance().getModuleConfig(request, context);

    return (DataSource) context.getAttribute(key + moduleConfig.getPrefix());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:Action.java


示例7: getResources

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
/**
 * <p>Return the specified message resources for the current module.</p>
 *
 * @param request The servlet request we are processing
 * @param key The key specified in the
 *  <code>&lt;message-resources&gt;</code> element for the
 *  requested bundle
 *
 * @since Struts 1.1
 */
protected MessageResources getResources(
    HttpServletRequest request,
    String key) {

    // Identify the current module
    ServletContext context = getServlet().getServletContext();
    ModuleConfig moduleConfig =
        ModuleUtils.getInstance().getModuleConfig(request, context);

    // Return the requested message resources instance
    return (MessageResources) context.getAttribute(
        key + moduleConfig.getPrefix());

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


示例8: process

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
/**
 * <p>Perform the standard request processing for this request, and create
 * the corresponding response.</p>
 *
 * @param request The servlet request we are processing
 * @param response The servlet response we are creating
 *
 * @exception IOException if an input/output error occurs
 * @exception ServletException if a servlet exception is thrown
 */
protected void process(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException {

    ModuleUtils.getInstance().selectModule(request, getServletContext());
    ModuleConfig config = getModuleConfig(request);

    RequestProcessor processor = getProcessorForModule(config);
    if (processor == null) {
       processor = getRequestProcessor(config);
    }
    processor.process(request, response);

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


示例9: getResources

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
@Override
protected MessageResources getResources(HttpServletRequest request, String key) {
	// Identify the current module, the right way
	ServletContext context = request.getSession().getServletContext();
	ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request, context);
	
	// Return the requested message resources instance
	return (MessageResources) context.getAttribute(key + moduleConfig.getPrefix());
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:10,代码来源:SpringAwareLookupDispatchAction.java


示例10: getModuleConfig

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
/**
 * Return the specified ModuleConfig object for the given prefix if it
 * exists, otherwise a NullPointerException will be thrown.
 *
 * @param module      The module prefix
 * @param pageContext The page context.
 * @return the ModuleConfig object
 * @throws NullPointerException Thrown when module cannot be found
 */
public ModuleConfig getModuleConfig(String module, PageContext pageContext) {
    ModuleConfig config =
        ModuleUtils.getInstance().getModuleConfig(module,
            (HttpServletRequest) pageContext.getRequest(),
            pageContext.getServletContext());

    // ModuleConfig not found
    if (config == null) {
        throw new NullPointerException("Module '" + module + "' not found.");
    }

    return config;
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:23,代码来源:TagUtils.java


示例11: getValidatorResources

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
/**
 * Retrieve <code>ValidatorResources</code> for the current module.
 *
 * @param application Application Context
 * @param request     The ServletRequest
 */
public static ValidatorResources getValidatorResources(
    ServletContext application, HttpServletRequest request) {
    String prefix =
        ModuleUtils.getInstance().getModuleConfig(request, application)
                   .getPrefix();

    return (ValidatorResources) application.getAttribute(ValidatorPlugIn.VALIDATOR_KEY
        + prefix);
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:16,代码来源:Resources.java


示例12: getResources

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
/**
 * <p>Return the specified message resources for the current module.</p>
 *
 * @param request The servlet request we are processing
 * @param key     The key specified in the message-resources element for
 *                the requested bundle.
 * @return The specified message resource for the current module.
 * @since Struts 1.1
 */
protected MessageResources getResources(HttpServletRequest request,
    String key) {
    // Identify the current module
    ServletContext context = getServlet().getServletContext();
    ModuleConfig moduleConfig =
        ModuleUtils.getInstance().getModuleConfig(request, context);

    // Return the requested message resources instance
    return (MessageResources) context.getAttribute(key
        + moduleConfig.getPrefix());
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:21,代码来源:Action.java


示例13: showMaterialRequestTeacher

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
public ActionForward showMaterialRequestTeacher(ActionMapping mapping,
		ActionForm form, HttpServletRequest request,
		HttpServletResponse response) {

	int idMaterial = Integer.valueOf((String) request.getParameter("idActivity"));
	MaterialRequest materialRequest = facade.getMaterialRequestByID(idMaterial);
	Module module = materialRequest.getModule();
	
	//Cria um formul�rio dinamicamente
	ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request, getServlet().getServletContext());
	FormBeanConfig formConfig = moduleConfig.findFormBeanConfig("materialRequestActivity");
	DynaActionFormClass dynaClass = DynaActionFormClass.createDynaActionFormClass(formConfig);

	DynaActionForm myForm = null;
	try {
		myForm = (DynaActionForm) dynaClass.newInstance();
	} catch (Exception ex) {
		ex.printStackTrace();
	}	
	
	myForm.set("nameMaterial", materialRequest.getName());
	myForm.set("descriptionMaterial", materialRequest.getDescription());
	myForm.set("deliveryDate", materialRequest.getDeliveryDate());
	
	request.setAttribute("materialRequestActivity", myForm);
	
	request.setAttribute("idActivity", idMaterial);
	request.setAttribute("module", module);
	request.removeAttribute("materials");
	request.setAttribute("materials", materialRequest.getMaterials());

	return mapping.findForward(FORWARD_SHOW_MATERIAL_REQUEST_TEACHER);
}
 
开发者ID:ProjetoAmadeus,项目名称:AmadeusLMS,代码行数:34,代码来源:MaterialActions.java


示例14: getPathModule

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
private String getPathModule() {
    String currentModule = getModule();

    if (currentModule != null) {
        return currentModule;
    }

    ModuleConfig module = ModuleUtils.getInstance().getModuleConfig(this.request);
    if (module == null) {
        return "";
    }

    return module.getPrefix();
}
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:15,代码来源:FenixActionForward.java


示例15: getActionMappingURL

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
/**
 * Return the form action converted into a server-relative URL.
 */
public String getActionMappingURL(String action, String module, PageContext pageContext, boolean contextRelative) {

    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

    String contextPath = request.getContextPath();
    StringBuffer value = new StringBuffer();
    // Avoid setting two slashes at the beginning of an action:
    //  the length of contextPath should be more than 1
    //  in case of non-root context, otherwise length==1 (the slash)
    if (contextPath.length() > 1) value.append(contextPath);

    ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(module, request, pageContext.getServletContext());

    if ((moduleConfig != null) && (!contextRelative)) {
        value.append(moduleConfig.getPrefix());
    }

    // Use our servlet mapping, if one is specified
    String servletMapping =
            (String) pageContext.getAttribute(
                    Globals.SERVLET_KEY,
                    PageContext.APPLICATION_SCOPE);

    if (servletMapping != null) {

        String queryString = null;
        int question = action.indexOf("?");
        if (question >= 0) {
            queryString = action.substring(question);
        }

        String actionMapping = getActionMappingName(action);
        if (servletMapping.startsWith("*.")) {
            value.append(actionMapping);
            value.append(servletMapping.substring(1));

        } else if (servletMapping.endsWith("/*")) {
            value.append(
                    servletMapping.substring(0, servletMapping.length() - 2));
            value.append(actionMapping);

        } else if (servletMapping.equals("/")) {
            value.append(actionMapping);
        }
        if (queryString != null) {
            value.append(queryString);
        }
    }

    // Otherwise, assume extension mapping is in use and extension is
    // already included in the action property
    else {
        if (!action.startsWith("/")) {
            value.append("/");
        }
        value.append(action);
    }

    return value.toString();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:64,代码来源:TagUtils.java


示例16: resolveModuleRelativePath

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
private String resolveModuleRelativePath(ForwardConfig forwardConfig, ServletContext servletContext, HttpServletRequest request) {
    String prefix = forwardConfig.getModule();
    ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(prefix, request, servletContext);
    return RequestUtils.forwardURL(request,forwardConfig, moduleConfig);
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:6,代码来源:PerformForward.java


示例17: showViewEditMaterialRequestActivity

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
public ActionForward showViewEditMaterialRequestActivity(ActionMapping mapping,
		ActionForm form, HttpServletRequest request,
		HttpServletResponse response) {
	
	int idMaterial = Integer.valueOf((String) request.getParameter("idActivity"));
	MaterialRequest materialRequest = facade.getMaterialRequestByID(idMaterial);

	Module module = materialRequest.getModule();
	
	Calendar cal = Calendar.getInstance();
	cal.setTime(materialRequest.getDeliveryDate());

	String day = "" + cal.get(Calendar.DATE);
	int monthInteger = cal.get(Calendar.MONTH) + 1;
	String month = "" + monthInteger;
	String year = "" + cal.get(Calendar.YEAR);

	cal.setTime(materialRequest.getDeliveryDate());

	//Cria um formul�rio dinamicamente
	ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request, getServlet().getServletContext());
	FormBeanConfig formConfig = moduleConfig.findFormBeanConfig("materialRequestActivity");
	DynaActionFormClass dynaClass = DynaActionFormClass.createDynaActionFormClass(formConfig);

	DynaActionForm myForm = null;
	try {
		myForm = (DynaActionForm) dynaClass.newInstance();
	} catch (Exception ex) {
		ex.printStackTrace();
	}	

	myForm.set("nameMaterial", materialRequest.getName());
	myForm.set("descriptionMaterial", materialRequest.getDescription());
	myForm.set("dayMaterial", day);
	myForm.set("monthMaterial", month);
	myForm.set("yearMaterial", year);
	myForm.set("allowMaterial", materialRequest.isAllowLateDeliveries());
	
	request.setAttribute("materialRequestActivity", myForm);

	request.setAttribute("idMaterial", idMaterial);
	request.setAttribute("module", module);

	return mapping.findForward(FORWARD_EDIT_MATERIAL_REQUEST);
}
 
开发者ID:ProjetoAmadeus,项目名称:AmadeusLMS,代码行数:46,代码来源:MaterialActions.java


示例18: showViewMaterialRequestActivity

import org.apache.struts.util.ModuleUtils; //导入依赖的package包/类
public ActionForward showViewMaterialRequestActivity(ActionMapping mapping,
		ActionForm form, HttpServletRequest request,
		HttpServletResponse response) {
	
	int idMaterial = Integer.valueOf((String) request.getParameter("idActivity"));
	String callFromPaddingTask = request.getParameter("callFromPaddingTask");
	
	MaterialRequest materialRequest = facade.getMaterialRequestByID(idMaterial);
	Module module = materialRequest.getModule();
	
	AccessInfo info = (AccessInfo) request.getSession().getAttribute("user");
	info = facade.searchUserById(info.getId());
	
	Person author = info.getPerson();
	
	Material material = facade.getMaterial(author, materialRequest);
	
	Calendar cal = Calendar.getInstance();
	cal.setTime(materialRequest.getDeliveryDate());

	//Cria um formul�rio dinamicamente
	ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request, getServlet().getServletContext());
	FormBeanConfig formConfig = moduleConfig.findFormBeanConfig("materialRequestActivity");
	DynaActionFormClass dynaClass = DynaActionFormClass.createDynaActionFormClass(formConfig);

	DynaActionForm myForm = null;
	try {
		myForm = (DynaActionForm) dynaClass.newInstance();
	} catch (Exception ex) {
		ex.printStackTrace();
	}	

	myForm.set("nameMaterial", materialRequest.getName());
	myForm.set("descriptionMaterial", materialRequest.getDescription());
	myForm.set("deliveryDate", materialRequest.getDeliveryDate());
	
	
	Calendar today = Calendar.getInstance();
	Calendar deliveryDate = Calendar.getInstance();
	deliveryDate.setTime(materialRequest.getDeliveryDate());
	int expiredDelivery = UtilActivities.compareDates(deliveryDate,today);
	
	request.setAttribute("materialRequest", materialRequest);
	request.setAttribute("expiredDelivery", expiredDelivery);
	request.setAttribute("materialRequestActivity", myForm);
	request.setAttribute("idActivity", idMaterial);
	request.setAttribute("module", module);
	request.setAttribute("material", material);
	request.setAttribute("callFromPaddingTask", callFromPaddingTask);

	return mapping.findForward(FORWARD_SHOW_VIEW_MATERIAL_REQUEST_ACTIVITY);
}
 
开发者ID:ProjetoAmadeus,项目名称:AmadeusLMS,代码行数:53,代码来源:MaterialActions.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Weather类代码示例发布时间:2022-05-23
下一篇:
Java XSContentType类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap