Package org.apache.struts.config

Examples of org.apache.struts.config.ModuleConfig


     */
    public static MessageResources getMessageResources(HttpServletRequest request,
                                                       ServletContext app)
    {
        /* Identify the current module */
        ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request, app);
        return (MessageResources)app.getAttribute(Globals.MESSAGES_KEY +
                                                  moduleConfig.getPrefix());
    }
View Full Code Here


                                                       String bundle)
    {
        MessageResources resources = null;

        /* Identify the current module */
        ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request, app);


        if (bundle == null) {
            bundle = Globals.MESSAGES_KEY;
        }

        // First check request scope
        resources = (MessageResources) request.getAttribute(bundle + moduleConfig.getPrefix());

        if (resources == null) {
            resources = (MessageResources) app.getAttribute(bundle + moduleConfig.getPrefix());
        }

        return resources;
    }
View Full Code Here

    {
        /* Match against the list of sub-application prefixes */
        String prefix = ModuleUtils.getInstance().getModuleName(urlPath, app);

        /* Expose the resources for this sub-application */
        ModuleConfig config = (ModuleConfig)
            app.getAttribute(Globals.MODULE_KEY + prefix);

        return config;
    }
View Full Code Here

    public static String getActionMappingURL(ServletContext application,
                                             HttpServletRequest request,
                                             String action)
    {
        StringBuffer value = new StringBuffer(request.getContextPath());
        ModuleConfig config =
            (ModuleConfig)request.getAttribute(Globals.MODULE_KEY);
        if (config != null)
        {
            value.append(config.getPrefix());
        }

        /* Use our servlet mapping, if one is specified */
        String servletMapping =
            (String)application.getAttribute(Globals.SERVLET_KEY);
View Full Code Here

     */
    public static String getForwardURL(HttpServletRequest request,
                                       ServletContext app,
                                       String forward)
    {
        ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request, app);
        //TODO? beware of null module config if ActionServlet isn't init'ed?

        ActionConfig actionConfig =
            (ActionConfig)request.getAttribute(Globals.MAPPING_KEY);

        // NOTE: ActionConfig.findForwardConfig only searches local forwards
        ForwardConfig fc = null;
        if(actionConfig != null)
        {
            fc = actionConfig.findForwardConfig(forward);

            // No ActionConfig forward?
            // Find the ForwardConfig in the global-forwards.
            if(fc == null)
            {
                fc = moduleConfig.findForwardConfig(forward);

                // ok, give up
                if (fc == null)
                {
                    return null;
View Full Code Here

        {
            /* Is there a form bean associated with this mapping? */
            this.formName = config.getAttribute();
        }

        ModuleConfig mconfig = ModuleUtils.getInstance().getModuleConfig(request, app);
        this.resources = (ValidatorResources)app.getAttribute(ValidatorPlugIn.
                VALIDATOR_KEY +
                mconfig.getPrefix());

    }
View Full Code Here

        String formName = form.getName();

        jsFormName = formName;
        if(jsFormName.charAt(0) == '/') {
            String mappingName = StrutsUtils.getActionMappingName(jsFormName);
            ModuleConfig mconfig = ModuleUtils.getInstance().getModuleConfig(request, app);

            ActionConfig mapping = (ActionConfig) mconfig.findActionConfig(mappingName);
            if (mapping == null) {
                throw new NullPointerException("Cannot retrieve mapping for action " + mappingName);
            }
            jsFormName = mapping.getAttribute();
        }
View Full Code Here

        // Invoke the appropriate request processor for this request
        try {
            request.setAttribute(Constants.ACTION_EVENT_KEY, event);
            ModuleUtils.getInstance().selectModule(request, servletContext);
            ModuleConfig moduleConfig = (ModuleConfig)
                request.getAttribute(Globals.MODULE_KEY);
            if (log.isTraceEnabled()) {
                log.trace("Assigned to module with prefix '" +
                          moduleConfig.getPrefix() + "'");
            }
            RequestProcessor processor =
                getRequestProcessor(moduleConfig, servletContext);
            if (log.isTraceEnabled()) {
                log.trace("Invoking request processor instance " + processor);
View Full Code Here

        MessageResources resources =
            (MessageResources) request.getAttribute(bundle);

        if (resources == null) {
            ModuleConfig moduleConfig =
                ModuleUtils.getInstance().getModuleConfig(request, application);

            resources =
                (MessageResources) application.getAttribute(bundle
                    + moduleConfig.getPrefix());
        }

        if (resources == null) {
            resources = (MessageResources) application.getAttribute(bundle);
        }
View Full Code Here

     * @return the ModuleConfig object specified, or null if not found in the
     *         context.
     */
    public ModuleConfig getModuleConfig(String prefix,
        HttpServletRequest request, ServletContext context) {
        ModuleConfig moduleConfig = null;

        if (prefix != null) {
            //lookup module stored with the given prefix.
            moduleConfig = this.getModuleConfig(prefix, context);
        } else {
View Full Code Here

TOP

Related Classes of org.apache.struts.config.ModuleConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.