/** * Return the prefix of the ModuleConfig that this PlugIn is associated with. * @see org.apache.struts.config.ModuleConfig#getPrefix */ public final String getModulePrefix() { return this.moduleConfig.getPrefix(); }
/** * Return the prefix of the ModuleConfig that this PlugIn is associated with. * @see org.apache.struts.config.ModuleConfig#getPrefix */ public final String getModulePrefix() { return this.moduleConfig.getPrefix(); }
/** * Get definition factory for the module attached to specified moduleConfig. * @param servletContext Current servlet context. * @param moduleConfig Module config of the module for which the factory is requested. * @return Definitions factory or null if not found. */ public DefinitionsFactory getDefinitionsFactory( ServletContext servletContext, ModuleConfig moduleConfig) { return (DefinitionsFactory) servletContext.getAttribute( DEFINITIONS_FACTORY + moduleConfig.getPrefix()); }
/** * Get definition factory for the module attached to specified moduleConfig. * @param servletContext Current servlet context. * @param moduleConfig Module config of the module for which the factory is requested. * @return Definitions factory or null if not found. */ public DefinitionsFactory getDefinitionsFactory( ServletContext servletContext, ModuleConfig moduleConfig) { return (DefinitionsFactory) servletContext.getAttribute( DEFINITIONS_FACTORY + moduleConfig.getPrefix()); }
/** * @return If the action is not specified returns the original request uri. */ public String getPostbackAction() { final HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); String tempPostbackAction = (String) request.getAttribute(Globals.ORIGINAL_URI_KEY); final String prefix = moduleConfig.getPrefix(); if (tempPostbackAction != null && prefix.length() > 0 && tempPostbackAction.startsWith(prefix)) { tempPostbackAction = tempPostbackAction.substring(prefix.length()); } return tempPostbackAction; }
/** * <p>Returns the RequestProcessor for the given module or null if one does not * exist. This method will not create a RequestProcessor.</p> * * @param config The ModuleConfig. */ private RequestProcessor getProcessorForModule(ModuleConfig config) { String key = Globals.REQUEST_PROCESSOR_KEY + config.getPrefix(); return (RequestProcessor) getServletContext().getAttribute(key); }
/** * <p>Returns the path to perform the include. Override this method to provide * a different path.</p> * * @param actionContext The context for this request * @param include The forward to be performed * @since Struts 1.3.6 */ protected String includePath(ActionContext actionContext, String include) { ModuleConfig moduleConfig = actionContext.getModuleConfig(); return moduleConfig.getPrefix() + include; }
/** * <p>Returns the RequestProcessor for the given module or null if one * does not exist. This method will not create a RequestProcessor.</p> * * @param config The ModuleConfig. * @return The <code>RequestProcessor</code> for the given module, or * <code>null</code> if one does not exist. */ private RequestProcessor getProcessorForModule(ModuleConfig config) { String key = Globals.REQUEST_PROCESSOR_KEY + config.getPrefix(); return (RequestProcessor) getServletContext().getAttribute(key); }
/** * <p>Log the specified message to our servlet context log, after a * header including the module prefix.</p> * * @param message The message to be logged */ protected void log(String message) { String output = "[" + config.getPrefix() + "]: " + message; servlet.log(output); }
/** * Get Tiles RequestProcessor associated to the current module. * @param request Current request. * @param servletContext Current servlet context. * @return The {@link TilesRequestProcessor} for the current request. */ protected TilesRequestProcessor getRequestProcessor( HttpServletRequest request, ServletContext servletContext) { ModuleConfig moduleConfig = getModuleConfig(request, servletContext); return (TilesRequestProcessor) servletContext.getAttribute( Globals.REQUEST_PROCESSOR_KEY + moduleConfig.getPrefix()); }
private String constructRedirectPath(final ActionMapping mapping, final HttpServletRequest request, final StringBuilder path) { final String result = GenericChecksumRewriter.injectChecksumInUrl(request.getContextPath(), path.toString(), request.getSession()); return result.substring(mapping.getModuleConfig().getPrefix().length()); }
public Object invoke(MethodInvocation invocation) throws Throwable { ModuleConfig config = (ModuleConfig) invocation.getThis(); String name = (String) invocation.getArguments()[0]; ModuleConfig reloadConfig = this.moduleConfigLoader.load(config.getPrefix()); FormBeanConfig formConfig = reloadConfig.findFormBeanConfig(name); if (formConfig != null) { return formConfig; } return invocation.proceed(); }
private void initValidatorResources(ServletContext context, ModuleConfig config) { S2Container container = getContainer(); if (!container.hasComponentDef(ValidatorResourcesWrapper.class)) { return; } ValidatorResourcesWrapper resourcesWrapper = (ValidatorResourcesWrapper) container .getComponent(ValidatorResourcesWrapper.class); ValidatorResources resources = (ValidatorResources) context.getAttribute(ValidatorPlugIn.VALIDATOR_KEY + config.getPrefix()); resourcesWrapper.init(resources); context.setAttribute(ValidatorPlugIn.VALIDATOR_KEY + config.getPrefix(), resourcesWrapper); }
public Object invoke(MethodInvocation invocation) throws Throwable { ModuleConfig config = (ModuleConfig) invocation.getThis(); String path = (String) invocation.getArguments()[0]; ModuleConfig reloadConfig = this.moduleConfigLoader.load(config.getPrefix()); ActionConfig[] actionConfigs = reloadConfig.findActionConfigs(); for (int i = 0; i < actionConfigs.length; i++) { if (path.equals(actionConfigs[i].getPath())) { return actionConfigs[i]; } } return invocation.proceed(); }
/** * <p> Store the mesasage resources for the current module under the given * request attribute key. </p> * * @param key Request attribute key * @param resources Message resouces to store */ public void setMessageResources(String key, MessageResources resources) { this.getRequest().setAttribute(key + getModuleConfig().getPrefix(), resources); }
private String viewContestPath(final ActionMapping mapping, final HttpServletRequest request, final OutboundMobilityCandidacyContest contest) { final StringBuilder path = new StringBuilder(); path.append(mapping.getModuleConfig().getPrefix()); path.append("/outboundMobilityCandidacy.do?method=viewContest&contestOid="); path.append(contest.getExternalId()); return constructRedirectPath(mapping, request, path); }
public void deleteSite(String siteName) { converterResource_.deregister(siteName); ModuleConfigMetadata metadata = metadataMap.remove(siteName); ModuleConfig config = metadata.getModuleConfig(); ControllerUtils.getTuigwaaActionServlet().getServletContext() .removeAttribute(Globals.MODULE_KEY + config.getPrefix()); StrutsUtil.removePrefix(config.getPrefix()); }
public MessageResources getMessageResources(String key) { // Identify the current module ServletContext context = getActionServlet().getServletContext(); // Return the requested message resources instance return (MessageResources) context.getAttribute(key + getModuleConfig().getPrefix()); }
private void initModuleConfig(ServletContext context, ModuleConfig config) { S2Container container = getContainer(); if (!container.hasComponentDef(ModuleConfigWrapper.class)) { return; } ModuleConfigWrapper configWrapper = (ModuleConfigWrapper) container.getComponent(ModuleConfigWrapper.class); configWrapper.init(config); context.setAttribute(Globals.MODULE_KEY + config.getPrefix(), configWrapper); }
public static String getFormKey(ActionMapping mapping) { FormBeanConfig config = mapping.getModuleConfig().findFormBeanConfig( mapping.getName()); return mapping.getModuleConfig().getPrefix() + "/" + config.getName(); }