Package org.g4studio.core.mvc.xstruts.util

Examples of org.g4studio.core.mvc.xstruts.util.MessageResources


    MessageResourcesConfig[] mrc = moduleConfig.findMessageResourcesConfigs();

    // Look through all module's MessageResources
    for (int i = 0; i < mrc.length; i++) {
      MessageResources resources = this.getResources(request, mrc[i].getKey());

      // Look for key in MessageResources
      Iterator iter = this.keyMethodMap.keySet().iterator();

      while (iter.hasNext()) {
        String key = (String) iter.next();
        String text = resources.getMessage(userLocale, key);

        // Found key and haven't added to Map yet, so add the text
        if ((text != null) && !lookupMap.containsKey(text)) {
          lookupMap.put(text, key);
        }
View Full Code Here


   * @param key
   *            Message key
   */
  public boolean isMessage(String key) {
    // Look up the requested MessageResources
    MessageResources resources = getMessageResources();

    if (resources == null) {
      return false;
    }

    // Return the requested message presence indicator
    return resources.isPresent(RequestUtils.getUserLocale(request, null), key);
  }
View Full Code Here

   *
   * @param key
   *            Message key
   */
  public String getMessage(String key) {
    MessageResources resources = getMessageResources();

    if (resources == null) {
      return null;
    }

    return resources.getMessage(RequestUtils.getUserLocale(request, null), key);
  }
View Full Code Here

   *            Message key to be looked up and returned
   * @param args
   *            Replacement parameters for this message
   */
  public String getMessage(String key, Object[] args) {
    MessageResources resources = getMessageResources();

    if (resources == null) {
      return null;
    }

    // Return the requested message
    if (args == null) {
      return resources.getMessage(RequestUtils.getUserLocale(request, null), key);
    } else {
      return resources.getMessage(RequestUtils.getUserLocale(request, null), key, args);
    }
  }
View Full Code Here

      MessageResourcesFactory factoryObject = MessageResourcesFactory.createFactory();

      factoryObject.setConfig(mrcs[i]);

      MessageResources resources = factoryObject.createResources(mrcs[i].getParameter());

      resources.setReturnNull(mrcs[i].getNull());
      resources.setEscape(mrcs[i].isEscape());
      getServletContext().setAttribute(mrcs[i].getKey() + config.getPrefix(), resources);
    }
  }
View Full Code Here

    }

    actionCtx.setModuleConfig(moduleConfig);

    String key = Globals.MESSAGES_KEY + prefix;
    MessageResources messageResources = (MessageResources) actionCtx.getApplicationScope().get(key);

    if (messageResources == null) {
      throw new IllegalArgumentException("No message resources found in application scope under " + key);
    }
View Full Code Here

  protected String getErrorMessage(ActionContext context, ActionConfig actionConfig) {
    ServletActionContext servletActionContext = (ServletActionContext) context;

    // Retrieve internal message resources
    ActionServlet servlet = servletActionContext.getActionServlet();
    MessageResources resources = servlet.getInternal();

    return resources.getMessage("notAuthorized", actionConfig.getPath());
  }
View Full Code Here

    ServletActionContext sacontext = (ServletActionContext) context;
    String uri = forwardConfig.getPath();

    if (uri == null) {
      ActionServlet servlet = sacontext.getActionServlet();
      MessageResources resources = servlet.getInternal();

      throw new IllegalArgumentException(resources.getMessage("forwardPathNull"));
    }

    HttpServletRequest request = sacontext.getRequest();
    ServletContext servletContext = sacontext.getContext();
    HttpServletResponse response = sacontext.getResponse();
View Full Code Here

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

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

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

      resources = (MessageResources) application.getAttribute(bundle + moduleConfig.getPrefix());
View Full Code Here

      return varValue;
    }

    // Get the message resources
    String bundle = var.getBundle();
    MessageResources messages = getMessageResources(application, request, bundle);

    // Retrieve variable's value from message resources
    Locale locale = RequestUtils.getUserLocale(request, null);
    String value = messages.getMessage(locale, varValue, null);

    // Not found in message resources
    if ((value == null) && required) {
      throw new IllegalArgumentException(sysmsgs.getMessage("variable.resource.notfound", varName, varValue,
          bundle));
View Full Code Here

TOP

Related Classes of org.g4studio.core.mvc.xstruts.util.MessageResources

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.