Examples of ModuleConfig


Examples of org.apache.struts.config.ModuleConfig

    // or the module attribute is already in use.
    String bundle = I18nSupport.getInstance(context).resolveBundle("calyxo-forms-validators");
    if (context.getAttribute(bundle) == null) {  // do not overwrite attribute in use
      MessageResourcesConfig messages = moduleConfig.findMessageResourcesConfig(bundle);
      if (messages == null) { // messages might be declared in the default module
        ModuleConfig defaultConfig = ModuleUtils.getInstance().getModuleConfig("", servlet.getServletContext());
        if (moduleConfig != defaultConfig && defaultConfig != null) {
          messages = defaultConfig.findMessageResourcesConfig(bundle);
        }
        if (messages == null) {  // no messages declared --> install message resources
          MessageResourcesFactory.setFactoryClass(PropertyMessageResourcesFactory.class.getName());
          MessageResources resources = MessageResourcesFactory.createFactory().createResources(bundle);
          context.setAttribute(bundle, resources);
View Full Code Here

Examples of org.apache.struts.config.ModuleConfig

            List<Pair> listItemsList = new ArrayList<Pair>();
            if (!definition.getTypeMeta().startsWith("!")) {
                for (Iterator i = ((List) definition.getTypeMetaObject()).iterator(); i.hasNext();) {
                    TypeMetaListItem item = (TypeMetaListItem) i.next();
                    ServletContext context = CoreServlet.getServlet().getServletContext();
                    ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request, context);
                    String mrKey = (item.getMessageResourcesKey() == null ? "properties" : item.getMessageResourcesKey())
                                    + moduleConfig.getPrefix();
                    MessageResources res = (MessageResources) context.getAttribute(mrKey);
                    String k = definition.getName() + ".value." + item.getValue();
                    String v = "";
                    if (res != null) {
                        v = res.getMessage((Locale) request.getSession().getAttribute(Globals.LOCALE_KEY), k);
View Full Code Here

Examples of org.apache.struts.config.ModuleConfig

     */
    protected TilesRequestProcessor getRequestProcessor(
        HttpServletRequest request,
        ServletContext servletContext) {

        ModuleConfig moduleConfig = getModuleConfig(request, servletContext);

        return (TilesRequestProcessor) servletContext.getAttribute(
            Globals.REQUEST_PROCESSOR_KEY + moduleConfig.getPrefix());
    }
View Full Code Here

Examples of org.apache.struts.config.ModuleConfig

     */
    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);
View Full Code Here

Examples of org.apache.struts.config.ModuleConfig

    else {
      MessageResources resources = (MessageResources) pageContext.getAttribute(Globals.MESSAGES_KEY,
          PageContext.REQUEST_SCOPE);

      if (resources == null) {
        ModuleConfig moduleConfig = (ModuleConfig) pageContext.getRequest().getAttribute(Globals.MODULE_KEY);

        if (moduleConfig == null) {
          moduleConfig = (ModuleConfig) pageContext.getServletContext().getAttribute(Globals.MODULE_KEY);
          pageContext.getRequest().setAttribute(Globals.MODULE_KEY, moduleConfig);
        }

        resources = (MessageResources) pageContext.getAttribute(
            Globals.MESSAGES_KEY + moduleConfig.getPrefix(), PageContext.APPLICATION_SCOPE);
      }

      if (resources == null) {
        resources = (MessageResources) pageContext.getAttribute(Globals.MESSAGES_KEY,
            PageContext.APPLICATION_SCOPE);
View Full Code Here

Examples of org.apache.struts.config.ModuleConfig

    private static SecureActionConfig getActionConfig(HttpServletRequest
            request,
            ServletContext app,
            String linkString)
    {
        ModuleConfig moduleConfig = StrutsUtils.selectModule(linkString, app);

        // Strip off the module path, if any
        linkString = linkString.substring(moduleConfig.getPrefix().length());

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

        SecurePlugInInterface spi = (SecurePlugInInterface)app.getAttribute(
                SecurePlugInInterface.SECURE_PLUGIN);
        Iterator mappingItr = spi.getServletMappings().iterator();
        while (mappingItr.hasNext())
        {
            String servletMapping = (String)mappingItr.next();

            int starIndex = servletMapping != null ? servletMapping.indexOf('*')
                            : -1;
            if (starIndex == -1)
            {
                continue;
            } // No servlet mapping or no usable pattern defined, short circuit

            String prefix = servletMapping.substring(0, starIndex);
            String suffix = servletMapping.substring(starIndex + 1);

            // Strip off the jsessionid, if any
            int jsession = linkString.indexOf(";jsessionid=");
            if (jsession >= 0)
            {
                linkString = linkString.substring(0, jsession);
            }

            // Strip off the query string, if any
            // (differs from the SSL Ext. version - query string before anchor)
            int question = linkString.indexOf("?");
            if (question >= 0)
            {
                linkString = linkString.substring(0, question);
            }

            // Strip off the anchor, if any
            int anchor = linkString.indexOf("#");
            if (anchor >= 0)
            {
                linkString = linkString.substring(0, anchor);
            }


            // Unable to establish this link as an action, short circuit
            if (!(linkString.startsWith(prefix) && linkString.endsWith(suffix)))
            {
                continue;
            }

            // Chop off prefix and suffix
            linkString = linkString.substring(prefix.length());
            linkString = linkString.substring(0,
                                              linkString.length()
                                              - suffix.length());
            if (!linkString.startsWith("/"))
            {
                linkString = "/" + linkString;
            }

            SecureActionConfig secureConfig = (SecureActionConfig)moduleConfig.
                                              findActionConfig(linkString);

            return secureConfig;
        }
        return null;
View Full Code Here

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

Examples of org.apache.struts.config.ModuleConfig

                                                       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

Examples of org.apache.struts.config.ModuleConfig

    {
        /* 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

Examples of org.apache.struts.config.ModuleConfig

    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
TOP
Copyright © 2018 www.massapi.com. 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.